Package tkrzw

Class Future<T>

Object
Future<T>

public class Future<T> extends Object
Future containing a status object and extra data.
Note:
Future objects are made by methods of AsyncDBM. Every future object should be destroyed by the "destruct" method or the "get" method to free resources.
  • Method Summary

    Modifier and Type
    Method
    Description
    boolean
    await(double timeout)
    Awaits the operation to be done.
    void
    Destructs the object and releases resources.
    get()
    Awaits the operation to be done and gets the result status.
    Gets a string representation of the database.

    Methods inherited from class Object

    clone, equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
  • Method Details

    • destruct

      public void destruct()
      Destructs the object and releases resources.
    • await

      public boolean await(double timeout)
      Awaits the operation to be done.
      Parameters:
      timeout - The waiting time in seconds. If it is negative, no timeout is set.
      Returns:
      True if the operation has done. False if timeout occurs.
    • get

      public T get()
      Awaits the operation to be done and gets the result status.
      Returns:
      The result status and extra data if any. The existence and the type of extra data depends on the operation which makes the future. For DBM#Get, a tuple of the status and the retrieved value is returned. For DBM#Set and DBM#Remove, the status object itself is returned.
      Note:
      The internal resource is released by this method. "aait" and "get" cannot be called after calling this method.
    • toString

      public String toString()
      Gets a string representation of the database.
      Overrides:
      toString in class Object