Modifier and Type | Field and Description |
---|---|
static String |
ERROR_ON_COMPLETE |
Constructor and Description |
---|
BatchManager() |
Modifier and Type | Method and Description |
---|---|
static void |
abortBatchJob(ActivityInstance ai) |
protected String |
adaptQueryForExecutor(String q) |
void |
compensate(ActivityInstance ai) |
static void |
completeJob(BatchJob bj)
Complete a started BatchJob.
|
static void |
completeJob(BatchJob bj,
int resultCode)
Complete a started BatchJob.
|
static void |
completeJob(BatchJob bj,
int resultCode,
String resultvalues)
Complete a started BatchJob.
|
static void |
exceptionHandlingFinished(String id) |
protected static BatchAdapter |
getBatchAdapter(String adapterClassName) |
protected List<BatchJob> |
getBatchJobs(String operationName,
String query,
String orderBy,
Object... params) |
static Pair<Date,String> |
getCurrentOperation(BatchJob bj) |
static Map<Long,Pair<Date,String>> |
getCurrentOperations() |
static BatchJob |
getFreshBatchJob(BatchJob bj)
Gets a current copy (a fresh incarnation) of the batch job from the database.
|
static boolean |
hasNoCurrentOperations() |
protected boolean |
isMainManager() |
static void |
markJobError(BatchJob bj,
Exception ex)
Mark a BatchJob as erroneous.
|
static void |
markJobError(BatchJob bj,
int resultCode,
String resultValue,
Exception ex)
Mark a BatchJob as erroneous.
|
static void |
markJobFinished(BatchJob bj)
Mark a a started BatchJob as finished.
|
static void |
markJobFinished(BatchJob bj,
int resultCode)
Mark a started BatchJob as finished.
|
static void |
markJobFinished(BatchJob bj,
int resultCode,
String resultvalues)
Mark a started BatchJob as finished.
|
static void |
markJobPoll(BatchJob bj,
int resultCode,
String resultValue,
Throwable ex)
Mark a started BatchJob as pollable.
|
static void |
markJobPoll(BatchJob bj,
Throwable ex)
Mark a started BatchJob as pollable.
|
static void |
markJobRetry(BatchJob bj,
int resultCode,
String resultValue,
Throwable ex)
Mark a created BatchJob as 'startretry'.
|
static void |
markJobRetry(BatchJob bj,
Throwable ex)
Mark a created BatchJob as 'startretry'.
|
static void |
markJobSuspendPoll(BatchJob bj,
int resultCode,
String resultValue,
Throwable ex)
Mark a created BatchJob as suspended from further poll attempts.
|
static void |
markJobSuspendPoll(BatchJob bj,
Throwable ex)
Mark a created BatchJob as suspended from further poll attempts.
|
static void |
markJobSuspendRetry(BatchJob bj,
Exception ex)
Mark a created BatchJob as suspended from further start attempts.
|
static void |
markJobSuspendRetry(BatchJob bj,
int resultCode,
String resultValue,
Exception ex)
Mark a created BatchJob as suspended from further start attempts.
|
protected static void |
pollJob(BatchJob bj,
BatchAdapter adapter)
Poll if a BatchJob is finished.
|
protected static void |
pollJobHere(BatchJob bj,
BatchAdapter adapter)
Poll, if a BatchJob is finished in the current thread.
|
static void |
reactivateBatchJob(ActivityInstance ai) |
void |
run(TimerEntry te,
String args)
the TimerTask interface
|
protected static void |
startJob(BatchJob bj,
BatchAdapter adapter)
Start a BatchJob.
|
protected static void |
startJobHere(BatchJob bj,
BatchAdapter adapter)
Start a BatchJob in the current thread.
|
void |
submitJob(String adapterClassName)
Method submitJob submits a BatchJob for later execution.
|
void |
submitJob(String adapterClassName,
String param)
Method submitJob submits a BatchJob for later execution.
|
void |
submitJob(String adapterClassName,
String params,
String execModes)
Method submitJob submits a BatchJob for later execution.
|
public static final String ERROR_ON_COMPLETE
protected static BatchAdapter getBatchAdapter(String adapterClassName)
public static boolean hasNoCurrentOperations()
public void submitJob(String adapterClassName, String params, String execModes) throws Exception
adapterClassName
- name of a Class implementing BatchAdapter
params
- additional params for the execution can be passed in this StringexecModes
- attributes for behaviour variationsException
- public static BatchJob getFreshBatchJob(BatchJob bj)
Can be used to get the (possibly concurrently modified) current instance of the batch job.
If the configuration property ep.batch.avoid.getcurrentjobstate
is set to true,
the method does nothing and returns exactly the passed batchjob.
bj
- the batch job to get a fresh copy ofpublic void submitJob(String adapterClassName) throws Exception
submitJob
with null as params and default execModesException
public void submitJob(String adapterClassName, String param) throws Exception
submitJob
with default execModesException
public static void markJobRetry(BatchJob bj, Throwable ex)
ExceptionBatchAdapter
.
bj
- the BatchJob to markpublic static void markJobRetry(BatchJob bj, int resultCode, String resultValue, Throwable ex)
bj
- the BatchJob to markresultCode
- the result code to set on the batchjobresultValue
- the result value to set on the batchJobpublic static void markJobError(BatchJob bj, Exception ex)
BatchJob.STARTERROR
or BatchJob.FINISHERROR
.
ExceptionBatchAdapter
.bj
- the BatchJob to markpublic static void markJobError(BatchJob bj, int resultCode, String resultValue, Exception ex)
BatchJob.STARTERROR
or BatchJob.FINISHERROR
.
ExceptionBatchAdapter
.bj
- the BatchJob to markresultCode
- the result code to set on the batchjobresultValue
- the result value to set on the batchJobpublic static void markJobSuspendRetry(BatchJob bj, Exception ex)
ExceptionBatchAdapter
.
BatchJob.CREATED
afterwards.
The BatchManager (or the assigned executor) will not try to start the job in subsequent runs.
markJobRetry(BatchJob, Throwable)
.bj
- the BatchJob to markpublic static void markJobSuspendRetry(BatchJob bj, int resultCode, String resultValue, Exception ex)
BatchJob.CREATED
afterwards.
The BatchManager (or the assigned executor) will not try to start the job in subsequent runs.
markJobRetry(BatchJob, Throwable)
.bj
- the BatchJob to markresultCode
- the result code to set on the batchjobresultValue
- the result value to set on the batchJobpublic static void markJobSuspendPoll(BatchJob bj, Throwable ex)
ExceptionBatchAdapter
.
BatchJob.STARTED
afterwards.
The BatchManager (or the assigned executor) will not try to poll for job completion in subsequent runs.
markJobPoll(BatchJob, Throwable)
.bj
- the BatchJob to markpublic static void markJobSuspendPoll(BatchJob bj, int resultCode, String resultValue, Throwable ex)
BatchJob.STARTED
afterwards.
The BatchManager (or the assigned executor) will not try to poll for job completion in subsequent runs.
markJobPoll(BatchJob, Throwable)
.bj
- the BatchJob to markresultCode
- the result code to set on the batchjobresultValue
- the result value to set on the batchJobpublic static void markJobPoll(BatchJob bj, Throwable ex)
ExceptionBatchAdapter
.
markJobSuspendPoll(BatchJob, Throwable)
.bj
- the BatchJob to markpublic static void markJobPoll(BatchJob bj, int resultCode, String resultValue, Throwable ex)
markJobSuspendPoll(BatchJob, Throwable)
.bj
- the BatchJob to markresultCode
- the result code to set on the batchjobresultValue
- the result value to set on the batchJobpublic static void markJobFinished(BatchJob bj) throws Exception
bj
- the BatchJob to markException
- when the BatchJob is not in state BatchJob.STARTED
.public static void markJobFinished(BatchJob bj, int resultCode) throws Exception
bj
- the BatchJob to markresultCode
- an int to indicate a result condition
throws Exception when the BatchJob is not in state BatchJob.STARTED
.Exception
public static void markJobFinished(BatchJob bj, int resultCode, String resultvalues) throws Exception
bj
- the BatchJob to markresultCode
- an int to indicate a result conditionresultvalues
- a String to transport some resultsException
- when the BatchJob is not in state BatchJob.STARTED
.public static void exceptionHandlingFinished(String id)
public void run(TimerEntry te, String args)
protected boolean isMainManager()
protected List<BatchJob> getBatchJobs(String operationName, String query, String orderBy, Object... params)
protected static void startJob(BatchJob bj, BatchAdapter adapter)
bj
- the Batchjob to startadapter
- the corresponding adapterprotected static void startJobHere(BatchJob bj, BatchAdapter adapter)
bj
- the Batchjob to startadapter
- the corresponding adapterprotected static void pollJob(BatchJob bj, BatchAdapter adapter)
bj
- the Batchjob to startadapter
- the corresponding adapterprotected static void pollJobHere(BatchJob bj, BatchAdapter adapter)
bj
- the Batchjob to startadapter
- the corresponding adapterpublic static void completeJob(BatchJob bj) throws Exception
BeanManager.commit()
or BeanManager.rollback()
.
BatchAdapter.beforeCompletion(BatchJob)
and BatchAdapter.afterCompletion(BatchJob, boolean)
will be called.
After completeJob, BatchJob.getJobstate()
can be used to inquire about the outcome of the operation.bj
- the BatchJob to complete.Exception
- when the BatchJob is not in state BatchJob.STARTED
.public static void completeJob(BatchJob bj, int resultCode) throws Exception
BeanManager.commit()
or BeanManager.rollback()
.
BatchAdapter.beforeCompletion(BatchJob)
and BatchAdapter.afterCompletion(BatchJob, boolean)
will be called.
After completeJob, BatchJob.getJobstate()
can be used to inquire about the outcome of the operation.bj
- the BatchJob to complete.resultCode
- an int to indicate a result conditionException
- when the BatchJob is not in state BatchJob.STARTED
.public static void completeJob(BatchJob bj, int resultCode, String resultvalues) throws Exception
BeanManager.commit()
or BeanManager.rollback()
.
BatchAdapter.beforeCompletion(BatchJob)
and BatchAdapter.afterCompletion(BatchJob, boolean)
will be called.
After completeJob, BatchJob.getJobstate()
can be used to inquire about the outcome of the operation.bj
- the BatchJob to complete.resultCode
- an int to indicate a result conditionresultvalues
- a String to transport some resultsException
- when the BatchJob is not in state BatchJob.STARTED
.public void compensate(ActivityInstance ai)
public static void abortBatchJob(ActivityInstance ai)
public static void reactivateBatchJob(ActivityInstance ai)
@enterprise 10.0.39049 Copyright © 2024 FREQUENTIS AG. All Rights Reserved.