Class MultipleResponseFuture<R extends Response>
- java.lang.Object
-
- org.apache.directory.ldap.client.api.future.MultipleResponseFuture<R>
-
- Type Parameters:
R- The result type returned by this Future's get method
- All Implemented Interfaces:
Future<R>,ResponseFuture<R>
- Direct Known Subclasses:
BindFuture,ExtendedFuture,SearchFuture
public abstract class MultipleResponseFuture<R extends Response> extends Object implements ResponseFuture<R>
A Future implementation used in LdapConnection operations.- Author:
- Apache Directory Project
-
-
Field Summary
Fields Modifier and Type Field Description protected booleancancelledflag to determine if this future is cancelledprotected ThrowablecauseIf the request has been cancelled because of an exception it will be stored hereprotected LdapConnectionconnectionThe connection used by the requestprotected intmessageIdThe messageID for this futureprotected BlockingQueue<R>queuethe blocking queue holding LDAP responses
-
Constructor Summary
Constructors Constructor Description MultipleResponseFuture(LdapConnection connection, int messageId)Creates a new instance of ResponseFuture.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidcancel()Cancel the Futurebooleancancel(boolean mayInterruptIfRunning)Rget()Rget(long timeout, TimeUnit unit)ThrowablegetCause()booleanisCancelled()booleanisDone()This operation is not supported in this implementation of Future.voidset(R response)Set the associated Response in this FuturevoidsetCause(Throwable cause)Associate a cause to the ResponseFutureStringtoString()
-
-
-
Field Detail
-
queue
protected BlockingQueue<R extends Response> queue
the blocking queue holding LDAP responses
-
cancelled
protected boolean cancelled
flag to determine if this future is cancelled
-
cause
protected Throwable cause
If the request has been cancelled because of an exception it will be stored here
-
messageId
protected int messageId
The messageID for this future
-
connection
protected LdapConnection connection
The connection used by the request
-
-
Constructor Detail
-
MultipleResponseFuture
public MultipleResponseFuture(LdapConnection connection, int messageId)
Creates a new instance of ResponseFuture.- Parameters:
connection- The LdapConnection used by the requestmessageId- The associated message ID
-
-
Method Detail
-
cancel
public boolean cancel(boolean mayInterruptIfRunning)
-
get
public R get() throws InterruptedException
- Specified by:
getin interfaceFuture<R extends Response>- Throws:
InterruptedException- if the operation has been cancelled by client
-
set
public void set(R response) throws InterruptedException
Set the associated Response in this Future- Specified by:
setin interfaceResponseFuture<R extends Response>- Parameters:
response- The response to add into the Future- Throws:
InterruptedException- if the operation has been cancelled by client
-
get
public R get(long timeout, TimeUnit unit) throws InterruptedException
- Specified by:
getin interfaceFuture<R extends Response>- Throws:
InterruptedException- if the operation has been cancelled by client
-
isCancelled
public boolean isCancelled()
- Specified by:
isCancelledin interfaceFuture<R extends Response>
-
isDone
public boolean isDone()
This operation is not supported in this implementation of Future.
-
getCause
public Throwable getCause()
- Specified by:
getCausein interfaceResponseFuture<R extends Response>- Returns:
- the cause
-
setCause
public void setCause(Throwable cause)
Associate a cause to the ResponseFuture- Specified by:
setCausein interfaceResponseFuture<R extends Response>- Parameters:
cause- the cause to set
-
cancel
public void cancel()
Cancel the Future- Specified by:
cancelin interfaceResponseFuture<R extends Response>
-
-