play
Class Invoker

java.lang.Object
  extended by play.Invoker

public class Invoker
extends java.lang.Object

Run some code in a Play! context


Nested Class Summary
static class Invoker.DirectInvocation
          A direct invocation (in the same thread than caller)
static class Invoker.Invocation
          An Invocation in something to run in a Play! context
static class Invoker.Suspend
          Throwable to indicate that the request must be suspended
 
Field Summary
static java.util.concurrent.ScheduledThreadPoolExecutor executor
          Main executor for requests invocations.
 
Constructor Summary
Invoker()
           
 
Method Summary
static java.util.concurrent.Future<?> invoke(Invoker.Invocation invocation)
          Run the code in a new thread took from a thread pool.
static java.util.concurrent.Future<?> invoke(Invoker.Invocation invocation, long millis)
          Run the code in a new thread after a delay
static void invokeInThread(Invoker.DirectInvocation invocation)
          Run the code in the same thread than caller.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

executor

public static java.util.concurrent.ScheduledThreadPoolExecutor executor
Main executor for requests invocations.

Constructor Detail

Invoker

public Invoker()
Method Detail

invoke

public static java.util.concurrent.Future<?> invoke(Invoker.Invocation invocation)
Run the code in a new thread took from a thread pool.

Parameters:
invocation - The code to run
Returns:
The future object, to know when the task is completed

invoke

public static java.util.concurrent.Future<?> invoke(Invoker.Invocation invocation,
                                                    long millis)
Run the code in a new thread after a delay

Parameters:
invocation - The code to run
millis - The time to wait before, in milliseconds
Returns:
The future object, to know when the task is completed

invokeInThread

public static void invokeInThread(Invoker.DirectInvocation invocation)
Run the code in the same thread than caller.

Parameters:
invocation - The code to run


Guillaume Bort & zenexity - Distributed under Apache 2 licence, without any warrantly