Package org.forgerock.opendj.ldap
Interface RequestContext
public interface RequestContext
The context associated with a request currently being processed by a request
handler. A request context can be used to query state information about the
request, such as whether it has been cancelled, as well as registering
to be notified if the request has been cancelled. Implementations may provide
additional information, such as the associated schema, time-stamp
information, etc.
-
Method Summary
Modifier and TypeMethodDescriptionvoidRegisters the provided cancellation listener with this request context so that it can be notified if a cancellation request is received and processing of the request should be aborted if possible.voidcheckIfCancelled(boolean signalTooLate) ThrowsCancelledResultExceptionif a cancellation request has been received and processing of the request should be aborted if possible.intReturns the message ID of the request, if available.voidRemoves the provided cancellation listener from this request context so that it will not be notified if a cancellation request has been received.
-
Method Details
-
addCancelRequestListener
Registers the provided cancellation listener with this request context so that it can be notified if a cancellation request is received and processing of the request should be aborted if possible.Requests may be cancelled as a result of an abandon request or a cancel extended request sent from the client, or by the server itself (e.g. during server shutdown).
This method provides a event notification mechanism which can be used by asynchronous request handler implementations to detect cancellation of requests.
- Parameters:
listener- The listener which wants to be notified if a cancellation request is received and processing of the request should be aborted if possible.- Throws:
NullPointerException- If thelistenerwasnull.- See Also:
-
checkIfCancelled
ThrowsCancelledResultExceptionif a cancellation request has been received and processing of the request should be aborted if possible.Requests may be cancelled as a result of an abandon request or a cancel extended request sent from the client, or by the server itself (e.g. during server shutdown).
This method provides a polling mechanism which can be used by synchronous request handler implementations to detect cancellation of requests.
- Parameters:
signalTooLate-trueto signal that, after this method returns, processing of the request will have proceeded too far for it to be aborted by subsequent cancellation requests.- Throws:
CancelledResultException- If a cancellation request has been received and processing of the request should be aborted if possible.- See Also:
-
getMessageID
int getMessageID()Returns the message ID of the request, if available. Protocols, such as LDAP and internal connections, include a unique message ID with each request which may be useful for logging and auditing.- Returns:
- The message ID of the request, or
-1if there is no message ID associated with the request.
-
removeCancelRequestListener
Removes the provided cancellation listener from this request context so that it will not be notified if a cancellation request has been received.- Parameters:
listener- The listener which no longer wants to be notified if a cancellation request has been received.- Throws:
NullPointerException- If thelistenerwasnull.
-