Package org.apache.uima.aae.client

Examples of org.apache.uima.aae.client.UimaASProcessStatusImpl$EventLog


  protected void notifyOnTimout(CAS aCAS, String anEndpoint, int aTimeoutKind, String casReferenceId)
  {

    ProcessTrace pt = new ProcessTrace_impl();
    UimaASProcessStatusImpl status = new UimaASProcessStatusImpl(pt,casReferenceId);

    switch (aTimeoutKind)
    {
    case (MetadataTimeout):
      UIMAFramework.getLogger(CLASS_NAME).logrb(Level.FINEST, CLASS_NAME.getName(), "notifyOnTimout", JmsConstants.JMS_LOG_RESOURCE_BUNDLE, "UIMAJMS_meta_timeout_INFO", new Object[] { anEndpoint });
      status.addEventStatus("GetMeta", "Failed", new UimaASMetaRequestTimeout());
      notifyListeners(null, status, AsynchAEMessage.GetMeta);
      synchronized (metadataReplyMonitor)
      {
        abort = true;
        metadataReplyMonitor.notifyAll();
      }
      break;
    case (CpCTimeout):
      UIMAFramework.getLogger(CLASS_NAME).logrb(Level.FINEST, CLASS_NAME.getName(), "notifyOnTimout", JmsConstants.JMS_LOG_RESOURCE_BUNDLE, "UIMAJMS_cpc_timeout_INFO", new Object[] { anEndpoint });
      status.addEventStatus("CpC", "Failed", new UimaASCollectionProcessCompleteTimeout());
      notifyListeners(null, status, AsynchAEMessage.CollectionProcessComplete);
      receivedCpcReply = true;
      synchronized(endOfCollectionMonitor)
      {
        endOfCollectionMonitor.notifyAll();
      }
      break;

    case (ProcessTimeout):
      UIMAFramework.getLogger(CLASS_NAME).logrb(Level.FINEST, CLASS_NAME.getName(), "notifyOnTimout", JmsConstants.JMS_LOG_RESOURCE_BUNDLE, "UIMAJMS_process_timeout_INFO", new Object[] { anEndpoint });
      ClientRequest cachedRequest = (ClientRequest)clientCache.get(casReferenceId);

      if ( cachedRequest == null )
      {
        // if missing for any reason ...
        UIMAFramework.getLogger(CLASS_NAME).logrb(Level.INFO, CLASS_NAME.getName(), "handleProcessReply", JmsConstants.JMS_LOG_RESOURCE_BUNDLE, "UIMAJMS_received_expired_msg_INFO",
                new Object[] { anEndpoint, casReferenceId });
        return;
      }
      //  Store the total latency for this CAS. The departure time is set right before the CAS
      //  is sent to a service.
      cachedRequest.setTimeWaitingForReply(System.nanoTime() - cachedRequest.getCASDepartureTime());

      // mark timeout exception
      cachedRequest.setTimeoutException();

      if ( cachedRequest.isSynchronousInvocation() )
      {
        //  Signal a thread that we received a reply, if in the map
        if ( threadMonitorMap.containsKey(cachedRequest.getThreadId()))
        {
          ThreadMonitor threadMonitor = (ThreadMonitor) threadMonitorMap.get(cachedRequest.getThreadId());
          //    Unblock the sending thread so that it can complete processing with an error
          synchronized( threadMonitor.getMonitor() )
          {
            threadMonitor.setWasSignaled();
            threadMonitor.getMonitor().notifyAll();
          }
        }
      }
      else
      {
        // notify the application listener with the error
        exc = new UimaASProcessCasTimeout();
        status.addEventStatus("Process", "Failed", exc);
        notifyListeners(aCAS, status, AsynchAEMessage.Process);
      }
      cachedRequest.removeEntry(casReferenceId);

      synchronized (gater)
View Full Code Here


    int payload = ((Integer) message.getIntProperty(AsynchAEMessage.Payload)).intValue();

    if (AsynchAEMessage.Exception == payload)
    {
      ProcessTrace pt = new ProcessTrace_impl();
      UimaASProcessStatusImpl status = new UimaASProcessStatusImpl(pt);
      Exception exception = retrieveExceptionFormMessage(message);

//      Exception exception = (Exception) ((ObjectMessage) message).getObject();
      status.addEventStatus("CpC", "Failed", exception);
      notifyListeners(null, status, AsynchAEMessage.CollectionProcessComplete);
      UIMAFramework.getLogger(CLASS_NAME).logrb(Level.FINEST, CLASS_NAME.getName(), "handleCollectionProcessCompleteReply", JmsConstants.JMS_LOG_RESOURCE_BUNDLE, "UIMAJMS_received_exception_msg_INFO",
          new Object[] { message.getStringProperty(AsynchAEMessage.MessageFrom), message.getStringProperty(AsynchAEMessage.CasReference), exception });
    }
    else
View Full Code Here

        while (howManyCASes-- > 0)
        {
          CAS cas = uimaClient.getCAS();
          cas.setDocumentText(text);
          ProcessTrace pt = new ProcessTrace_impl();
          UimaASProcessStatusImpl status = new UimaASProcessStatusImpl(pt);

          try
          {
            // Send CAS and wait for a response
            uimaClient.sendAndReceiveCAS(cas, pt);
          }
          catch( ResourceProcessException rpe)
          {
            status.addEventStatus("Process", "Failed", rpe);
          }
          finally
          {
            entityProcessComplete(cas, status);
            cas.release();
View Full Code Here

  protected void handleCollectionProcessCompleteReply(Message message) throws Exception {
    int payload = ((Integer) message.getIntProperty(AsynchAEMessage.Payload)).intValue();
    try {
      if (AsynchAEMessage.Exception == payload) {
        ProcessTrace pt = new ProcessTrace_impl();
        UimaASProcessStatusImpl status = new UimaASProcessStatusImpl(pt);
        Exception exception = retrieveExceptionFromMessage(message);

        status.addEventStatus("CpC", "Failed", exception);
        notifyListeners(null, status, AsynchAEMessage.CollectionProcessComplete);
        if (UIMAFramework.getLogger(CLASS_NAME).isLoggable(Level.INFO)) {
          UIMAFramework.getLogger(CLASS_NAME).logrb(
                  Level.INFO,
                  CLASS_NAME.getName(),
View Full Code Here

                sendCAS(cachedRequest.getCAS(), cachedRequest);
              }
        }
      } else {
        ProcessTrace pt = new ProcessTrace_impl();
        UimaASProcessStatusImpl status = new UimaASProcessStatusImpl(pt);
        notifyListeners(null, status, AsynchAEMessage.GetMeta);
      }
      // Handled Ping reply
      return;
    }
    int payload = ((Integer) message.getIntProperty(AsynchAEMessage.Payload)).intValue();
    removeFromCache(uniqueIdentifier);

    try {
      if (AsynchAEMessage.Exception == payload) {
        ProcessTrace pt = new ProcessTrace_impl();
        UimaASProcessStatusImpl status = new UimaASProcessStatusImpl(pt);
        Exception exception = retrieveExceptionFromMessage(message);
        clientSideJmxStats.incrementMetaErrorCount();
        status.addEventStatus("GetMeta", "Failed", exception);
        notifyListeners(null, status, AsynchAEMessage.GetMeta);
        if (UIMAFramework.getLogger(CLASS_NAME).isLoggable(Level.INFO)) {
          UIMAFramework.getLogger(CLASS_NAME).logrb(
                  Level.INFO,
                  CLASS_NAME.getName(),
View Full Code Here

          if ( !cachedRequest.receivedServiceACK ) {
               cachedRequest.setReceivedServiceACK(true);
            
                cachedRequest.setHostIpProcessingCAS(hostIP);
                cachedRequest.setServicePID(processPID);
                    UimaASProcessStatusImpl status;
                   
                    if (parentCasReferenceId != null  && parentCasReferenceId.equals(cachedRequest.getCasReferenceId())) {
                        status = new UimaASProcessStatusImpl(pt, cachedRequest.getCAS(),casReferenceId, parentCasReferenceId);
                    } else {
                        status = new UimaASProcessStatusImpl(pt, cachedRequest.getCAS(), casReferenceId);
                    }
                    try {
                    // Notify the application with an ACK as if the ACK came from the remote service. Some
                    // applications may depend on receiving the ACK.
                    onBeforeProcessCAS(status, cachedRequest.getHostIpProcessingCAS(), cachedRequest.getServicePID());
View Full Code Here

    return false;
  }
  protected void handleNonProcessException(Exception exception )
  throws Exception {
    ProcessTrace pt = new ProcessTrace_impl();
    UimaASProcessStatusImpl status = new UimaASProcessStatusImpl(pt);
    clientSideJmxStats.incrementMetaErrorCount();
    status.addEventStatus("GetMeta", "Failed", exception);
    notifyListeners(null, status, AsynchAEMessage.GetMeta);
  }
View Full Code Here

        if (inputCasReferenceId != null) {
          serviceDelegate.removeCasFromOutstandingList(inputCasReferenceId);
        } else if (casReferenceId != null ) {
          serviceDelegate.removeCasFromOutstandingList(casReferenceId);
        }
        UimaASProcessStatusImpl status;
       
        if (cachedRequest != null ) {
            // Add Cas referenceId(s) to enable matching replies with requests (ids may be null)
            status = new UimaASProcessStatusImpl(pt, cachedRequest.getCAS(), casReferenceId,
                    inputCasReferenceId);
        } else {
            status = new UimaASProcessStatusImpl(pt, null, casReferenceId,
                    inputCasReferenceId);
        }
        status.addEventStatus("Process", "Failed", exception);
        if (cachedRequest != null && !cachedRequest.isSynchronousInvocation()
                && cachedRequest.getCAS() != null) {
          notifyListeners(cachedRequest.getCAS(), status, AsynchAEMessage.Process);
        } else {
          notifyListeners(null, status, AsynchAEMessage.Process);
View Full Code Here

      }
      try {
        // Log stats and populate ProcessTrace object
        logTimingInfo(message, pt, cachedRequest);
        if (doNotify) {
          UimaASProcessStatusImpl status;
          String inputCasReferenceId = message.getStringProperty(AsynchAEMessage.InputCasReference);
          if (inputCasReferenceId != null
                  && inputCasReferenceId.equals(cachedRequest.getCasReferenceId())) {
            status = new UimaASProcessStatusImpl(pt, cas,casReferenceId, inputCasReferenceId);
          } else {
            status = new UimaASProcessStatusImpl(pt, cas, casReferenceId);
          }
          if ( message.propertyExists(AsynchAEMessage.CASPerComponentMetrics)) {
            // Add CAS identifier to enable matching replies with requests
            notifyListeners(cas, status, AsynchAEMessage.Process, message.getStringProperty(AsynchAEMessage.CASPerComponentMetrics));
          } else {
View Full Code Here

  }

  protected void notifyOnTimout(CAS aCAS, String anEndpoint, int aTimeoutKind, String casReferenceId) {

    ProcessTrace pt = new ProcessTrace_impl();
    UimaASProcessStatusImpl status = new UimaASProcessStatusImpl(pt, aCAS, casReferenceId);

    switch (aTimeoutKind) {
      case (MetadataTimeout):
        if (UIMAFramework.getLogger(CLASS_NAME).isLoggable(Level.WARNING)) {
          UIMAFramework.getLogger(CLASS_NAME).logrb(Level.WARNING, CLASS_NAME.getName(),
                  "notifyOnTimout", JmsConstants.JMS_LOG_RESOURCE_BUNDLE,
                  "UIMAJMS_meta_timeout_WARNING", new Object[] { anEndpoint });
        }
        status.addEventStatus("GetMeta", "Failed", new UimaASMetaRequestTimeout("UIMA AS Client Timed Out Waiting For GetMeta Reply From a Service On Queue:"+anEndpoint));
        notifyListeners(null, status, AsynchAEMessage.GetMeta);
        abort = true;
        getMetaSemaphore.release();
        break;
      case (PingTimeout):
        if (UIMAFramework.getLogger(CLASS_NAME).isLoggable(Level.WARNING)) {
          UIMAFramework.getLogger(CLASS_NAME).logrb(Level.WARNING, CLASS_NAME.getName(),
                  "notifyOnTimout", JmsConstants.JMS_LOG_RESOURCE_BUNDLE,
                  "UIMAJMS_meta_timeout_WARNING", new Object[] { anEndpoint });
        }
        status.addEventStatus("Ping", "Failed", new UimaASPingTimeout("UIMA AS Client Timed Out Waiting For Ping Reply From a Service On Queue:"+anEndpoint));
        notifyListeners(null, status, AsynchAEMessage.Ping);
        // The main thread could be stuck waiting for a CAS. Grab any CAS in the
        // client cache and release it so that we can shutdown.
        if (!clientCache.isEmpty()) {
          ClientRequest anyCasRequest = clientCache.elements().nextElement();
          if (anyCasRequest.getCAS() != null) {
            anyCasRequest.getCAS().release();
          }
        }
        abort = true;
        break;
      case (CpCTimeout):
        if (UIMAFramework.getLogger(CLASS_NAME).isLoggable(Level.INFO)) {
          UIMAFramework.getLogger(CLASS_NAME).logrb(Level.INFO, CLASS_NAME.getName(),
                  "notifyOnTimout", JmsConstants.JMS_LOG_RESOURCE_BUNDLE,
                  "UIMAJMS_cpc_timeout_INFO", new Object[] { anEndpoint });
        }
        status.addEventStatus("CpC", "Failed",
                new UimaASCollectionProcessCompleteTimeout("UIMA AS Client Timed Out Waiting For CPC Reply From a Service On Queue:"+anEndpoint));
        // release the semaphore acquired in collectionProcessingComplete()
        cpcReplySemaphore.release();
        notifyListeners(null, status, AsynchAEMessage.CollectionProcessComplete);
        break;

      case (ProcessTimeout):
        if ( casReferenceId != null ) {
              ClientRequest cachedRequest = (ClientRequest) clientCache.get(casReferenceId);
              if (cachedRequest != null) {
                if (UIMAFramework.getLogger(CLASS_NAME).isLoggable(Level.WARNING)) {
                  UIMAFramework.getLogger(CLASS_NAME).logrb(Level.WARNING, CLASS_NAME.getName(),
                        "notifyOnTimout", JmsConstants.JMS_LOG_RESOURCE_BUNDLE,
                        "UIMAJMS_process_timeout_WARNING", new Object[] { anEndpoint, getBrokerURI(), cachedRequest.getHostIpProcessingCAS() });
                }
              } else {
                if (UIMAFramework.getLogger(CLASS_NAME).isLoggable(Level.INFO)) {
                  // if missing for any reason ...
                  UIMAFramework.getLogger(CLASS_NAME).logrb(Level.INFO, CLASS_NAME.getName(),
                          "notifyOnTimout", JmsConstants.JMS_LOG_RESOURCE_BUNDLE,
                          "UIMAJMS_received_expired_msg_INFO",
                          new Object[] { anEndpoint, casReferenceId });
                }
                return;
              }
              // Store the total latency for this CAS. The departure time is set right before the CAS
              // is sent to a service.
              cachedRequest.setTimeWaitingForReply(System.nanoTime()
                      - cachedRequest.getCASDepartureTime());

              // mark timeout exception
              cachedRequest.setTimeoutException();

              if (cachedRequest.isSynchronousInvocation()) {
                // Signal a thread that we received a reply, if in the map
                if (threadMonitorMap.containsKey(cachedRequest.getThreadId())) {
                  ThreadMonitor threadMonitor = (ThreadMonitor) threadMonitorMap.get(cachedRequest
                          .getThreadId());
                  // Unblock the sending thread so that it can complete processing with an error
                  if (threadMonitor != null) {
                    threadMonitor.getMonitor().release();
                    cachedRequest.setReceivedProcessCasReply(); // should not be needed
                  }
                }
              } else {
                // notify the application listener with the error
                if ( serviceDelegate.isPingTimeout()) {
                  exc = new UimaASProcessCasTimeout(new UimaASPingTimeout("UIMA AS Client Ping Time While Waiting For Reply From a Service On Queue:"+anEndpoint));
                  serviceDelegate.resetPingTimeout();
                } else {
                  exc = new UimaASProcessCasTimeout("UIMA AS Client Timed Out Waiting For CAS:"+casReferenceId+ " Reply From a Service On Queue:"+anEndpoint);
                }
                status.addEventStatus("Process", "Failed", exc);
                notifyListeners(aCAS, status, AsynchAEMessage.Process);
              }
              boolean isSynchronousCall = cachedRequest.isSynchronousInvocation();
             
              cachedRequest.removeEntry(casReferenceId);
View Full Code Here

TOP

Related Classes of org.apache.uima.aae.client.UimaASProcessStatusImpl$EventLog

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.