Package play
Class Invoker
- java.lang.Object
-
- play.Invoker
-
public class Invoker extends java.lang.Object
Run some code in a Play! context
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description 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! contextstatic class
Invoker.InvocationContext
The class/method that will be invoked by the current operationstatic class
Invoker.Suspend
Throwable to indicate that the request must be suspended
-
Field Summary
Fields Modifier and Type Field Description static java.util.concurrent.ScheduledThreadPoolExecutor
executor
Main executor for requests invocations.
-
Constructor Summary
Constructors Constructor Description Invoker()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description 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 delaystatic void
invokeInThread(Invoker.DirectInvocation invocation)
Run the code in the same thread than caller.
-
-
-
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 runmillis
- 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
-
-