public class ParallelExecutor extends Object
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.
Modifier and Type | Class and Description |
---|---|
static interface |
ParallelExecutor.IDatabaseTask
A task that executes some operation in the database.
|
static interface |
ParallelExecutor.ITransactionFactory
Provides
ITransaction instances. |
Constructor and Description |
---|
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.
|
Modifier and Type | Method and Description |
---|---|
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.
|
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.public void shutdown()
public void awaitExecutions() throws PortalException
PortalException
public void awaitExecutions(boolean flushAndClearSession) throws PortalException
PortalException
public void submit(Runnable task)
task
- the task.public void submit(ParallelExecutor.IDatabaseTask task)
task
- the database task.LumisXP 12.5.0.200928 - Copyright © 2006–2020 Lumis EIP Tecnologia da Informação LTDA. All Rights Reserved.