public class ProcessDistributorImpl extends Object implements ProcessDistributor
TODO P1:
- handle listing of items through a limited arraylist (memory) and through iterative (async) listing from
Workspace
- handle result in FATAL mode from one distributed item to stop the distribution in FATAL mode (do not
continue)
- try to handle distribution on 1 or on many as the same loop (so using a default arrayList of 1)
- handle error level using order in enum in ProcessResponse.getGlobalProcessStatusCode instead of manually comparing:
for (final EngineResponse response : responses) {
tempStatusCode = response.getStatus();
if (statusCode.ordinal() > tempStatusCode.ordinal()) {
statusCode = tempStatusCode;
}
if (statusCode.ordinal() > StatusCode.KO.ordinal()) {
break;
}
}
DISTRIBUTOR_INDEX, ELEMENT_UNITS, EXCEPTION_MESSAGE, INGEST_LEVEL_STACK, JSON_EXTENSION, NOLEVEL, OBJECTS_LIST_EMPTY, UNITS_LEVEL, WORKER_CALL_EXCEPTION
Constructor and Description |
---|
ProcessDistributorImpl(IWorkerManager workerManager)
Empty constructor
|
ProcessDistributorImpl(IWorkerManager workerManager,
ProcessDataAccess processDataAccess,
ProcessDataManagement processDataManagement,
WorkspaceClientFactory workspaceClientFactory) |
Modifier and Type | Method and Description |
---|---|
boolean |
cancel(String operationId)
Get the current step if the processWorkflow corresponding to the operationId
and update his pauseCancelAction parameter to be PauseOrCancelAction.ACTION_CANCEL
WorkerTask check this parameter and can cancel the not yet running tasks
|
void |
close() |
ItemStatus |
distribute(WorkerParameters workParams,
Step step,
String operationId,
PauseRecover pauseRecover)
Temporary method for distribution supporting multi-list
|
boolean |
pause(String operationId)
Get the current step of the processWorkflow corresponding to the operationId
and update his pauseCancelAction parameter to be PauseOrCancelAction.ACTION_PAUSE
WorkerTask check this parameter and can pause the not yet running tasks
|
public ProcessDistributorImpl(IWorkerManager workerManager)
workerManager
- public ProcessDistributorImpl(IWorkerManager workerManager, ProcessDataAccess processDataAccess, ProcessDataManagement processDataManagement, WorkspaceClientFactory workspaceClientFactory)
public boolean pause(String operationId)
ProcessDistributor
pause
in interface ProcessDistributor
operationId
- concerning operation idpublic boolean cancel(String operationId)
ProcessDistributor
cancel
in interface ProcessDistributor
operationId
- concerning operation idpublic ItemStatus distribute(WorkerParameters workParams, Step step, String operationId, PauseRecover pauseRecover)
distribute
in interface ProcessDistributor
workParams
- of type WorkerParameters
step
- the execution stepoperationId
- the operation idpauseRecover
- prevent recover from pause actionpublic void close()
close
in interface AutoCloseable
Copyright © 2018 Vitam. All rights reserved.