|
|||||||||
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 MBeanMethod Detail |
public void startSchedule()
SchedulerMBean
startSchedule
in interface SchedulerMBean
org.jboss.util.SchedulerMBean
java.security.InvalidParameterException
- If any of the necessary values are not set
or invalid (especially for the Schedulable
class attributes).public void stopSchedule(boolean pDoItNow)
SchedulerMBean
stopSchedule
in interface SchedulerMBean
org.jboss.util.SchedulerMBean
pDoItNow
- 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()
SchedulerMBean
restartSchedule
in interface SchedulerMBean
public java.lang.String getSchedulableClass()
getSchedulableClass
in interface SchedulerMBean
org.jboss.util.SchedulerMBean
public void setSchedulableClass(java.lang.String pSchedulableClass) throws java.security.InvalidParameterException
SchedulerMBean
SchedulerMBean.setSchedulableArguments(java.lang.String)
and SchedulerMBean.setSchedulableArgumentTypes(java.lang.String)
.setSchedulableClass
in interface SchedulerMBean
org.jboss.util.SchedulerMBean
pSchedulableClass
- 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 SchedulerMBean
org.jboss.util.SchedulerMBean
public void setSchedulableArguments(java.lang.String pArgumentList)
SchedulerMBean
setSchedulableArguments
in interface SchedulerMBean
org.jboss.util.SchedulerMBean
pArgumentList
- 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 SchedulerMBean
org.jboss.util.SchedulerMBean
public void setSchedulableArgumentTypes(java.lang.String pTypeList) throws java.security.InvalidParameterException
SchedulerMBean
setSchedulableArgumentTypes
in interface SchedulerMBean
org.jboss.util.SchedulerMBean
pTypeList
- 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 SchedulerMBean
org.jboss.util.SchedulerMBean
public void setSchedulableMBean(java.lang.String pSchedulableMBean) throws java.security.InvalidParameterException
SchedulerMBean
SchedulerMBean.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 SchedulerMBean
org.jboss.util.SchedulerMBean
pSchedulableMBean
- 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 SchedulerMBean
org.jboss.util.SchedulerMBean
public void setSchedulableMBeanMethod(java.lang.String pSchedulableMBeanMethod) throws java.security.InvalidParameterException
SchedulerMBean
setSchedulableMBeanMethod
in interface SchedulerMBean
org.jboss.util.SchedulerMBean
pSchedulableMBeanMethod
- 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 SchedulerMBean
org.jboss.util.SchedulerMBean
public long getSchedulePeriod()
getSchedulePeriod
in interface SchedulerMBean
org.jboss.util.SchedulerMBean
public void setSchedulePeriod(long pPeriod)
SchedulerMBean
setSchedulePeriod
in interface SchedulerMBean
org.jboss.util.SchedulerMBean
pPeriod
- 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 SchedulerMBean
org.jboss.util.SchedulerMBean
setInitialStartDate()
method.public void setInitialStartDate(java.lang.String pStartDate)
SchedulerMBean
setInitialStartDate
in interface SchedulerMBean
org.jboss.util.SchedulerMBean
pStartDate
- Date when the initial call is scheduled. It can be either:
public long getInitialRepetitions()
getInitialRepetitions
in interface SchedulerMBean
org.jboss.util.SchedulerMBean
public void setInitialRepetitions(long pNumberOfCalls)
SchedulerMBean
setInitialRepetitions
in interface SchedulerMBean
org.jboss.util.SchedulerMBean
pNumberOfCalls
- 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 SchedulerMBean
org.jboss.util.SchedulerMBean
public boolean isStarted()
isStarted
in interface SchedulerMBean
org.jboss.util.SchedulerMBean
public boolean isRestartPending()
isRestartPending
in interface SchedulerMBean
org.jboss.util.SchedulerMBean
public boolean isStartAtStartup()
isStartAtStartup
in interface SchedulerMBean
org.jboss.util.SchedulerMBean
public void setStartAtStartup(boolean pStartAtStartup)
SchedulerMBean
startService()
gets called (normally at
startup time.setStartAtStartup
in interface SchedulerMBean
org.jboss.util.SchedulerMBean
pStartAtStartup
- True if Schedule has to be started at startup timepublic boolean isActive()
isActive
in interface SchedulerMBean
org.jboss.util.SchedulerMBean
public javax.management.ObjectName getObjectName(javax.management.MBeanServer pServer, javax.management.ObjectName pName) throws javax.management.MalformedObjectNameException
getObjectName
in class ServiceMBeanSupport
public java.lang.String getName()
getName
in interface ServiceMBean
getName
in class ServiceMBeanSupport
public javax.management.ObjectName getServiceName()
protected void startService() throws java.lang.Exception
startService
in class ServiceMBeanSupport
protected void stopService()
stopService
in class ServiceMBeanSupport
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |