|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Object
|
+--javax.management.NotificationBroadcasterSupport
|
+--org.jboss.util.ServiceMBeanSupport
|
+--org.jboss.util.Scheduler
Scheduler Instance to allow clients to run this as a scheduling service for
any Schedulable instances.
Revisions: 20010814 Cameron:
ATTENTION: The scheduler instance only allows to run one schedule at a time.
Therefore when you want to run two schedules create to instances with this
MBean. Suggested Object Name for the MBean are:
jboss:service=Scheduler,schedule=
This way you should not run into a name conflict.
20011026 Andy:
20020117 Andy:
20020118 Andy:
20020119 Andy:
| Inner Class Summary | |
class |
Scheduler.Listener
|
class |
Scheduler.MBeanListener
|
static class |
Scheduler.SchedulableExample
A test class for a Schedulable Class |
| Field Summary | |
static java.lang.String |
JMX_NAME
|
static java.lang.String |
JNDI_NAME
|
| Fields inherited from class org.jboss.util.ServiceMBeanSupport |
log, server |
| Fields inherited from interface org.jboss.util.SchedulerMBean |
OBJECT_NAME |
| Fields inherited from interface org.jboss.util.ServiceMBean |
STARTED, STARTING, states, STOPPED, STOPPING |
| Constructor Summary | |
Scheduler()
Default (no-args) Constructor |
|
Scheduler(java.lang.String pSchedulableClass,
java.lang.String pInitArguments,
java.lang.String pInitTypes,
java.lang.String pInitialStartDate,
long pSchedulePeriod,
long pNumberOfRepetitions)
Constructor with the necessary attributes to be set |
|
| Method Summary | |
long |
getInitialRepetitions()
|
java.lang.String |
getInitialStartDate()
|
java.lang.String |
getName()
|
javax.management.ObjectName |
getObjectName(javax.management.MBeanServer pServer,
javax.management.ObjectName pName)
|
long |
getRemainingRepetitions()
|
java.lang.String |
getSchedulableArguments()
|
java.lang.String |
getSchedulableArgumentTypes()
|
java.lang.String |
getSchedulableClass()
|
java.lang.String |
getSchedulableMBean()
|
java.lang.String |
getSchedulableMBeanMethod()
|
long |
getSchedulePeriod()
|
javax.management.ObjectName |
getServiceName()
|
boolean |
isActive()
|
boolean |
isRestartPending()
|
boolean |
isStartAtStartup()
|
boolean |
isStarted()
|
boolean |
isUsingMBean()
|
void |
restartSchedule()
Stops the server right now and starts it right now. |
void |
setInitialRepetitions(long pNumberOfCalls)
Sets the initial number of scheduled calls. |
void |
setInitialStartDate(java.lang.String pStartDate)
Sets the first scheduled call. |
void |
setSchedulableArguments(java.lang.String pArgumentList)
Sets the comma seperated list of arguments for the Schedulable class. |
void |
setSchedulableArgumentTypes(java.lang.String pTypeList)
Sets the comma seperated list of argument types for the Schedulable class. |
void |
setSchedulableClass(java.lang.String pSchedulableClass)
Sets the fully qualified Class name of the Schedulable Class being called by the Scheduler. |
void |
setSchedulableMBean(java.lang.String pSchedulableMBean)
Sets the fully qualified JMX MBean name of the Schedulable MBean to be called. |
void |
setSchedulableMBeanMethod(java.lang.String pSchedulableMBeanMethod)
Sets the method name to be called on the Schedulable MBean. |
void |
setSchedulePeriod(long pPeriod)
Sets the Schedule Period between two scheduled call. |
void |
setStartAtStartup(boolean pStartAtStartup)
Set the scheduler to start when MBean started or not. |
void |
startSchedule()
Starts the schedule if the schedule is stopped otherwise nothing will happen. |
protected void |
startService()
|
void |
stopSchedule(boolean pDoItNow)
Stops the schedule because it is either not used anymore or to restart it with new values. |
protected void |
stopService()
|
| Methods inherited from class org.jboss.util.ServiceMBeanSupport |
destroy, destroyService, getServer, getState, getStateString, init, initService, nextSequenceNumber, postDeregister, postRegister, preDeregister, preRegister, start, stop |
| Methods inherited from class javax.management.NotificationBroadcasterSupport |
addNotificationListener, getNotificationInfo, removeNotificationListener, sendNotification |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Methods inherited from interface org.jboss.util.ServiceMBean |
getState, getStateString |
| Methods inherited from interface org.jboss.util.Service |
destroy, init, start, stop |
| Field Detail |
public static java.lang.String JNDI_NAME
public static java.lang.String JMX_NAME
| Constructor Detail |
public Scheduler()
public Scheduler(java.lang.String pSchedulableClass,
java.lang.String pInitArguments,
java.lang.String pInitTypes,
java.lang.String pInitialStartDate,
long pSchedulePeriod,
long pNumberOfRepetitions)
pName - Name of the MBean| Method Detail |
public void startSchedule()
SchedulerMBeanstartSchedule in interface SchedulerMBeanorg.jboss.util.SchedulerMBeanjava.security.InvalidParameterException - If any of the necessary values are not set
or invalid (especially for the Schedulable
class attributes).public void stopSchedule(boolean pDoItNow)
SchedulerMBeanstopSchedule in interface SchedulerMBeanorg.jboss.util.SchedulerMBeanpDoItNow - If true the schedule will be stopped without waiting for the next
scheduled call otherwise the next call will be performed before
the schedule is stopped.public void restartSchedule()
SchedulerMBeanrestartSchedule in interface SchedulerMBeanpublic java.lang.String getSchedulableClass()
getSchedulableClass in interface SchedulerMBeanorg.jboss.util.SchedulerMBean
public void setSchedulableClass(java.lang.String pSchedulableClass)
throws java.security.InvalidParameterException
SchedulerMBeanSchedulerMBean.setSchedulableArguments(java.lang.String) and SchedulerMBean.setSchedulableArgumentTypes(java.lang.String).setSchedulableClass in interface SchedulerMBeanorg.jboss.util.SchedulerMBeanpSchedulableClass - Fully Qualified Schedulable Class.java.security.InvalidParameterException - If the given value is not a valid class or cannot
be loaded by the Scheduler or is not of instance
Schedulable.public java.lang.String getSchedulableArguments()
getSchedulableArguments in interface SchedulerMBeanorg.jboss.util.SchedulerMBeanpublic void setSchedulableArguments(java.lang.String pArgumentList)
SchedulerMBeansetSchedulableArguments in interface SchedulerMBeanorg.jboss.util.SchedulerMBeanpArgumentList - List of arguments used to create the Schedulable intance. If
the list is null or empty then the no-args constructor is used.public java.lang.String getSchedulableArgumentTypes()
getSchedulableArgumentTypes in interface SchedulerMBeanorg.jboss.util.SchedulerMBean
public void setSchedulableArgumentTypes(java.lang.String pTypeList)
throws java.security.InvalidParameterException
SchedulerMBeansetSchedulableArgumentTypes in interface SchedulerMBeanorg.jboss.util.SchedulerMBeanpTypeList - List of arguments used to create the Schedulable intance. If
the list is null or empty then the no-args constructor is used.java.security.InvalidParameterException - If the given list contains a unknow datat type.public java.lang.String getSchedulableMBean()
getSchedulableMBean in interface SchedulerMBeanorg.jboss.util.SchedulerMBean
public void setSchedulableMBean(java.lang.String pSchedulableMBean)
throws java.security.InvalidParameterException
SchedulerMBeanSchedulerMBean.setSchedulableClass(java.lang.String),
SchedulerMBean.setSchedulableArguments(java.lang.String) and SchedulerMBean.setSchedulableArgumentTypes(java.lang.String) are
cleared and not used anymore. Therefore only use either Schedulable Class or
Schedulable MBean. If SchedulerMBean.setSchedulableMBeanMethod(java.lang.String) is not set then the
schedule method as in the Schedulable.perform(java.util.Date, long) will be called with the
same arguments. Also note that the Object Name will not be checked if the
MBean is available. If the MBean is not available it will not be called but
the remaining repetitions will be decreased.setSchedulableMBean in interface SchedulerMBeanorg.jboss.util.SchedulerMBeanpSchedulableMBean - JMX MBean Object Name which should be called.java.security.InvalidParameterException - If the given value is an valid Object Name.public java.lang.String getSchedulableMBeanMethod()
getSchedulableMBeanMethod in interface SchedulerMBeanorg.jboss.util.SchedulerMBean
public void setSchedulableMBeanMethod(java.lang.String pSchedulableMBeanMethod)
throws java.security.InvalidParameterException
SchedulerMBeansetSchedulableMBeanMethod in interface SchedulerMBeanorg.jboss.util.SchedulerMBeanpSchedulableMBeanMethod - Name of the method to be called optional followed
by method arguments (see above).java.security.InvalidParameterException - If the given value is not of the right
formatpublic boolean isUsingMBean()
isUsingMBean in interface SchedulerMBeanorg.jboss.util.SchedulerMBeanpublic long getSchedulePeriod()
getSchedulePeriod in interface SchedulerMBeanorg.jboss.util.SchedulerMBeanpublic void setSchedulePeriod(long pPeriod)
SchedulerMBeansetSchedulePeriod in interface SchedulerMBeanorg.jboss.util.SchedulerMBeanpPeriod - Time between to scheduled calls (after the initial call) in Milliseconds.
This value must be bigger than 0.java.security.InvalidParameterException - If the given value is less or equal than 0public java.lang.String getInitialStartDate()
getInitialStartDate in interface SchedulerMBeanorg.jboss.util.SchedulerMBeansetInitialStartDate() method.public void setInitialStartDate(java.lang.String pStartDate)
SchedulerMBeansetInitialStartDate in interface SchedulerMBeanorg.jboss.util.SchedulerMBeanpStartDate - Date when the initial call is scheduled. It can be either:
public long getInitialRepetitions()
getInitialRepetitions in interface SchedulerMBeanorg.jboss.util.SchedulerMBeanpublic void setInitialRepetitions(long pNumberOfCalls)
SchedulerMBeansetInitialRepetitions in interface SchedulerMBeanorg.jboss.util.SchedulerMBeanpNumberOfCalls - Initial Number of scheduled calls. If -1 then the number
is unlimted.java.security.InvalidParameterException - If the given value is less or equal than 0public long getRemainingRepetitions()
getRemainingRepetitions in interface SchedulerMBeanorg.jboss.util.SchedulerMBeanpublic boolean isStarted()
isStarted in interface SchedulerMBeanorg.jboss.util.SchedulerMBeanpublic boolean isRestartPending()
isRestartPending in interface SchedulerMBeanorg.jboss.util.SchedulerMBeanpublic boolean isStartAtStartup()
isStartAtStartup in interface SchedulerMBeanorg.jboss.util.SchedulerMBeanpublic void setStartAtStartup(boolean pStartAtStartup)
SchedulerMBeanstartService() gets called (normally at
startup time.setStartAtStartup in interface SchedulerMBeanorg.jboss.util.SchedulerMBeanpStartAtStartup - True if Schedule has to be started at startup timepublic boolean isActive()
isActive in interface SchedulerMBeanorg.jboss.util.SchedulerMBean
public javax.management.ObjectName getObjectName(javax.management.MBeanServer pServer,
javax.management.ObjectName pName)
throws javax.management.MalformedObjectNameException
getObjectName in class ServiceMBeanSupportpublic java.lang.String getName()
getName in interface ServiceMBeangetName in class ServiceMBeanSupportpublic javax.management.ObjectName getServiceName()
protected void startService()
throws java.lang.Exception
startService in class ServiceMBeanSupportprotected void stopService()
stopService in class ServiceMBeanSupport
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||