mondrian.util
Class SlotFuture<V>

java.lang.Object
  extended by mondrian.util.SlotFuture<V>
All Implemented Interfaces:
Future<V>

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

Implementation of Future that completes when a thread writes a value (or an exception) into a slot.


Constructor Summary
SlotFuture()
          Creates a SlotFuture.
 
Method Summary
 boolean cancel(boolean mayInterruptIfRunning)
           
 void fail(Throwable throwable)
          Writes a throwable into the slot, indicating that the task has failed.
 V get()
           
 V get(long timeout, TimeUnit unit)
           
 boolean isCancelled()
           
 boolean isDone()
           
 void put(V value)
          Writes a value into the slot, indicating that the task has completed successfully.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

SlotFuture

public SlotFuture()
Creates a SlotFuture.

Method Detail

cancel

public boolean cancel(boolean mayInterruptIfRunning)
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 ExecutionException,
             InterruptedException
Specified by:
get in interface Future<V>
Throws:
ExecutionException
InterruptedException

get

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

put

public void put(V value)
Writes a value into the slot, indicating that the task has completed successfully.

Parameters:
value - Value to yield as the result of the computation
Throws:
IllegalArgumentException - if put, fail or cancel has already been invoked on this future

fail

public void fail(Throwable throwable)
Writes a throwable into the slot, indicating that the task has failed.

Parameters:
throwable - Exception that aborted the computation
Throws:
IllegalArgumentException - if put, fail or cancel has already been invoked on this future

Get Mondrian at SourceForge.net. Fast, secure and free Open Source software downloads