Package com.storedobject.job
Class Job
java.lang.Object
com.storedobject.job.Job
- Direct Known Subclasses:
CheckDelivery,ComputeConsumption,ComputeStockHistory,DaemonJob
A logic that extends this class is called a "Job". A Job can be scheduled to run (by invoking its
execute() method) at some defined intervals in the background by creating entries in the
Schedule data class. An instance is created only once and at defined time-intervals (based on the entries in
the Schedule), the execute() method is invoked. See also DaemonJob.- Author:
- Syam
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidSend an alert to the configured persons.voidclean()This method is invoked when the Job is completed.abstract voidexecute()Execute the Job.Get the device associated with this Job.Get current status information, if any.Get the currently activeTransactionManager.voidLog something to the device.voidshutdown()This method is invoked when the system is shutting down.
-
Constructor Details
-
Job
-
-
Method Details
-
getTransactionManager
Get the currently activeTransactionManager. Always, a validTransactionManagerexists during the life-cycle of the Job.- Returns:
- The currently active
TransactionManager.
-
getDevice
Get the device associated with this Job. Sometimes, this will be useful if you want to generate a device-specific report.- Returns:
- The current device.
-
execute
-
clean
public void clean()This method is invoked when the Job is completed. It can be used to clean up the resources. (In the case ofDaemonJobs, it will be invoked only when any error occurs. (The default implementation does nothing). -
shutdown
public void shutdown()This method is invoked when the system is shutting down. It will be called even if the job is inactive at that time. (The default implementation does nothing). -
log
-
alert
Send an alert to the configured persons. (When scheduling the Job, this can be configured).- Parameters:
messageParameters- Alert parameters.
-
getStatus
Get current status information, if any.- Returns:
- Current status information to display in the log.
-