org.apache.directory.ldap.client.api.future
Class ResponseFuture<R>

java.lang.Object
  extended by org.apache.directory.ldap.client.api.future.ResponseFuture<R>
All Implemented Interfaces:
java.util.concurrent.Future<R>
Direct Known Subclasses:
AddFuture, BindFuture, CompareFuture, DeleteFuture, ExtendedFuture, ModifyDnFuture, ModifyFuture, SearchFuture

public class ResponseFuture<R>
extends java.lang.Object
implements java.util.concurrent.Future<R>

A Future implementation used in LdapConnection operations.

Version:
$Rev$, $Date$
Author:
Apache Directory Project

Field Summary
protected  boolean cancelled
          flag to determine if this future is cancelled
protected  LdapConnection connection
          The connection used by the request
protected  int messageId
          The messageID for this future
protected  java.util.concurrent.BlockingQueue<R> queue
          the blocking queue holding LDAP responses
 
Constructor Summary
ResponseFuture(LdapConnection connection, int messageId)
          Creates a new instance of ResponseFuture.
 
Method Summary
 boolean cancel(boolean mayInterruptIfRunning)
          
 R get()
          
 R get(long timeout, java.util.concurrent.TimeUnit unit)
          
 boolean isCancelled()
          
 boolean isDone()
          This operation is not supported in this implementation of Future
 void set(R response)
          
 java.lang.String toString()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

queue

protected java.util.concurrent.BlockingQueue<R> queue
the blocking queue holding LDAP responses


cancelled

protected boolean cancelled
flag to determine if this future is cancelled


messageId

protected int messageId
The messageID for this future


connection

protected LdapConnection connection
The connection used by the request

Constructor Detail

ResponseFuture

public ResponseFuture(LdapConnection connection,
                      int messageId)
Creates a new instance of ResponseFuture.

Parameters:
connection - The LdapConnection used by the request
messageId - The associated message ID
Method Detail

cancel

public boolean cancel(boolean mayInterruptIfRunning)

Specified by:
cancel in interface java.util.concurrent.Future<R>

get

public R get()
      throws java.lang.InterruptedException,
             java.util.concurrent.ExecutionException

Specified by:
get in interface java.util.concurrent.Future<R>
Throws:
java.lang.InterruptedException - if the operation has been cancelled by client
java.util.concurrent.ExecutionException

set

public void set(R response)
         throws java.lang.InterruptedException,
                java.util.concurrent.ExecutionException

Throws:
java.lang.InterruptedException - if the operation has been cancelled by client
java.util.concurrent.ExecutionException

get

public R get(long timeout,
             java.util.concurrent.TimeUnit unit)
      throws java.lang.InterruptedException,
             java.util.concurrent.ExecutionException,
             java.util.concurrent.TimeoutException

Specified by:
get in interface java.util.concurrent.Future<R>
Throws:
java.lang.InterruptedException - if the operation has been cancelled by client
java.util.concurrent.ExecutionException
java.util.concurrent.TimeoutException

isCancelled

public boolean isCancelled()

Specified by:
isCancelled in interface java.util.concurrent.Future<R>

isDone

public boolean isDone()
This operation is not supported in this implementation of Future

Specified by:
isDone in interface java.util.concurrent.Future<R>

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object


Copyright © 2009-2011 Apache Software Foundation. All Rights Reserved.