Class RequestCancellationState

java.lang.Object
org.forgerock.opendj.server.core.RequestCancellationState

public final class RequestCancellationState extends Object
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) - throws CancelledResultException if a cancellation request has been received and processing of the request should be aborted if possible
  • Constructor Details

    • RequestCancellationState

      public RequestCancellationState(boolean hasResponse)
      Creates a new request state.
      Parameters:
      hasResponse - true if response messages should be sent to the client.
  • Method Details

    • cancel

      public CompletableFuture<Result> cancel(boolean notifyClient, LocalizableMessage reason)
      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()
      Returns true if the result should be forwarded to the client. Results are dropped for ABANDON and UNBIND requests.
      Returns:
      true if 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.