|
|||||||||
PREV PACKAGE NEXT PACKAGE | FRAMES NO FRAMES |
See:
Description
Interface Summary | |
---|---|
BatchAdapter | Interface BatchAdapter allows an instance to be notified by the BatchManager of execution events
of a BatchJob. |
ExceptionBatchAdapter |
Class Summary | |
---|---|
BatchJob | Captures state information about batch Jobs. |
BatchManager | Starts and Completes BatchJobs. |
ExceptionHandlingCompletedHandler | |
NullAdapter | Poor mans implementation of BatchAdapter . |
The batch package contains the classes which support long running tasks (batch jobs) in @enterprise.
System steps (specified via system <methodname>) in WDL are for the automatic execution of methods. They are executed within the current thread and within the current transaction context. So the duration of a user initiated finish action of an interactive step is prolonged by the duration of the following system steps (and the duration of the preprocessing method of the next interactive step). As a consequence, system steps should be rather lightweight in terms of execution time.
Batch jobs are created in the process definition via the batch statement in WDL or in the process editor.
A timer activated BatchManager
is responsible for starting batch jobs and for finishing continuing the execution of the process instance after a batch job has completed.
after the batch job has completed.
Batch jobs are instances of BatchJob
.
State information about batch jobs is maintained persistently in the database and
updated throughout the lifecyle of the job. Each job follows a lifecycle which is
normally a sequence of the four states
CREATED
,
STARTED
,
FINISHED
and
COMPLETED
.
Created means entered into the database but not (yet) started. Started means that the Batchjob is currently running. Finished batch jobs have terminated their execution, but the corresponding process step where the batch job originated is still not finished. After the originating step is finished, the job is said to be completed.
Lifecyle events can be captured by means of implementing the BatchAdapter
interface.
batch <batchAdapterClassname>([stringparam]) { startnow | newthread | autofinish | gobackonerror }
e.g.: batch com.groiss.demo.DemoBatchAdapter("p1") startnow gobackonerror;
An appropriate BatchAdapter
must be stated, one constant parameter can be given and the behaviour
can be modified in four ways via flagging
afterCreation
bj.getParams
, the ActivityInstance can be accessed via
bj.getContext
If an exception occurs during the creation of the batch job, the action (the previously issued finish) is rolled back and no traces remain in the database.
After creation of the batch job, afterCreation
is called. This method can be used
to prepare the start of the batch job e.g. by transferring values from forms to some appropriate locations. If some fields of the
batch job instance are updated, then the update call for the batchjob in the database is the responsibility of afterCreation.
The call of afterCreation takes place in the same thread and transactional context as the previous finish. Exceptions thrown
by afterCreation cause rollback of the transaction.
doStart
doStart
is called.
If an exception is thrown in doStart, the state of the BatchJob changes to
STARTERROR
. No further action is taken by
the batch system.
markJobFinished
BatchManager.markJobFinished
.
When the BatchManager detects such jobs during its next timer controlled run, it completes them.
beforeCompletion
,
Completion and
afterCompletion
First, the beforeCompletion
method
is called.
If there is an exception, the job is placed in state FINISHERROR
.
No further action is taken by the batch system.
If all went well in beforeCompletion, the originating task of the process instance is finished and
the job is placed in state COMPLETED
.
If there is an exception during the finish,
the job is placed in state FINISHERROR
and
no further action is taken by the batch system.
After this, the
afterCompletion
method is called
with a boolean parameter which indicates if the job is now in state COMPLETED (commit = true) or in
state FINISHERROR (commit = false).
doCompensate
doCompensate
is called.
ABORTED
.
No further action on this batch job will take place automatically.
If such a process is reactivated later on,
no changes are made to the state of the batch job. The administrator will have to make
the appropriate adjustments to the batch job manually via the link in the process history
(e.g. setting the state to STARTED
or to FINISHED
and to adjust the associated time stamps).
BatchJob.setStartnow(boolean)
,
BatchJob.setAutofinish(boolean)
,
BatchJob.setNewthread(boolean)
and
BatchJob.setGoBackOnError(boolean)
or
in the third parameter of
BatchManager.submitJob
.
BatchManager.submitJob
method
and not during the next timer triggered run of the BatchManager.
The defaults for the lifecycle are startnow=false ,autofinish=false, newthread=false and gobackonerror=false. Using startnow=true, autofinish=true, newthread=false and gobackonerror=true, we approach the semantics of the system steps.
|
|||||||||
PREV PACKAGE NEXT PACKAGE | FRAMES NO FRAMES |