public CompletableFuture<CloseResponse> close(CloseRequest request) {
    ComposableFuture<CloseResponse> future = new ComposableFuture<>();
    threadContext.execute(() -> {
      PrimaryBackupSession session = sessions.get(request.session());
      if (session != null) {
        role.close(session).whenComplete((result, error) -> {
          if (error == null) {
            future.complete(CloseResponse.ok());
          } else {
            future.complete(CloseResponse.error());
          }
        });
      } else {
        future.complete(CloseResponse.error());
      }
    });
    return future;
  }
public CompletableFuture < CloseResponse > close ( CloseRequest request ) { ComposableFuture < CloseResponse > future = new ComposableFuture < > ( ) ; threadContext . execute ( ( ) -> { PrimaryBackupSession session = sessions . get ( request . session ( ) ) ; if ( session != null ) { role . close ( session ) . whenComplete ( ( result , error ) -> { if ( error == null ) { future . complete ( CloseResponse . ok ( ) ) ; } else { future . complete ( CloseResponse . error ( ) ) ; } } ) ; } else { future . complete ( CloseResponse . error ( ) ) ; } } ) ; return future ; }
Handles a close request.

@param request the close request
@return future to be completed with a close response