public class CronTaskManager extends java.lang.Object implements FixedLoggers
mxe.cronTask.psdi.test.CTTest=10swould cause the CronService to load the psdi.test.CTTest class and configure it to run every 10 seconds. Intervals are configured as an integer and a unit designator. Valid values for the unit designator are s,m,h,d which correspond to seconds, minutes, hours and days. The default unit is minutes. CronTasks can implement methods that serialize their current state, store it to the disk in their shutdown() method and then load it from the disk in their init() method. Please see the source code for the psdi.test.CTTest for an example of how to store() and load() serialized state to/from the disk.
| Modifier and Type | Class and Description |
|---|---|
static class |
CronTaskManager.PropertyListener |
APPLOGGER, CRONTASKLOGGER, CRONTASKMGRLOGGER, CRONTASKMGRSQLLOGGER, DBCONNECTIONLOGGER, DDLOGGER, DMLOGGER, EVENTLOGGER, EXCEPTIONLOGGER, MAILLOGGER, MAXIMOLOGGER, MTLOGGER, NULLMBOPOINTER, SECURITY, SENDFAILEDLOGGER, SERVICELOGGER, SQLLOGGERappenderPrefix, LOGGERNAME_APP, LOGGERNAME_CRONTASK, LOGGERNAME_CRONTASKMGR, LOGGERNAME_DBCONNECTION, LOGGERNAME_DD, LOGGERNAME_DM, LOGGERNAME_DMPREVIEW, LOGGERNAME_EVENT, LOGGERNAME_EXCEPTION, LOGGERNAME_MAIL, LOGGERNAME_MAXIMO, LOGGERNAME_MT, LOGGERNAME_NULLMBOPOINTER, LOGGERNAME_SECURITY, LOGGERNAME_SENDFAILED, LOGGERNAME_SERVICE, LOGGERNAME_SQL, LOGGERNAME_SQL_CRONTASKMGR, LOGGERNAME_TXN, loggerPrefix| Constructor and Description |
|---|
CronTaskManager() |
CronTaskManager(MXServer mxServer) |
| Modifier and Type | Method and Description |
|---|---|
void |
activate(CrontaskInstanceRemote inst)
Activate the crontask.
|
java.util.Enumeration |
activeCronThreads() |
void |
add(CronTask newTask,
java.lang.String taskName,
java.lang.String instanceName)
Programmatically add a CronTask.
|
void |
config(java.util.Properties configData)
Configures the set of crontask instances to run.
|
void |
configFromProperties() |
void |
configure(java.util.Properties configData) |
void |
deactivate(java.lang.String key) |
void |
deactivate(java.lang.String taskName,
java.lang.String instName)
Handles the request when the crontask is deactivated.
|
void |
destroy()
Calls CronTaskManager.shutdown().
|
CronTask |
get(java.lang.String name,
java.lang.String instanceName)
Get a CronTask by looking up its name.
|
CrontaskInstanceRemote |
getInstanceMbo(java.lang.String taskName,
java.lang.String instanceName)
Convenient method to get the standalong crontask instance mbo remote.
|
java.util.Date |
getLastKPICronTaskRun() |
java.util.Date |
getLastRunTime(CronTask cron,
java.lang.String taskName,
java.lang.String instanceName)
Get the last run time for a task.
|
java.util.Date[] |
getLastTaskInfo(CronTask cron,
java.lang.String taskName,
java.lang.String instanceName)
Get the information for the task for last time run.
|
void |
handleAutoRemoval(CronTask cronTask)
If it is autoremoval, remove the crontask instance parameter as well to trigger
any action that is associated with remove the crontask defined by the crontask itself.
|
void |
init()
Starts a thread for each task currently configured.
|
boolean |
initialzeCronTaskInfo(java.lang.String taskName,
java.lang.String instanceName)
Initialize the crontask information, get the schedule information and
caculate the first sleeping time till the next run.
|
void |
insertFirstRowIntoTask(java.lang.String task)
Insert the first row into the taskscheduler table if row
is not already present.
|
boolean |
isReadyForAdminMode()
Whether the crontask manager is ready for admin mode.
|
boolean |
isShutdown()
Returns a logical AND from calling isShutdown() on each CronTask.
|
boolean |
isSleeping(java.lang.String taskName,
java.lang.String instanceName)
Identify whether a ConThread is sleeping.
|
void |
loadCrontask(java.lang.String taskName,
java.lang.String instanceName,
java.lang.String className)
Instantiate the crontask object, start the crontask thread and put them
into the hash tables.
|
void |
logSql(java.lang.String sql,
java.sql.Connection con) |
void |
remove(CronTask task,
java.lang.String taskName,
java.lang.String instanceName)
Programmatically remove a CronTask.
|
void |
restart()
Restarts this service.
|
void |
resumeCrontasks()
This method should and can only be called the moment when admin mode is off.
|
void |
runTenantsChanged() |
void |
setLastKPICronTaskRun() |
void |
shutdown()
Calls Thread.stop() on each thread associated with a CronTask.
|
void |
suspendCrontasks() |
int |
updateLastEnd(CronTask cron,
java.lang.String taskName,
java.lang.String instanceName)
Update the taskscheduler table with the information for the Server
which started the task
|
int |
updateTaskInfoByAnotherServer(CronTask cron,
java.lang.String taskName,
java.lang.String instanceName)
Update the taskscheduler table by another server(server which started the
cron task no longer exists)
|
public CronTaskManager()
public CronTaskManager(MXServer mxServer)
public void configFromProperties()
public void configure(java.util.Properties configData)
public void config(java.util.Properties configData)
throws java.rmi.RemoteException,
MXException
MXExceptionjava.rmi.RemoteExceptionpublic void suspendCrontasks()
throws MXException
MXExceptionpublic void resumeCrontasks()
throws MXException
MXExceptionpublic boolean isReadyForAdminMode()
throws MXException
MXExceptionpublic java.util.Enumeration activeCronThreads()
public void loadCrontask(java.lang.String taskName,
java.lang.String instanceName,
java.lang.String className)
taskName - instanceName - className - public boolean initialzeCronTaskInfo(java.lang.String taskName,
java.lang.String instanceName)
public void insertFirstRowIntoTask(java.lang.String task)
public int updateLastEnd(CronTask cron, java.lang.String taskName, java.lang.String instanceName)
public int updateTaskInfoByAnotherServer(CronTask cron, java.lang.String taskName, java.lang.String instanceName)
public java.util.Date[] getLastTaskInfo(CronTask cron, java.lang.String taskName, java.lang.String instanceName)
public java.util.Date getLastRunTime(CronTask cron, java.lang.String taskName, java.lang.String instanceName)
public void init()
throws java.lang.Exception
java.lang.Exceptionpublic void destroy()
MXExceptionjava.rmi.RemoteExceptionpublic void shutdown()
throws MXException,
java.rmi.RemoteException
MXExceptionjava.rmi.RemoteExceptionpublic boolean isShutdown()
public void add(CronTask newTask, java.lang.String taskName, java.lang.String instanceName) throws MXSystemException
MXSystemExceptionpublic void remove(CronTask task, java.lang.String taskName, java.lang.String instanceName)
public CronTask get(java.lang.String name, java.lang.String instanceName)
public boolean isSleeping(java.lang.String taskName,
java.lang.String instanceName)
taskName - CronTask NameinstanceName - Instance Namepublic void restart()
throws java.rmi.RemoteException,
MXException
MXExceptionjava.rmi.RemoteExceptionpublic void handleAutoRemoval(CronTask cronTask)
cronTask - public CrontaskInstanceRemote getInstanceMbo(java.lang.String taskName, java.lang.String instanceName) throws MXException, java.rmi.RemoteException
taskName - instanceName - MXExceptionjava.rmi.RemoteExceptionpublic void deactivate(java.lang.String taskName,
java.lang.String instName)
taskName - instName - public void deactivate(java.lang.String key)
public void activate(CrontaskInstanceRemote inst) throws MXException, java.rmi.RemoteException
inst - CronTaskInstanceRemoteMXExceptionjava.rmi.RemoteExceptionpublic void runTenantsChanged()
throws java.rmi.RemoteException,
MXException
java.rmi.RemoteExceptionMXExceptionpublic void logSql(java.lang.String sql,
java.sql.Connection con)
throws java.rmi.RemoteException,
MXException
java.rmi.RemoteExceptionMXExceptionpublic void setLastKPICronTaskRun()
public java.util.Date getLastKPICronTaskRun()