Runtime.getRuntime().addShutdownHook(new Thread() {
public void run() {
try {
worker.shutdownAndAwaitTermination(1, TimeUnit.MINUTES);
System.out.println("Workflow Host Service Terminated...");
}
catch (InterruptedException e) {
e.printStackTrace();
}