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);
}