- call the launch method
Note: the BatchConfiguration instance can be build from the properties of the configuration file
(see PropertiesLoader.getProperties).
The execution of the batch can be managed through JMX (ObjectName=net.sf.mybatchfwk:type=BatchService).
- Author:
- Jérôme Bertèche (cyberteche@users.sourceforge.net)
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
BatchService
public BatchService()
getInstance
public static BatchService getInstance()
- In standalone mode the instance is referenced as a static member
- Returns:
main
public static void main(java.lang.String[] args)
- Main method to start the batch service in standalone mode.
Configuration is load from the config file.
- Parameters:
args - no args
init
public void init(BatchConfiguration conf)
throws BatchException
- Initialization method.
Build the batch object if needed and initialize it.
- Parameters:
config - the configuration
- Throws:
BatchException
prepareForLaunch
public void prepareForLaunch()
throws BatchException
- Called just before the execution of the batch.
Check the consistency of the configuration and build the executor service.
- Throws:
BatchException
launch
public void launch()
throws BatchException
- Launch the batch
- Throws:
BatchException
executeBatch
protected void executeBatch()
throws BatchException
- Method in which the batch is executed
- Throws:
BatchException
shutdownScheduleService
protected void shutdownScheduleService()
- Shutdown the schedule service
sleepBatchService
protected void sleepBatchService()
throws BatchException
- Put the batch service on the sleep mode.
- Throws:
BatchException
awaitServiceTermination
protected void awaitServiceTermination(java.util.concurrent.ExecutorService service)
throws BatchException
- Wait for the termination of the service
- Parameters:
service -
- Throws:
BatchException
setState
protected void setState(BatchService.STATE newState)
- Set the new state of the batch and process to the notification of the new state if jmx is enable
- Parameters:
newState -
canBeExecuted
public boolean canBeExecuted(ITask task)
throws BatchException
- Determine if a task can be executed or not
- Parameters:
task -
- Returns:
-
- Throws:
BatchException
afterExecute
protected void afterExecute(ITask task,
java.lang.Throwable throwable)
- Report an execution termination
- Parameters:
task - throwable -
manageFatalError
public void manageFatalError(java.lang.Throwable throwable)
- Manage a fatal error during the batch execution that cause a crash
- Parameters:
throwable -
pause
public void pause()
throws java.lang.Exception
- Suspends the execution of the batch/executor/schedule services.
Called through JMX.
- Throws:
java.lang.Exception
resume
public void resume()
throws java.lang.Exception
- Resume the execution of the batch/executor/schedule services.
Called through JMX.
- Throws:
java.lang.Exception
shutdown
public void shutdown(boolean waitForSubmittedTasks)
throws java.lang.Exception
- Stop the execution of the batch.
Called through JMX.
- Parameters:
waitForSubmittedTasks - if true, then waits for the execution of the submitted tasks before to terminate.
- Throws:
java.lang.Exception
restart
public void restart()
throws java.lang.Exception
- Restart the execution of the batch.
Called through JMX.
- Throws:
BatchException
java.lang.Exception
getThreadPoolExecutor
public ITaskExecutor getThreadPoolExecutor()
- Returns:
- the executor used to execute tasks
getState
public BatchService.STATE getState()
- Returns:
- the current state of the batch service
setBatch
public void setBatch(IBatch batch)
- Parameters:
batch - The batch to set.
getExecutionReport
public ExecutionReport getExecutionReport()
- Returns:
- Returns the executionReport.
Copyright © 2006 null. All Rights Reserved.