public void doMain ( final String [ ] args ) throws Exception { final CountDownLatch shutdownLatch = new CountDownLatch ( 1 ) ; Runtime . getRuntime ( ) . addShutdownHook ( new Thread ( ) { @ Override public void run ( ) { try { try { TransactionServiceMain . this . stop ( ) ; } finally { try { TransactionServiceMain . this . destroy ( ) ; } finally { shutdownLatch . countDown ( ) ; } } } catch ( Throwable t ) { LOG . error ( "Exception when shutting down: " + t . getMessage ( ) , t ) ; } } } ) ; init ( args ) ; start ( ) ; shutdownLatch . await ( ) ; }
The main method . It simply call methods in the same sequence as if the program is started by jsvc .