CompletableFuture < Void > update ( PartitionMetadata metadata , PartitionManagementService managementService ) { if ( server == null && metadata . members ( ) . contains ( managementService . getMembershipService ( ) . getLocalMember ( ) . id ( ) ) ) { server = createServer ( managementService ) ; return server . join ( metadata . members ( ) ) ; } else if ( server != null && ! metadata . members ( ) . contains ( managementService . getMembershipService ( ) . getLocalMember ( ) . id ( ) ) ) { return server . leave ( ) . thenRun ( ( ) -> server = null ) ; } return CompletableFuture . completedFuture ( null ) ; }
Updates the partition with the given metadata .