org.jboss.util
Interface SchedulerMBean

All Superinterfaces:
Service, ServiceMBean
All Known Implementing Classes:
Scheduler

public interface SchedulerMBean
extends ServiceMBean

This interface defines the manageable interface for a Scheduler Service allowing the client to create a Schedulable instance which is then run by this service at given times.

Author:
Andreas Schaefer (andreas.schaefer@madplanet.com)

Field Summary
static java.lang.String OBJECT_NAME
           
 
Fields inherited from interface org.jboss.util.ServiceMBean
STARTED, STARTING, states, STOPPED, STOPPING
 
Method Summary
 long getInitialRepetitions()
           
 long getRemainingRepetitions()
           
 java.lang.String getSchedulableArguments()
           
 java.lang.String getSchedulableArgumentTypes()
           
 java.lang.String getSchedulableClass()
           
 long getSchedulePeriod()
           
 boolean isRestartPending()
           
 boolean isStarted()
           
 void restartSchedule()
          Stops the server right now and starts it right now.
 void setInitialRepetitions(long pNumberOfCalls)
          Sets the initial number of scheduled calls.
 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 setSchedulePeriod(long pPeriod)
          Sets the Schedule Period between two scheduled call.
 void startSchedule()
          Starts the schedule if the schedule is stopped otherwise nothing will happen.
 void stopSchedule(boolean pDoItNow)
          Stops the schedule because it is either not used anymore or to restart it with new values.
 
Methods inherited from interface org.jboss.util.ServiceMBean
getName, getState, getStateString
 
Methods inherited from interface org.jboss.util.Service
destroy, init, start, stop
 

Field Detail

OBJECT_NAME

public static final java.lang.String OBJECT_NAME
Method Detail

startSchedule

public void startSchedule()
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.
Throws:
java.security.InvalidParameterException - If any of the necessary values are not set or invalid (especially for the Schedulable class attributes).

stopSchedule

public void stopSchedule(boolean pDoItNow)
Stops the schedule because it is either not used anymore or to restart it with new values.
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.

restartSchedule

public void restartSchedule()
Stops the server right now and starts it right now.

getSchedulableClass

public java.lang.String getSchedulableClass()
Returns:
Full qualified Class name of the schedulable class called by the schedule or null if not set.

setSchedulableClass

public void setSchedulableClass(java.lang.String pSchedulableClass)
                         throws java.security.InvalidParameterException
Sets the fully qualified Class name of the Schedulable Class being called by the Scheduler. Must be set before the Schedule is started. Please also set the setSchedulableArguments(java.lang.String) and setSchedulableArgumentTypes(java.lang.String).
Parameters:
pSchedulableClass - Fully Qualified Schedulable Class.
Throws:
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.

getSchedulableArguments

public java.lang.String getSchedulableArguments()
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.
Parameters:
pArgumentList - List of arguments used to create the Schedulable intance. If the list is null or empty then the no-args constructor is used.

getSchedulableArgumentTypes

public java.lang.String getSchedulableArgumentTypes()
Returns:
A comma seperated list of Argument Types which should match the list of arguments.

setSchedulableArgumentTypes

public void setSchedulableArgumentTypes(java.lang.String pTypeList)
                                 throws java.security.InvalidParameterException
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.
Parameters:
pTypeList - List of arguments used to create the Schedulable intance. If the list is null or empty then the no-args constructor is used.
Throws:
java.security.InvalidParameterException - If the given list contains a unknow datat type.

getSchedulePeriod

public long getSchedulePeriod()
Returns:
Schedule Period between two scheduled calls in Milliseconds. It will always be bigger than 0 except it returns -1 then the schedule is stopped.

setSchedulePeriod

public void setSchedulePeriod(long pPeriod)
Sets the Schedule Period between two scheduled call.
Parameters:
pPeriod - Time between to scheduled calls (after the initial call) in Milliseconds. This value must be bigger than 0.
Throws:
java.security.InvalidParameterException - If the given value is less or equal than 0

getInitialRepetitions

public long getInitialRepetitions()
Returns:
Number of scheduled calls initially. If -1 then there is not limit.

setInitialRepetitions

public void setInitialRepetitions(long pNumberOfCalls)
Sets the initial number of scheduled calls.
Parameters:
pNumberOfCalls - Initial Number of scheduled calls. If -1 then the number is unlimted.
Throws:
java.security.InvalidParameterException - If the given value is less or equal than 0

getRemainingRepetitions

public long getRemainingRepetitions()
Returns:
Number of remaining repetitions. If -1 then there is no limit.

isStarted

public boolean isStarted()
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.

isRestartPending

public boolean isRestartPending()
Returns:
True if any attributes are changed but the Schedule is not restarted yet.


Copyright © 2000 The JBoss Organization. All Rights Reserved.