org.crsh.util
Class LatchedFuture<V>

java.lang.Object
  extended by org.crsh.util.LatchedFuture<V>
All Implemented Interfaces:
Future<V>

public class LatchedFuture<V>
extends Object
implements Future<V>


Field Summary
private  CountDownLatch latch
          .
private  FutureListener<V> listener
          The optional listener.
private  Lock lock
          .
private  V value
          .
 
Constructor Summary
LatchedFuture()
           
LatchedFuture(V value)
           
 
Method Summary
 void addListener(FutureListener<V> listener)
           
 boolean cancel(boolean b)
           
 V get()
           
 V get(long l, TimeUnit timeUnit)
           
 boolean isCancelled()
           
 boolean isDone()
           
 void set(V value)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

value

private V value
.


latch

private final CountDownLatch latch
.


lock

private final Lock lock
.


listener

private FutureListener<V> listener
The optional listener.

Constructor Detail

LatchedFuture

public LatchedFuture()

LatchedFuture

public LatchedFuture(V value)
Method Detail

cancel

public boolean cancel(boolean b)
Specified by:
cancel in interface Future<V>

isCancelled

public boolean isCancelled()
Specified by:
isCancelled in interface Future<V>

isDone

public boolean isDone()
Specified by:
isDone in interface Future<V>

get

public V get()
      throws InterruptedException,
             ExecutionException
Specified by:
get in interface Future<V>
Throws:
InterruptedException
ExecutionException

get

public V get(long l,
             TimeUnit timeUnit)
      throws InterruptedException,
             ExecutionException,
             TimeoutException
Specified by:
get in interface Future<V>
Throws:
InterruptedException
ExecutionException
TimeoutException

addListener

public void addListener(FutureListener<V> listener)

set

public void set(V value)


Copyright © 2014 eXo Platform SAS. All Rights Reserved.