org.infinispan.util.concurrent
Class AggregatingNotifyingFutureBuilder

java.lang.Object
  extended by org.infinispan.util.concurrent.NotifyingFutureImpl
      extended by org.infinispan.util.concurrent.AggregatingNotifyingFutureBuilder
All Implemented Interfaces:
Future<Object>, NotifyingFuture<Object>, NotifyingNotifiableFuture<Object>

public class AggregatingNotifyingFutureBuilder
extends NotifyingFutureImpl

An aggregating NotifyingNotifiableFuture implementation that allows a dynamic number of futures to be attached.
Since we don't know when the user is done adding futures, this implementation doesn't notify its FutureListeners when it's done. Instead the user can use the build() method to create another future that will call its listeners.
If you don't need the notifying feature you can skip calling build() and use only this future.

Since:
5.1
Author:
Dan Berindei <dan@infinispan.org>

Constructor Summary
AggregatingNotifyingFutureBuilder(Object actualReturnValue, int capacity)
           
 
Method Summary
 NotifyingNotifiableFuture<?> build()
           
 boolean cancel(boolean mayInterruptIfRunning)
           
 Object get()
           
 Object get(long timeout, TimeUnit unit)
           
 boolean isCancelled()
           
 boolean isDone()
           
 void notifyDone()
           
 void setNetworkFuture(Future<Object> future)
           
 
Methods inherited from class org.infinispan.util.concurrent.NotifyingFutureImpl
attachListener
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

AggregatingNotifyingFutureBuilder

public AggregatingNotifyingFutureBuilder(Object actualReturnValue,
                                         int capacity)
Method Detail

build

public NotifyingNotifiableFuture<?> build()

setNetworkFuture

public void setNetworkFuture(Future<Object> future)
Specified by:
setNetworkFuture in interface NotifyingNotifiableFuture<Object>
Overrides:
setNetworkFuture in class NotifyingFutureImpl

cancel

public boolean cancel(boolean mayInterruptIfRunning)
Specified by:
cancel in interface Future<Object>
Overrides:
cancel in class NotifyingFutureImpl

isCancelled

public boolean isCancelled()
Specified by:
isCancelled in interface Future<Object>
Overrides:
isCancelled in class NotifyingFutureImpl

isDone

public boolean isDone()
Specified by:
isDone in interface Future<Object>
Overrides:
isDone in class NotifyingFutureImpl

get

public Object get()
           throws InterruptedException,
                  ExecutionException
Specified by:
get in interface Future<Object>
Overrides:
get in class NotifyingFutureImpl
Throws:
InterruptedException
ExecutionException

get

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

notifyDone

public void notifyDone()
Specified by:
notifyDone in interface NotifyingNotifiableFuture<Object>
Overrides:
notifyDone in class NotifyingFutureImpl

-->

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