protected boolean stopEchoService ( ) { return Optional . ofNullable ( getEchoService ( ) ) . map ( localEchoService -> { localEchoService . shutdown ( ) ; try { if ( ! localEchoService . awaitTermination ( 30 , TimeUnit . SECONDS ) ) { localEchoService . shutdownNow ( ) ; if ( ! localEchoService . awaitTermination ( 30 , TimeUnit . SECONDS ) ) { getLogger ( ) . warning ( "Failed to shutdown EchoService" ) ; } } } catch ( InterruptedException ignore ) { Thread . currentThread ( ) . interrupt ( ) ; } return localEchoService . isShutdown ( ) ; } ) . orElse ( false ) ; }
Stops the Echo Service taking it offline and out - of - service .