Scheduler Instance to allow clients to run this as a scheduling service for
any Schedulable instances.
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.
Created a SchedulerNotificationFilter so that each Scheduler only
get its notifications
Stop was broken because removeNotification( Integer ) was broken
20011026 Andy:
Move the SchedulerNotificationFilter to become an internal class
and renamed to NotificationFilter
MBean is not bind/unbind to JNDI server anymore
20020117 Andy:
Change the behaviour when the Start Date is in the past. Now the
Scheduler will behave as the Schedule is never stopped and find
the next available time to start with respect to the settings.
Therefore you can restart JBoss without adjust your Schedule
every time. BUT you will still loose the calls during the Schedule
was down.
Added parsing capabilities to setInitialStartDate. Now NOW: current time,
and a string in a format the SimpleDataFormat understand in your environment
(US: m/d/yy h:m a) but of course the time in ms since 1/1/1970.
Some fixes like the stopping a Schedule even if it already stopped etc.
20020118 Andy:
Added the ability to call another MBean instead of an instance of the
given Schedulable class. Use setSchedulableMBean() to specify the JMX
Object Name pointing to the given MBean. Then if the MBean does not
contain the same method as the Schedulable instance you have to specify
the method with setSchedulableMBeanMethod(). There you can use some
constants.
20020119 Andy:
Added a helper method isActive()
Fixed a bug not indicating that no MBean is used when setSchedulableClass()
is called.
Fixed a bug therefore that when NOW is set as initial start date a restart
of the Schedule will reset the start date to the current date
Fixed a bug because the start date was update during recalculation of the
start date when the original start date is in the past (see above). With this
you could restart the schedule even after all hits were fired when the
schedule was not started immediately after the initial start date was set.
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
public 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
Starts the schedule if the schedule is stopped otherwise nothing will happen.
The Schedule is immediately set to started even the first call is in the
future.
Following copied from interface: org.jboss.util.SchedulerMBean
Parameters:
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.
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.
Following copied from interface: org.jboss.util.SchedulerMBean
Returns:
Comma seperated list of Constructor Arguments used to instantiate the
Schedulable class instance. Right now only basic data types, String and
Classes with a Constructor with a String as only argument are supported.
setSchedulableArguments
public void setSchedulableArguments(java.lang.String pArgumentList)
Sets the comma seperated list of arguments for the Schedulable class. Note that
this list must have as many elements as the Schedulable Argument Type list otherwise
the start of the Scheduler will fail. Right now only basic data types, String and
Classes with a Constructor with a String as only argument are supported.
Sets the comma seperated list of argument types for the Schedulable class. This will
be used to find the right constructor and to created the right instances to call the
constructor with. This list must have as many elements as the Schedulable Arguments
list otherwise the start of the Scheduler will fail. Right now only basic data types,
String and Classes with a Constructor with a String as only argument are supported.
Sets the method name to be called on the Schedulable MBean. It can optionally be
followed by an opening bracket, list of attributes (see below) and a closing bracket.
The list of attributes can contain:
NOTIFICATION which will be replaced by the timers notification instance
(javax.management.Notification)
DATE which will be replaced by the date of the notification call
(java.util.Date)
REPETITIONS which will be replaced by the number of remaining repetitions
(long)
SCHEDULER_NAME which will be replaced by the Object Name of the Scheduler
(javax.management.ObjectName)
any full qualified Class name which the Scheduler will be set a "null" value
for it
An example could be: "doSomething( NOTIFICATION, REPETITIONS, java.lang.String )"
where the Scheduler will pass the timer's notification instance, the remaining
repetitions as int and a null to the MBean's doSomething() method which must
have the following signature: doSomething( javax.management.Notification, long,
java.lang.String ).
Following copied from interface: org.jboss.util.SchedulerMBean
Parameters:
pStartDate - Date when the initial call is scheduled. It can be either:
NOW: date will be the current date (new Date()) plus 1 seconds
Date as String able to be parsed by SimpleDateFormat with default format
Milliseconds since 1/1/1970
If the date is in the past the Scheduler
will search a start date in the future with respect to the initial repe-
titions and the period between calls. This means that when you restart
the MBean (restarting JBoss etc.) it will start at the next scheduled
time. When no start date is available in the future the Scheduler will
not start.
Example: if you start your Schedulable everyday at Noon and you restart
your JBoss server then it will start at the next Noon (the same if started
before Noon or the next day if start after Noon).
Following copied from interface: org.jboss.util.SchedulerMBean
Returns:
True if the schedule is up and running. If you want to start the schedule
with another values by using {@ #startSchedule} you have to stop the schedule
first with {@ #stopSchedule} and wait until this method returns false.
Set the scheduler to start when MBean started or not. Note that this method only
affects when the startService() gets called (normally at
startup time.