Package play

Class 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! context
      static class  Invoker.InvocationContext
      The class/method that will be invoked by the current operation
      static 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 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