Package org.apache.uima.aae.jmx

Examples of org.apache.uima.aae.jmx.ServicePerformance


          UimaMessage message = transport.produceMessage(AsynchAEMessage.Process,
                  AsynchAEMessage.Request, getName());
          message.addStringProperty(AsynchAEMessage.CasReference, newEntry.getCasReferenceId());
          message.addStringProperty(AsynchAEMessage.InputCasReference, aCasReferenceId);
          message.addLongProperty(AsynchAEMessage.CasSequence, sequence);
          ServicePerformance casStats = getCasStatistics(aCasReferenceId);

          message.addLongProperty(AsynchAEMessage.TimeToSerializeCAS, casStats
                  .getRawCasSerializationTime());
          message.addLongProperty(AsynchAEMessage.TimeToDeserializeCAS, casStats
                  .getRawCasDeserializationTime());
          message.addLongProperty(AsynchAEMessage.TimeInProcessCAS, casStats.getRawAnalysisTime());
          long iT = getIdleTimeBetweenProcessCalls(AsynchAEMessage.Process);
          message.addLongProperty(AsynchAEMessage.IdleTime, iT);
          if (!stopped) {
            transport.getUimaMessageDispatcher(anEndpoint.getEndpoint()).dispatch(message);
          }
        } else {
          // Send generated CAS to the client
          if (!stopped) {
            getOutputChannel().sendReply(newEntry, anEndpoint);
          }
        }
        // Remove the new CAS state entry from the local cache if this a top level primitive.
        // If not top level, the client (an Aggregate) will remove this entry when this new
        // generated CAS reaches Final State.
        if (isTopLevelComponent()) {
          try {
            localCache.lookupEntry(newEntry.getCasReferenceId()).setDropped(true);
          } catch (Exception e) {
          }
          localCache.remove(newEntry.getCasReferenceId());
        }

        // Remove Stats from the global Map associated with the new CAS
        // These stats for this CAS were added to the response message
        // and are no longer needed
        dropCasStatistics(newEntry.getCasReferenceId());
      } // while

      if (UIMAFramework.getLogger(CLASS_NAME).isLoggable(Level.FINEST)) {
        UIMAFramework.getLogger(CLASS_NAME).logrb(
                Level.FINEST,
                getClass().getName(),
                "process",
                UIMAEE_Constants.JMS_LOG_RESOURCE_BUNDLE,
                "UIMAEE_completed_analysis__FINEST",
                new Object[] { Thread.currentThread().getName(), getComponentName(),
                    aCasReferenceId, (double) (super.getCpuTime() - time) / (double) 1000000 });
      }
      getMonitor().resetCountingStatistic("", Monitor.ProcessErrorCount);
      // Set total number of children generated from this CAS
      // Store total time spent processing this input CAS
      getCasStatistics(aCasReferenceId).incrementAnalysisTime(totalProcessTime);
      if (!anEndpoint.isRemote()) {
        inputCASReturned = true;
        UimaTransport transport = getTransport(anEndpoint.getEndpoint());

        UimaMessage message = transport.produceMessage(AsynchAEMessage.Process,
                AsynchAEMessage.Response, getName());
        message.addStringProperty(AsynchAEMessage.CasReference, aCasReferenceId);
        ServicePerformance casStats = getCasStatistics(aCasReferenceId);

        message.addLongProperty(AsynchAEMessage.TimeToSerializeCAS, casStats
                .getRawCasSerializationTime());
        message.addLongProperty(AsynchAEMessage.TimeToDeserializeCAS, casStats
                .getRawCasDeserializationTime());
        message.addLongProperty(AsynchAEMessage.TimeInProcessCAS, casStats.getRawAnalysisTime());
        long iT = getIdleTimeBetweenProcessCalls(AsynchAEMessage.Process);
        message.addLongProperty(AsynchAEMessage.IdleTime, iT);
        // Send reply back to the client. Use internal (non-jms) transport
        if (!stopped) {
          transport.getUimaMessageDispatcher(anEndpoint.getEndpoint()).dispatch(message);
View Full Code Here


    try
    {
      String serializedCAS = null;
      //  Using Cas reference Id retrieve CAS from the shared Cash
      cas = getAnalysisEngineController().getInProcessCache().getCasByReference(aCasReferenceId);
      ServicePerformance casStats = getAnalysisEngineController().getCasStatistics(aCasReferenceId);
      if ( cas == null )
      {
        serializedCAS = getAnalysisEngineController().getInProcessCache().getSerializedCAS( aCasReferenceId );
      }
      else
      {
        CacheEntry entry = getAnalysisEngineController().getInProcessCache().getCacheEntryForCAS(aCasReferenceId);
        long t1 = System.nanoTime();
        //  Serialize CAS for remote Delegates
        String serializer = anEndpoint.getSerializer();
        if ( serializer == null || serializer.trim().length() == 0)
        {
          serializer = "xmi";
        }
        serializedCAS = serializeCAS(isReply, cas, aCasReferenceId, serializer);
        long timeToSerializeCas = System.nanoTime()-t1;
        entry.incrementTimeToSerializeCAS(timeToSerializeCas);
        casStats.incrementCasSerializationTime(timeToSerializeCas);
        getAnalysisEngineController().getServicePerformance().
          incrementCasSerializationTime(timeToSerializeCas);
        if ( cacheSerializedCas )
        {
          getAnalysisEngineController().getInProcessCache().saveSerializedCAS(aCasReferenceId, serializedCAS);
View Full Code Here

        getAnalysisEngineController().saveTime( departureTime, aCasReferenceId,  anEndpoint.getEndpoint());
      }
      else
      {
     
        ServicePerformance casStats =
          getAnalysisEngineController().getCasStatistics(aCasReferenceId);
       
        aTextMessage.setLongProperty(AsynchAEMessage.TimeToSerializeCAS, casStats.getRawCasSerializationTime());
//          aTextMessage.setLongProperty(AsynchAEMessage.TimeWaitingForCAS, entry.getTimeWaitingForCAS());
        aTextMessage.setLongProperty(AsynchAEMessage.TimeToDeserializeCAS, casStats.getRawCasDeserializationTime());
        aTextMessage.setLongProperty(AsynchAEMessage.TimeInProcessCAS, casStats.getRawAnalysisTime());
        aTextMessage.setLongProperty(AsynchAEMessage.IdleTime, anEndpoint.getIdleTime() );
       
        String lookupKey = getAnalysisEngineController().getName();//getInProcessCache().getMessageAccessorByReference(aCasReferenceId).getEndpointName();
        long arrivalTime = getAnalysisEngineController().getTime( aCasReferenceId, lookupKey); //serviceInputEndpoint);
        long timeInService = System.nanoTime()-arrivalTime;
View Full Code Here

          pServiceInfo.setAnalysisEngineInstanceCount(1);
         
          registerWithAgent(pServiceInfo, super.getManagementInterface().getJmxDomain()
              +super.jmxContext+",r"+remoteIndex+"="+key+" [Remote Uima EE Service],name="+key+"_"+serviceInfo.getLabel());

          ServicePerformance servicePerformance = new ServicePerformance();
         
          registerWithAgent(servicePerformance, super.getManagementInterface().getJmxDomain()+super.jmxContext+",r"+remoteIndex+"="+key+" [Remote Uima EE Service],name="+key+"_"+servicePerformance.getLabel());

          ServiceErrors serviceErrors = new ServiceErrors();
         
          registerWithAgent(serviceErrors, super.getManagementInterface().getJmxDomain()+super.jmxContext+",r"+remoteIndex+"="+key+" [Remote Uima EE Service],name="+key+"_"+serviceErrors.getLabel());
          remoteIndex++;
View Full Code Here

        pServiceInfo.setBrokerURL(serviceInfo.getBrokerURL());
        pServiceInfo.setInputQueueName(serviceInfo.getInputQueueName());
        pServiceInfo.setState(serviceInfo.getState());
        pServiceInfo.setAnalysisEngineInstanceCount(1);

        ServicePerformance servicePerformance = new ServicePerformance();

        ServiceErrors serviceErrors = new ServiceErrors();

        serviceErrorMap.put(key, serviceErrors);
        Object[] delegateStatsArray =
View Full Code Here

        }

        UIMAFramework.getLogger(CLASS_NAME).logrb(Level.FINE, CLASS_NAME.getName(),
            "handleProcessRequestWithXMI", UIMAEE_Constants.JMS_LOG_RESOURCE_BUNDLE, "UIMAEE_deserialize_cas_time_FINE",
            new Object[] { timeToDeserializeCAS / 1000 });
            ServicePerformance casStats = null;
       
       
        if (casReferenceId == null)
        {
          if (getController() instanceof PrimitiveAnalysisEngineController)
          {
            inputCasReferenceId = getController().getInProcessCache().register(cas, aMessageContext, deserSharedData);
          }
          else
          {
            casReferenceId = getController().getInProcessCache().register(cas, aMessageContext, deserSharedData);
            if ( inputCasReferenceId == null )
            {
              inputCasReferenceId = casReferenceId;
            }
          }
          casStats = getController().getCasStatistics(inputCasReferenceId);

        }
        else
        {
          getController().getInProcessCache().register(cas, aMessageContext, deserSharedData, casReferenceId);
/*
          if ( aMessageContext.propertyExists(AsynchAEMessage.InputCasReference))
          {
            CacheEntry cacheEntry = getController().getInProcessCache().getCacheEntryForCAS(casReferenceId);
            String parentCasId = aMessageContext.getMessageStringProperty(AsynchAEMessage.InputCasReference);
            cacheEntry.setInputCasReferenceId(parentCasId);
          }
*/         
          casStats = getController().getCasStatistics(casReferenceId);
        }
        casStats.incrementCasDeserializationTime(timeToDeserializeCAS);
        if ( getController().isTopLevelComponent() )
        {
          getController().getServicePerformance().incrementCasDeserializationTime(timeToDeserializeCAS);
        }
        //  Set a local flag to indicate that the CAS has been added to the cache. This will be usefull when handling an exception
View Full Code Here

      {
        throw new AsynchAEException("CasReferenceId:"+aCasReferenceId+" Not Found in the Cache.");
      }
      CacheEntry inputCasEntry = null;
      String inputCasReferenceId = entry.getInputCasReferenceId();
      ServicePerformance casStats =
        ((AggregateAnalysisEngineController)getController()).getCasStatistics(aCasReferenceId);
      if ( inputCasReferenceId != null &&
         getController().getInProcessCache().entryExists(inputCasReferenceId) )
      {
        String casProducerKey = entry.getCasProducerKey();
        if ( casProducerKey != null &&
          ((AggregateAnalysisEngineController)getController()).
            isDelegateKeyValid(casProducerKey) )
        {
          //  Get entry for the input CAS
          inputCasEntry = getController().
                getInProcessCache().
                  getCacheEntryForCAS(inputCasReferenceId);
        }
       
      }
      ServicePerformance delegateServicePerformance =
        ((AggregateAnalysisEngineController)getController()).getServicePerformance(delegateKey);

      if (aMessageContext.propertyExists(AsynchAEMessage.TimeToSerializeCAS))
      {
        long timeToSerializeCAS = ((Long) aMessageContext.getMessageLongProperty(AsynchAEMessage.TimeToSerializeCAS)).longValue();
        if ( timeToSerializeCAS > 0)
        {
          casStats.incrementCasSerializationTime(timeToSerializeCAS);
          if ( delegateServicePerformance != null )
          {
            delegateServicePerformance.
            incrementCasSerializationTime(timeToSerializeCAS);
          }
          getController().getServicePerformance().
            incrementCasSerializationTime(timeToSerializeCAS);
        }
      }
      if (aMessageContext.propertyExists(AsynchAEMessage.TimeToDeserializeCAS))
      {
        long timeToDeserializeCAS = ((Long) aMessageContext.getMessageLongProperty(AsynchAEMessage.TimeToDeserializeCAS)).longValue();
        if ( timeToDeserializeCAS > 0 )
        {
          casStats.incrementCasDeserializationTime(timeToDeserializeCAS);

          if ( delegateServicePerformance != null )
          {
            delegateServicePerformance.
              incrementCasDeserializationTime(timeToDeserializeCAS);
          }
          getController().getServicePerformance().
            incrementCasDeserializationTime(timeToDeserializeCAS);
        }
      }

      if (aMessageContext.propertyExists(AsynchAEMessage.IdleTime))
      {
        long idleTime = ((Long) aMessageContext.getMessageLongProperty(AsynchAEMessage.IdleTime)).longValue();
        if ( idleTime > 0 )
        {
          casStats.incrementIdleTime(idleTime);
          if ( delegateServicePerformance != null )
          {
            delegateServicePerformance.
              incrementIdleTime(idleTime);
          }
        }
      }
     
      if (aMessageContext.propertyExists(AsynchAEMessage.TimeWaitingForCAS))
      {
        long timeWaitingForCAS = ((Long) aMessageContext.getMessageLongProperty(AsynchAEMessage.TimeWaitingForCAS)).longValue();
        if ( aMessageContext.getEndpoint().isRemote())
        {
          entry.incrementTimeWaitingForCAS(timeWaitingForCAS);
          if ( inputCasEntry != null )
          {
            inputCasEntry.incrementTimeWaitingForCAS(timeWaitingForCAS);
          }
        }
      }
      if (aMessageContext.propertyExists(AsynchAEMessage.TimeInProcessCAS))
      {
        long timeInProcessCAS = ((Long) aMessageContext.getMessageLongProperty(AsynchAEMessage.TimeInProcessCAS)).longValue();
        casStats.incrementAnalysisTime(timeInProcessCAS);
        if ( delegateServicePerformance != null )
        {
          delegateServicePerformance.
            incrementAnalysisTime(timeInProcessCAS);
        }
        //  Accumulate processing time
        getController().getServicePerformance().
          incrementAnalysisTime(timeInProcessCAS);
        if ( inputCasReferenceId != null )
        {
          ServicePerformance inputCasStats =
            ((AggregateAnalysisEngineController)getController()).
              getCasStatistics(inputCasReferenceId);
          // Update processing time for this CAS
          if ( inputCasStats != null )
          {
            inputCasStats.incrementAnalysisTime(timeInProcessCAS);
          }
        }
      }
    }
    catch( AsynchAEException e)
View Full Code Here

        return;
      }
      //  Increment number of CASes processed by this delegate
      if ( aDelegateKey != null)
      {
        ServicePerformance delegateServicePerformance =
          ((AggregateAnalysisEngineController)getController()).
            getServicePerformance(aDelegateKey);
        if ( delegateServicePerformance != null )
        {
          delegateServicePerformance.incrementNumberOfCASesProcessed();
        }
      }
     
      String xmi = aMessageContext.getStringMessage();

      //  Fetch entry from the cache for a given Cas Id. The entry contains a CAS that will be used during deserialization
      CacheEntry cacheEntry = getController().getInProcessCache().getCacheEntryForCAS(casReferenceId);
      cacheEntry.setReplyReceived();
      cas = cacheEntry.getCas()
      int totalNumberOfParallelDelegatesProcessingCas = cacheEntry.getNumberOfParallelDelegates();
      UIMAFramework.getLogger(CLASS_NAME).logrb(Level.FINE, CLASS_NAME.getName(),
                  "handleProcessResponseWithXMI", UIMAEE_Constants.JMS_LOG_RESOURCE_BUNDLE, "UIMAEE_number_parallel_delegates_FINE",
                  new Object[] { totalNumberOfParallelDelegatesProcessingCas});

      if (cas == null)
      {
        throw new AsynchAEException(Thread.currentThread().getName()+"-Cache Does not contain a CAS. Cas Reference Id::"+casReferenceId);
      }
      if ( UIMAFramework.getLogger().isLoggable(Level.FINEST) )
      {
        UIMAFramework.getLogger(CLASS_NAME).logrb(Level.FINEST, CLASS_NAME.getName(),
                    "handleProcessResponseWithXMI", UIMAEE_Constants.JMS_LOG_RESOURCE_BUNDLE, "UIMAEE_rcvd_reply_FINEST",
                    new Object[] { aMessageContext.getEndpoint().getEndpoint(), casReferenceId, xmi });
      }
     
      long t1 = System.nanoTime();
     
      synchronized (monitor)
      {
        XmiSerializationSharedData deserSharedData;
        if (totalNumberOfParallelDelegatesProcessingCas > 1 && cacheEntry.howManyDelegatesResponded() > 0)
        {
          // process secondary reply from a parallel step
          UIMAFramework.getLogger(CLASS_NAME).logrb(Level.FINEST, CLASS_NAME.getName(),
                      "handleProcessResponseWithXMI", UIMAEE_Constants.JMS_LOG_RESOURCE_BUNDLE, "UIMAEE_delegate_responded_count_FINEST",
                      new Object[] { cacheEntry.howManyDelegatesResponded(), casReferenceId});
         
          int highWaterMark = cacheEntry.getHighWaterMark();
          UIMAFramework.getLogger(CLASS_NAME).logrb(Level.FINEST, CLASS_NAME.getName(),
                      "handleProcessResponseWithXMI", UIMAEE_Constants.JMS_LOG_RESOURCE_BUNDLE, "UIMAEE_high_water_mark_FINEST",
                      new Object[] { highWaterMark, casReferenceId });

          deserSharedData = getController().getInProcessCache().getCacheEntryForCAS(casReferenceId).getDeserSharedData();
          UimaSerializer.deserializeCasFromXmi(xmi, cas, deserSharedData, true, highWaterMark);
        }
        else // general case, or first reply from a parallel step
        {
          //  Processing the reply from a standard, non-parallel delegate
          deserSharedData = getController().getInProcessCache().getCacheEntryForCAS(casReferenceId).getDeserSharedData();
          if (deserSharedData == null) {
            deserSharedData = new XmiSerializationSharedData();
            getController().getInProcessCache().getCacheEntryForCAS(casReferenceId).setXmiSerializationData(deserSharedData);
          }
          UimaSerializer.deserializeCasFromXmi(xmi, cas, deserSharedData, true, -1);
        }
      }

     
      if ( cacheEntry != null && totalNumberOfParallelDelegatesProcessingCas > 1 )
      {
        synchronized( cacheEntry )
        {
          cacheEntry.incrementHowManyDelegatesResponded();
        }
      }
   
      long timeToDeserializeCAS = System.nanoTime() - t1;

            getController().
              getServicePerformance().
                incrementCasDeserializationTime(timeToDeserializeCAS);

            ServicePerformance casStats =
              getController().getCasStatistics(casReferenceId);
      casStats.incrementCasDeserializationTime(timeToDeserializeCAS);
      LongNumericStatistic statistic;
      if ( (statistic = getController().getMonitor().getLongNumericStatistic("",Monitor.TotalDeserializeTime)) != null )
      {
        statistic.increment(timeToDeserializeCAS);
      }
View Full Code Here

      cacheEntry.setReplyReceived();
      CAS cas = cacheEntry.getCas();
      String endpointName = aMessageContext.getEndpoint().getEndpoint();
      String delegateKey = ((AggregateAnalysisEngineController)getController()).
                  lookUpDelegateKey(endpointName);
      ServicePerformance delegateServicePerformance =
        ((AggregateAnalysisEngineController)getController()).
          getServicePerformance(delegateKey);
      if ( delegateServicePerformance != null )
      {
        delegateServicePerformance.incrementNumberOfCASesProcessed();
      }

      //CAS cas = getController().getInProcessCache().getCasByReference(casReferenceId);
      if (cas != null)
      {
View Full Code Here

  {
    String thisComponentName = getComponentName();
   
    String name = "";
    int index = getIndex();
    servicePerformance = new ServicePerformance();
//    name = getJMXDomain()+key_value_list+",name="+thisComponentName+"_"+servicePerformance.getLabel();
    name = jmxManagement.getJmxDomain()+key_value_list+",name="+thisComponentName+"_"+servicePerformance.getLabel();
   
   
    registerWithAgent(servicePerformance, name );
View Full Code Here

TOP

Related Classes of org.apache.uima.aae.jmx.ServicePerformance

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.