ControllerLifecycle ctrer = (ControllerLifecycle) ctx.getBean(asyncServiceList[0]);
// Send a trigger to initiate shutdown.
if (ctrer instanceof AnalysisEngineController) {
((AnalysisEngineController) ctrer).getControllerLatch().release();
}
ctrer.terminate();
}
if (ctx instanceof FileSystemXmlApplicationContext) {
((FileSystemXmlApplicationContext) ctx).destroy();
}