|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object lumis.portal.structure.sync.ParallelExecutor
public class ParallelExecutor
Receives submissions of tasks to be executed in parallel.
There are two queue of tasks. One queue for database tasks and other queue
for non-database tasks. Tasks of type ParallelExecutor.IDatabaseTask
that are submitted
enter the database tasks queue, the others enter the non-database tasks queue.
Each queue is processed in FIFO order, but independently of each other.
Nested Class Summary | |
---|---|
static interface |
ParallelExecutor.IDatabaseTask
A task that executes some operation in the database. |
static interface |
ParallelExecutor.ITransactionFactory
Provides ITransaction instances. |
Constructor Summary | |
---|---|
ParallelExecutor(int numGeneralThreads,
int numDbThreads,
ParallelExecutor.ITransactionFactory transactionFactory)
Constructs a parallel executor with independent transaction for each database task. |
|
ParallelExecutor(int numGeneralThreads,
String processId,
ITransaction singleTransaction)
Constructs a parallel executor with a single transaction for all database tasks. |
Method Summary | |
---|---|
void |
awaitExecutions()
Pauses until all pending tasks complete execution. |
void |
awaitExecutions(boolean flushAndClearSession)
Pauses until all pending tasks complete execution. |
void |
shutdown()
Initiates an orderly shutdown in which previously submitted tasks are executed, but no new tasks will be accepted. |
void |
submit(ParallelExecutor.IDatabaseTask task)
Submits a database task for future execution. |
void |
submit(Runnable task)
Submits a general task for future execution. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public ParallelExecutor(int numGeneralThreads, int numDbThreads, ParallelExecutor.ITransactionFactory transactionFactory)
numGeneralThreads
- the number of threads for executing general tasks.numDbThreads
- the number of threads for executing database tasks.transactionFactory
- the transaction factory used to obtain
transaction for each database task.public ParallelExecutor(int numGeneralThreads, String processId, ITransaction singleTransaction)
numGeneralThreads
- the number of threads for executing general tasks.singleTransaction
- the transaction to be used for the database tasks.processId
- the process identification of the operation.Method Detail |
---|
public void shutdown()
public void awaitExecutions()
public void awaitExecutions(boolean flushAndClearSession)
public void submit(Runnable task)
task
- the task.public void submit(ParallelExecutor.IDatabaseTask task)
task
- the database task.
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |