bitronix.tm.twopc.executor
Interface Executor

All Superinterfaces:
Service
All Known Implementing Classes:
AsyncExecutor, SyncExecutor

public interface Executor
extends Service

Thread pool interface required by the two-phase commit logic.

Author:
lorban

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.
 

Method Detail

submit

Object submit(Job job)
Submit a job to be executed by the thread pool.

Parameters:
job - the Runnable to execute.
Returns:
an object used to monitor the execution of the submitted Runnable.

waitFor

void waitFor(Object future,
             long timeout)
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.

Parameters:
future - the future representing the job as returned by submit(bitronix.tm.twopc.executor.Job).
timeout - if the job did not finish during the specified timeout in milliseconds, this method returns anyway.

isDone

boolean isDone(Object future)
Check if the thread pool has terminated the execution of the job represented by a future.

Parameters:
future - the future representing the job as returned by submit(bitronix.tm.twopc.executor.Job).
Returns:
true if the job is done, false otherwise.

shutdown

void shutdown()
Shutdown the thead pool.

Specified by:
shutdown in interface Service


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