Class SyncExecutor

java.lang.Object
bitronix.tm.twopc.executor.SyncExecutor
All Implemented Interfaces:
Executor, Service

public class SyncExecutor extends Object implements Executor
This implementation executes submitted jobs synchronously.
Author:
lorban
  • Constructor Details

    • SyncExecutor

      public SyncExecutor()
  • Method Details

    • submit

      public Object submit(Job job)
      Description copied from interface: Executor
      Submit a job to be executed by the thread pool.
      Specified by:
      submit in interface Executor
      Parameters:
      job - the Runnable to execute.
      Returns:
      an object used to monitor the execution of the submitted Runnable.
    • waitFor

      public void waitFor(Object future, long timeout)
      Description copied from interface: Executor
      Wait for the job represented by the future to terminate. The call to this method will block until the job finished its execution or the specified timeout elapsed.
      Specified by:
      waitFor in interface Executor
      Parameters:
      future - the future representing the job as returned by Executor.submit(bitronix.tm.twopc.executor.Job).
      timeout - if the job did not finish during the specified timeout in milliseconds, this method returns anyway.
    • isDone

      public boolean isDone(Object future)
      Description copied from interface: Executor
      Check if the thread pool has terminated the execution of the job represented by a future.
      Specified by:
      isDone in interface Executor
      Parameters:
      future - the future representing the job as returned by Executor.submit(bitronix.tm.twopc.executor.Job).
      Returns:
      true if the job is done, false otherwise.
    • shutdown

      public void shutdown()
      Description copied from interface: Executor
      Shutdown the thead pool.
      Specified by:
      shutdown in interface Executor
      Specified by:
      shutdown in interface Service