Class UniqueResponseFuture<R extends org.apache.directory.api.ldap.model.message.Response>

java.lang.Object
org.apache.directory.ldap.client.api.future.UniqueResponseFuture<R>
Type Parameters:
R - The result type returned by this Future's get method
All Implemented Interfaces:
Future<R>, ResponseFuture<R>
Direct Known Subclasses:
AddFuture, CompareFuture, DeleteFuture, ModifyDnFuture, ModifyFuture

public abstract class UniqueResponseFuture<R extends org.apache.directory.api.ldap.model.message.Response> extends Object implements ResponseFuture<R>
A Future implementation used in LdapConnection operations for operations that only get one single response.
Author:
Apache Directory Project
  • Field Details

    • 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 Details

    • UniqueResponseFuture

      public UniqueResponseFuture(LdapConnection connection, int messageId)
      Creates a new instance of UniqueResponseFuture.
      Parameters:
      connection - The LdapConnection used by the request
      messageId - The associated message ID
  • Method Details

    • get

      public R get() throws InterruptedException
      Specified by:
      get in interface Future<R extends org.apache.directory.api.ldap.model.message.Response>
      Throws:
      InterruptedException - if the operation has been cancelled by client
    • get

      public R get(long timeout, TimeUnit unit) throws InterruptedException
      Specified by:
      get in interface Future<R extends org.apache.directory.api.ldap.model.message.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:
      set in interface ResponseFuture<R extends org.apache.directory.api.ldap.model.message.Response>
      Parameters:
      response - The response to add into the Future
      Throws:
      InterruptedException - if the operation has been cancelled by client
    • cancel

      public boolean cancel(boolean mayInterruptIfRunning)
      Specified by:
      cancel in interface Future<R extends org.apache.directory.api.ldap.model.message.Response>
    • isCancelled

      public boolean isCancelled()
      Specified by:
      isCancelled in interface Future<R extends org.apache.directory.api.ldap.model.message.Response>
    • isDone

      public boolean isDone()
      This operation is not supported in this implementation of Future.
      Specified by:
      isDone in interface Future<R extends org.apache.directory.api.ldap.model.message.Response>
    • getCause

      public Throwable getCause()
      Description copied from interface: ResponseFuture
      Get the associated cause
      Specified by:
      getCause in interface ResponseFuture<R extends org.apache.directory.api.ldap.model.message.Response>
      Returns:
      the cause
    • setCause

      public void setCause(Throwable cause)
      Associate a cause to the ResponseFuture
      Specified by:
      setCause in interface ResponseFuture<R extends org.apache.directory.api.ldap.model.message.Response>
      Parameters:
      cause - the cause to set
    • cancel

      public void cancel()
      Cancel the Future
      Specified by:
      cancel in interface ResponseFuture<R extends org.apache.directory.api.ldap.model.message.Response>
    • toString

      public String toString()
      Overrides:
      toString in class Object