org.jboss.seam.cron.spi.asynchronous.support
Class FutureInvokerSupport

java.lang.Object
  extended by org.jboss.seam.cron.spi.asynchronous.support.FutureInvokerSupport
All Implemented Interfaces:
Callable

public class FutureInvokerSupport
extends Object
implements Callable

Creates a #Callable whose #call method will block until the #executeInvocationContext() method is called. This comes in handy when returning Futures (eg: #new FutureTask( new FutureInvokerSupport(invoker))).

In the simplest case #executeInvocationContext() could be called in the same thread prior to calling #call(). This is useful when your method of executing in the background is also #Runnable or #Callable and can thus be used to return a #RunnableFuture.

In more complex cases #executeInvocationContext() could be called by a separate thread at any time before or after the current thread calls #call(). This is useful when your method of executing in the background is fairly arbitrary (eg a Quartz Job scheduled for the near future), and you need to be able to return a #new FutureTask(callable) immediately but trigger the processing on that callable some arbitrary way (ie: inside the Quartz Job implementation).

See the Seam Cron Asynchronous Provider projects for the Threads and Quartz providers to see this in action (providers/scheduling/quartz and providers/asynchronous/threads).

Author:
peteroyle

Constructor Summary
FutureInvokerSupport(Invoker executor)
           
 
Method Summary
 Object call()
           
 void executeInvocationContext()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

FutureInvokerSupport

public FutureInvokerSupport(Invoker executor)
Method Detail

executeInvocationContext

public void executeInvocationContext()
                              throws Exception
Throws:
Exception

call

public Object call()
            throws Exception
Specified by:
call in interface Callable
Throws:
Exception


Copyright © 2011 Seam Framework. All Rights Reserved.