public CompletableFuture < Void > shutdown ( ) { if ( ! started ) { return Futures . exceptionalFuture ( new IllegalStateException ( "Server not running" ) ) ; } CompletableFuture < Void > future = new AtomixFuture <> ( ) ; context . getThreadContext ( ) . execute ( ( ) -> { started = false ; context . transition ( Role . INACTIVE ) ; future . complete ( null ) ; } ) ; return future . whenCompleteAsync ( ( result , error ) -> { context . close ( ) ; started = false ; } ) ; }
Shuts down the server without leaving the Raft cluster .