|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object atg.nucleus.logging.VariableArgumentApplicationLoggingImpl atg.nucleus.GenericService atg.service.scheduler.SchedulableService
public abstract class SchedulableService
A convenience base class for generic services that are schedulable. It is not difficult to implement Schedulable directly, but it does involve a fair amount of code. This base class is a simple implementation of Schedulable that is suitable for most services that want to implement Schedulable.
Subclasses need only implement performScheduledTask()
to be
schedulable.
It is recommended that the jobName
and
jobDescription
properties be configured on this
component. Subclasses can also provide default values for these in their
doStartService()
methods if desired.
Nota Bene: the schedule related properties are only consulted when
startScheduledJob()
is called. If any of these properties
change, you can call stopScheduledJob()
and
startScheduledJob()
to pick up the changes.
Field Summary | |
---|---|
static java.lang.String |
CLASS_VERSION
Class version string |
protected int |
mJobId
the jobId of our scheduled task |
Fields inherited from class atg.nucleus.GenericService |
---|
SERVICE_INFO_KEY |
Fields inherited from interface atg.nucleus.logging.TraceApplicationLogging |
---|
DEFAULT_LOG_TRACE_STATUS |
Fields inherited from interface atg.nucleus.logging.ApplicationLogging |
---|
DEFAULT_LOG_DEBUG_STATUS, DEFAULT_LOG_ERROR_STATUS, DEFAULT_LOG_INFO_STATUS, DEFAULT_LOG_WARNING_STATUS |
Constructor Summary | |
---|---|
SchedulableService()
|
Method Summary | |
---|---|
void |
doStartService()
The default implementation is to just start our scheduled job. |
void |
doStopService()
The default implementation is to just stop our scheduled job. |
java.lang.String |
getJobDescription()
Get property jobDescription |
java.lang.String |
getJobName()
Get property jobName |
Schedule |
getSchedule()
Get property schedule |
Scheduler |
getScheduler()
Get property scheduler |
int |
getThreadMethod()
Get property threadMethod |
boolean |
isTransactional()
Returns property Transactional |
abstract void |
performScheduledTask(Scheduler pScheduler,
ScheduledJob pJob)
Called by the scheduler when it is time for this service to perform its function. |
void |
setJobDescription(java.lang.String pJobDescription)
Set property jobDescription |
void |
setJobName(java.lang.String pJobName)
Set property jobName |
void |
setSchedule(Schedule pSchedule)
Set property schedule |
void |
setScheduler(Scheduler pScheduler)
Set property scheduler |
void |
setThreadMethod(int pThreadMethod)
Set property threadMethod |
void |
setTransactional(boolean pTransactional)
Sets property Transactional |
protected void |
startScheduledJob()
If we have a scheduler and a schedule and we are not already running start our scheduled job. |
protected void |
stopScheduledJob()
If we have a job running, stop it. |
Methods inherited from class atg.nucleus.logging.VariableArgumentApplicationLoggingImpl |
---|
vlogDebug, vlogDebug, vlogDebug, vlogDebug, vlogError, vlogError, vlogError, vlogError, vlogInfo, vlogInfo, vlogInfo, vlogInfo, vlogTrace, vlogTrace, vlogTrace, vlogTrace, vlogWarning, vlogWarning, vlogWarning, vlogWarning |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static java.lang.String CLASS_VERSION
protected int mJobId
Constructor Detail |
---|
public SchedulableService()
Method Detail |
---|
public void setScheduler(Scheduler pScheduler)
scheduler
pScheduler
- new value to setpublic Scheduler getScheduler()
scheduler
scheduler
public void setSchedule(Schedule pSchedule)
schedule
pSchedule
- new value to setpublic Schedule getSchedule()
schedule
schedule
public void setJobName(java.lang.String pJobName)
jobName
pJobName
- new value to setpublic java.lang.String getJobName()
jobName
jobName
public void setJobDescription(java.lang.String pJobDescription)
jobDescription
pJobDescription
- new value to setpublic java.lang.String getJobDescription()
jobDescription
jobDescription
public void setThreadMethod(int pThreadMethod)
threadMethod
pThreadMethod
- new value to setpublic int getThreadMethod()
threadMethod
threadMethod
public void setTransactional(boolean pTransactional)
public boolean isTransactional()
public void doStartService() throws ServiceException
doStartService
in class GenericService
ServiceException
- if an error occurred during the operationpublic void doStopService() throws ServiceException
doStopService
in class GenericService
ServiceException
- if an error occurred during the operationprotected void startScheduledJob()
protected void stopScheduledJob()
public abstract void performScheduledTask(Scheduler pScheduler, ScheduledJob pJob)
performScheduledTask
in interface Schedulable
pScheduler
- the scheduler managing this jobpJob
- the scheduled job associated with this service
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |