use of io.atomix.protocols.backup.protocol.CloseResponse in project atomix by atomix.
the class PrimaryBackupServiceContext method close.
/**
* Handles a close request.
*
* @param request the close request
* @return future to be completed with a close response
*/
public CompletableFuture<CloseResponse> close(CloseRequest request) {
ComposableFuture<CloseResponse> future = new ComposableFuture<>();
threadContext.execute(() -> {
PrimaryBackupSession session = sessions.getSession(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;
}
Aggregations