+ endpoint + ":" + System.nanoTime() + ":Cmd:" + aCommand);
final Delegate delegate = this;
timer.schedule(new TimerTask() {
public void run() {
delegate.setState(TIMEOUT_STATE);
ErrorContext errorContext = new ErrorContext();
errorContext.add(AsynchAEMessage.Command, aCommand);
Exception cause = new MessageTimeoutException("Delegate Service:"+delegateKey+" Has Timed Out While Processing CAS:"+aCasReferenceId);
if (AsynchAEMessage.Process == aCommand) {
if (UIMAFramework.getLogger(CLASS_NAME).isLoggable(Level.WARNING)) {
UIMAFramework.getLogger(CLASS_NAME).logrb(Level.WARNING, this.getClass().getName(),
"Delegate.TimerTask.run", UIMAEE_Constants.JMS_LOG_RESOURCE_BUNDLE,
"UIMAEE_cas_timeout_no_reply__WARNING",
new Object[] { delegate.getKey(), timeToWait, aCasReferenceId });
}
errorContext.add(AsynchAEMessage.CasReference, aCasReferenceId);
errorContext.add(ErrorContext.THROWABLE_ERROR, cause);
// Check if this is a Ping timeout and associate this with
// the oldest CAS from the list of CASes pending reply.
if (isAwaitingPingReply() && getCasPendingReplyListSize() > 0) {
String casReferenceId = getOldestCasIdFromOutstandingList();
errorContext.add(AsynchAEMessage.CasReference, casReferenceId);
// Override the command to make sure this timeout is handled
// by the ProcessCasErrorHandler.
errorContext.add(AsynchAEMessage.Command, AsynchAEMessage.Process);
errorContext.add(AsynchAEMessage.ErrorCause, AsynchAEMessage.PingTimeout);
}
} else if (AsynchAEMessage.GetMeta == aCommand) {
if (UIMAFramework.getLogger(CLASS_NAME).isLoggable(Level.WARNING)) {
UIMAFramework.getLogger(CLASS_NAME).logrb(Level.WARNING, this.getClass().getName(),
"Delegate.TimerTask.run", UIMAEE_Constants.JMS_LOG_RESOURCE_BUNDLE,
"UIMAEE_meta_timeout_no_reply__WARNING",
new Object[] { delegate.getKey(), timeToWait });
}
} else if (AsynchAEMessage.CollectionProcessComplete == aCommand) {
if (UIMAFramework.getLogger(CLASS_NAME).isLoggable(Level.WARNING)) {
UIMAFramework.getLogger(CLASS_NAME).logrb(Level.WARNING, this.getClass().getName(),
"Delegate.TimerTask.run", UIMAEE_Constants.JMS_LOG_RESOURCE_BUNDLE,
"UIMAEE_cpc_timeout_no_reply__WARNING",
new Object[] { delegate.getKey(), timeToWait });
}
}
errorContext.add(AsynchAEMessage.Endpoint, getEndpoint());
handleError(cause, errorContext);
}
}, timeToRun);
}