use of io.joynr.dispatcher.ServletMessageReceiver in project joynr by bmwcarit.
the class JoynrApplicationLauncher method shutdown.
/**
* If clear, then deregister etc.
*
* @param clear
* indicates whether the messageListener of the servlet receiver
* should be dropped and the channel closed
*/
// TODO support clear properly
public void shutdown(boolean clear) {
if (executionQueue != null) {
executionQueue.shutdownNow();
}
if (joynrInjector != null) {
// switch to lp receiver and call servlet shutdown to be able to receive responses
ServletMessageReceiver servletReceiver = joynrInjector.getInstance(ServletMessageReceiver.class);
servletReceiver.switchToLongPolling();
for (JoynrApplication app : apps) {
try {
app.shutdown();
} catch (Exception e) {
logger.debug("error shutting down app: " + app.getClass(), e);
}
}
servletReceiver.shutdown(clear);
}
try {
if (executionQueue != null) {
executionQueue.awaitTermination(timeout, TimeUnit.SECONDS);
}
} catch (InterruptedException e) {
return;
}
}
Aggregations