Package org.forgerock.opendj.server.core
Class RequestCancellationState
java.lang.Object
org.forgerock.opendj.server.core.RequestCancellationState
Maintains the cancellation state of an active request, acting as a mediator between frontend,
ClientConnection request tracking and backend processing of the
request. Backend APIs are exposed via the associated RequestContext.
ClientConnection API
cancel(boolean, LocalizableMessage)- notifies backend processing that the request should be aborted if possible, and whether or not responses should be sent.complete()- notifies any waiting disconnect, abandon or cancel requests of their completion.shouldSendResult()- indicates whether remaining responses should be forwarded to the client. Backend processing will always emit responses in order to ensure that responses are fully tracked for auditing purposes. It is the responsibility of the client connection to drop responses if needed.
RequestContext API
addCancelRequestHandler(Consumer)- registers the provided cancellation listener that will be notified if a cancellation request is received.cannotCancel(LocalizableMessage)- indicates that the request cannot be cancelled.checkIfCancelled(boolean)- throwsCancelledResultExceptionif a cancellation request has been received and processing of the request should be aborted if possible
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptioncancel(boolean notifyClient, LocalizableMessage reason) Notifies backend processing that the request should be aborted if possible, and whether or not responses should be sent.voidIndicates that the request was successfully cancelled.voidcomplete()Notifies any waiting disconnect, abandon or cancel requests that the request has completed.booleanReturnstrueif the result should be forwarded to the client.
-
Constructor Details
-
RequestCancellationState
public RequestCancellationState(boolean hasResponse) Creates a new request state.- Parameters:
hasResponse-trueif response messages should be sent to the client.
-
-
Method Details
-
cancel
Notifies backend processing that the request should be aborted if possible, and whether or not responses should be sent.- Parameters:
notifyClient- Indicates whether the client should receive a response if the operation is canceled.reason- A message explaining the reason for the cancellation.- Returns:
- The result of the cancellation.
-
shouldSendResult
public boolean shouldSendResult()Returnstrueif the result should be forwarded to the client. Results are dropped for ABANDON and UNBIND requests.- Returns:
trueif the result should be forwarded to the client.
-
cancelled
public void cancelled()Indicates that the request was successfully cancelled. -
complete
public void complete()Notifies any waiting disconnect, abandon or cancel requests that the request has completed.
-