private CompletableFuture < Void > listen ( ) { CompletableFuture < Void > future = new CompletableFuture <> ( ) ; context . getThreadContext ( ) . executor ( ) . execute ( ( ) -> { internalServer . listen ( cluster ( ) . member ( ) . serverAddress ( ) , context :: connectServer ) . whenComplete ( ( internalResult , internalError ) -> { if ( internalError == null ) { // If the client address is different than the server address, start a separate client server. if ( clientServer != null ) { clientServer . listen ( cluster ( ) . member ( ) . clientAddress ( ) , context :: connectClient ) . whenComplete ( ( clientResult , clientError ) -> { started = true ; future . complete ( null ) ; } ) ; } else { started = true ; future . complete ( null ) ; } } else { future . completeExceptionally ( internalError ) ; } } ) ; } ) ; return future ; }
Starts listening the server .