bitronix.tm.twopc.executor
Class SyncExecutor

java.lang.Object
  extended by 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 Summary
SyncExecutor()
           
 
Method Summary
 boolean isDone(Object future)
          Check if the thread pool has terminated the execution of the job represented by a future.
 void shutdown()
          Shutdown the thead pool.
 Object submit(Job job)
          Submit a job to be executed by the thread pool.
 void waitFor(Object future, long timeout)
          Wait for the job represented by the future to terminate.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

SyncExecutor

public SyncExecutor()
Method Detail

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


Copyright © 2006-2013 Bitronix Software. All Rights Reserved.