public void testServiceInactivityTimeoutOnReplyQueue() throws Exception {
System.out.println("-------------- testServiceInactivityTimeoutOnReplyQueue -------------");
String sessionTimeoutOverride = System.getProperty("SessionTimeoutOverride");
System.setProperty("SessionTimeoutOverride", "5000");
BaseUIMAAsynchronousEngine_impl eeUimaEngine = new BaseUIMAAsynchronousEngine_impl();
deployService(eeUimaEngine, relativePath + "/Deploy_NoOpAnnotator.xml");
Map<String, Object> appCtx = buildContext(String.valueOf(broker.getMasterConnectorURI()),
"NoOpAnnotatorQueue");
appCtx.put(UimaAsynchronousEngine.GetMetaTimeout, 1000);
initialize(eeUimaEngine, appCtx);
waitUntilInitialized();
System.out.println("Client Initialized");
CAS cas = eeUimaEngine.getCAS();
eeUimaEngine.sendAndReceiveCAS(cas); // This will start a timer on reply queue
cas.reset();
// Now sleep for 8 seconds to let the service timeout on its reply queue due
// to a 5 second inactivity timeout
Thread.currentThread().sleep(8000);
System.out.println("Client Sending CPC");
// Send CPC. The service should recreate a session and send CPC reply
eeUimaEngine.collectionProcessingComplete();
// Now send some CASes and sleep to let the inactivity timer pop again
for (int i = 0; i < 5; i++) {
eeUimaEngine.sendAndReceiveCAS(cas); // This will start a timer on reply queue
cas.reset();
if (i == 3) {
Thread.currentThread().sleep(8000);
}
}
// Send another CPC
eeUimaEngine.collectionProcessingComplete();
eeUimaEngine.stop();
// Reset inactivity to original value or remove if it was not set
if (sessionTimeoutOverride != null) {
System.setProperty("SessionTimeoutOverride", sessionTimeoutOverride);
} else {