Package org.ldaptive
Interface OperationHandle<Q extends Request,S extends Result>
- Type Parameters:
Q
- type of requestS
- type of result
- All Known Subinterfaces:
CompareOperationHandle
,ExtendedOperationHandle
,SearchOperationHandle
- All Known Implementing Classes:
DefaultCompareOperationHandle
,DefaultExtendedOperationHandle
,DefaultOperationHandle
,DefaultSearchOperationHandle
,NettyConnection.BindOperationHandle
Handle that notifies on the components of an LDAP operation request.
-
Method Summary
Modifier and TypeMethodDescriptionvoid
abandon()
Abandons this operation.await()
Waits for a result or reports a timeout exception.cancel()
Cancels this operation.default S
execute()
Returns the time this operation received a result or encountered an exception.Returns the time this operation sent a request.onComplete
(CompleteHandler function) Sets the function to execute when the operation completes.onControl
(ResponseControlHandler... function) Sets the functions to execute when a control is received.onException
(ExceptionHandler function) Sets the function to execute when an exception occurs.onIntermediate
(IntermediateResponseHandler... function) Sets the functions to execute when an intermediate response is received.onReferral
(ReferralHandler... function) Sets the functions to execute when a referral is received.onResult
(ResultHandler... function) Sets the functions to execute when a result is received.onUnsolicitedNotification
(UnsolicitedNotificationHandler... function) Sets the functions to execute when an unsolicited notification is received.send()
Sends this request to the server.throwIf
(ResultPredicate function) Sets the function to determine whether an exception should be raised by a particular result.
-
Method Details
-
send
OperationHandle<Q,S> send()Sends this request to the server.- Returns:
- this handle
- Throws:
IllegalStateException
- if this request has already been sent
-
await
Waits for a result or reports a timeout exception.- Returns:
- result of the operation or empty if the operation is abandoned
- Throws:
LdapException
- if an error occurs executing the request
-
execute
Convenience method that invokessend()
followed byawait()
. Provides a single method to make a synchronous request.- Returns:
- result of the operation or empty if the operation is abandoned
- Throws:
LdapException
- if an error occurs executing the request
-
onResult
Sets the functions to execute when a result is received.- Parameters:
function
- to execute on a result- Returns:
- this handle
-
onControl
Sets the functions to execute when a control is received.- Parameters:
function
- to execute on a control- Returns:
- this handle
-
onReferral
Sets the functions to execute when a referral is received.- Parameters:
function
- to execute on a referral- Returns:
- this handle
-
onIntermediate
Sets the functions to execute when an intermediate response is received.- Parameters:
function
- to execute on an intermediate response- Returns:
- this handle
-
onUnsolicitedNotification
Sets the functions to execute when an unsolicited notification is received.- Parameters:
function
- to execute on an unsolicited notification- Returns:
- this handle
-
onException
Sets the function to execute when an exception occurs.- Parameters:
function
- to execute when an exception occurs- Returns:
- this handle
-
onComplete
Sets the function to execute when the operation completes.- Parameters:
function
- to execute on completion- Returns:
- this handle
-
throwIf
Sets the function to determine whether an exception should be raised by a particular result.- Parameters:
function
- to determine whether to throw an exception- Returns:
- this handle
-
abandon
void abandon()Abandons this operation.- Throws:
IllegalStateException
- if the request has not been sent to the server
-
cancel
ExtendedOperationHandle cancel()Cancels this operation. SeeCancelRequest
.- Returns:
- extended operation handle
- Throws:
IllegalStateException
- if the request has not been sent to the server
-
getSentTime
Instant getSentTime()Returns the time this operation sent a request.- Returns:
- sent time
-
getReceivedTime
Instant getReceivedTime()Returns the time this operation received a result or encountered an exception.- Returns:
- received time
-