org.infinispan.distexec
Class DefaultExecutorService.DistributedRunnableFuture<V>

java.lang.Object
  extended by org.infinispan.distexec.DefaultExecutorService.DistributedRunnableFuture<V>
All Implemented Interfaces:
Runnable, Future<V>, RunnableFuture<V>, NotifyingFuture<V>, NotifyingNotifiableFuture<V>
Enclosing class:
DefaultExecutorService

protected static class DefaultExecutorService.DistributedRunnableFuture<V>
extends Object
implements RunnableFuture<V>, NotifyingNotifiableFuture<V>

DistributedRunnableFuture is essentially a Future wrap around DistributedExecuteCommand.

Author:
Mircea Markus, Vladimir Blagojevic

Constructor Summary
DefaultExecutorService.DistributedRunnableFuture(DistributedExecuteCommand<V> command)
          Creates a DistributedRunnableFuture that will upon running, execute the given Runnable, and arrange that get will return the given result on successful completion.
 
Method Summary
 NotifyingFuture<V> attachListener(FutureListener<V> listener)
          Attaches a listener and returns the same future instance, to allow for 'building'.
 boolean cancel(boolean mayInterruptIfRunning)
           
 boolean equals(Object o)
           
 V get()
           
 V get(long timeout, TimeUnit unit)
           
 DistributedExecuteCommand<V> getCommand()
           
 int hashCode()
           
 boolean isCancelled()
           
 boolean isDone()
           
 void notifyDone()
           
 void run()
           
 void setNetworkFuture(Future<V> future)
           
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DefaultExecutorService.DistributedRunnableFuture

public DefaultExecutorService.DistributedRunnableFuture(DistributedExecuteCommand<V> command)
Creates a DistributedRunnableFuture that will upon running, execute the given Runnable, and arrange that get will return the given result on successful completion.

Parameters:
runnable - the runnable task
result - the result to return on successful completion.
Method Detail

getCommand

public DistributedExecuteCommand<V> getCommand()

isCancelled

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

isDone

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

cancel

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

run

public void run()
Specified by:
run in interface Runnable
Specified by:
run in interface RunnableFuture<V>

notifyDone

public void notifyDone()
Specified by:
notifyDone in interface NotifyingNotifiableFuture<V>

attachListener

public NotifyingFuture<V> attachListener(FutureListener<V> listener)
Description copied from interface: NotifyingFuture
Attaches a listener and returns the same future instance, to allow for 'building'.

Specified by:
attachListener in interface NotifyingFuture<V>
Parameters:
listener - listener to attach
Returns:
the same future instance

setNetworkFuture

public void setNetworkFuture(Future<V> future)
Specified by:
setNetworkFuture in interface NotifyingNotifiableFuture<V>

equals

public boolean equals(Object o)
Overrides:
equals in class Object

hashCode

public int hashCode()
Overrides:
hashCode in class Object

-->

Copyright © 2012 JBoss, a division of Red Hat. All Rights Reserved.