|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.jboss.mx.util.JBossNotificationBroadcasterSupport
org.jboss.system.ServiceMBeanSupport
org.jboss.varia.scheduler.ScheduleManager
public class ScheduleManager
ScheduleManager manages multiple scheduled timer listeners.
These are registered using the addSchedule(javax.management.ObjectName, javax.management.ObjectName, java.lang.String, java.lang.String[], java.util.Date, long, int)
operation.
Providers (basically MBean lifecycle listeners) can be registered using the
registerProvider(java.lang.String)
operation.
Because of the way the JBoss deployment model works (no way to readily
invoke operations at deployment time), prefer to use the Scheduler
MBean instead.
Nested Class Summary | |
---|---|
class |
ScheduleManager.MBeanListener
This listener is waiting for its Timer Notification and call the appropriate method on the given Target (MBean) and count down the number of remaining repetitions. |
Field Summary | |
---|---|
static String |
DEFAULT_TIMER_NAME
Default Timer Object Name |
Fields inherited from class org.jboss.system.ServiceMBeanSupport |
---|
log, server, SERVICE_CONTROLLER_SIG, serviceName |
Fields inherited from interface org.jboss.varia.scheduler.ScheduleManagerMBean |
---|
OBJECT_NAME |
Fields inherited from interface org.jboss.system.ServiceMBean |
---|
CREATE_EVENT, CREATED, DESTROY_EVENT, DESTROYED, FAILED, REGISTERED, START_EVENT, STARTED, STARTING, states, STOP_EVENT, STOPPED, STOPPING, UNREGISTERED |
Constructor Summary | |
---|---|
ScheduleManager()
Default (no-args) Constructor |
Method Summary | |
---|---|
int |
addSchedule(ObjectName pProvider,
ObjectName pTarget,
String pMethodName,
String[] pMethodSignature,
Date pStartDate,
long pPeriod,
int pRepetitions)
Adds a new Schedule to the Scheduler |
protected void |
destroyService()
When Service is destroyed it will call the "unregisterProvider()" on all register Providers to let them remove their Schedules and being notified that they should stop providing. |
boolean |
getFixedRate()
|
ObjectName |
getObjectName(MBeanServer pServer,
ObjectName pName)
|
String |
getSchedules()
Returns a list of the ids of all registered schedules |
String |
getTimerName()
|
boolean |
isPaused()
|
boolean |
isStartAtStartup()
|
boolean |
isStarted()
|
void |
registerProvider(ObjectName pProviderObjectName)
Register a Provider to make it available. |
void |
registerProvider(String pProviderObjectName)
Register a Provider to make it available. |
void |
removeSchedule(int pIdentification)
Removes a Schedule so that no notification is sent anymore |
void |
restartSchedule()
Stops existing schedules immediately and restarts them right away. |
void |
setFixedRate(boolean fixedRate)
The default scheduling to use, fixed-rate or fixed-delay (false, default) |
void |
setPaused(boolean pIsPaused)
Pauses or restarts the Schedules which either suspends the notifications or start transfering them to the target |
void |
setStartAtStartup(boolean pStartAtStartup)
Set the scheduler to start when MBean started or not. |
void |
setTimerName(String pTimerName)
The JMX timer to use for the actual scheduling |
void |
startSchedules()
Starts all the registered Schedules |
protected void |
startService()
Creates the requested Timer if not already available and start all added Schedules. |
void |
stopSchedules(boolean pDoItNow)
Stops all the registered Schedules |
protected void |
stopService()
Stops all Schedules. |
void |
unregisterProvider(ObjectName pProviderObjectName)
Unregister a Provider which in turn calls "stopProviding()" indicating to the Provider to remove all the Schedules. |
void |
unregisterProvider(String pProviderObjectName)
Unregister a Provider which in turn calls "stopProviding()" indicating to the Provider to remove all the Schedules. |
Methods inherited from class org.jboss.mx.util.JBossNotificationBroadcasterSupport |
---|
addNotificationListener, getNotificationInfo, handleNotification, nextNotificationSequenceNumber, removeNotificationListener, 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.system.ServiceMBean |
---|
getName, getState, getStateString, jbossInternalLifecycle |
Methods inherited from interface org.jboss.system.Service |
---|
create, destroy, start, stop |
Field Detail |
---|
public static String DEFAULT_TIMER_NAME
Constructor Detail |
---|
public ScheduleManager()
Method Detail |
---|
public void startSchedules()
startSchedules
in interface ScheduleManagerMBean
public void stopSchedules(boolean pDoItNow)
stopSchedules
in interface ScheduleManagerMBean
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()
restartSchedule
in interface ScheduleManagerMBean
public void registerProvider(String pProviderObjectName)
registerProvider
in interface ScheduleManagerMBean
pProviderObjectName
- Object Name of the Providerpublic void registerProvider(ObjectName pProviderObjectName) throws JMException
pProviderObjectName
- Object Name of the Provider
JMException
public void unregisterProvider(String pProviderObjectName)
unregisterProvider
in interface ScheduleManagerMBean
pProviderObjectName
- Object Name of the Providerpublic void unregisterProvider(ObjectName pProviderObjectName) throws JMException
pProviderObjectName
- Object Name of the Provider
JMException
public int addSchedule(ObjectName pProvider, ObjectName pTarget, String pMethodName, String[] pMethodSignature, Date pStartDate, long pPeriod, int pRepetitions)
addSchedule
in interface ScheduleManagerMBean
pTarget
- Object Name of the Target MBeanpMethodName
- Name of the method to be calledpMethodSignature
- List of Attributes of the method to be called
where ...pStartDate
- Date when the schedule is startedpRepetitions
- Initial Number of repetitions
public void removeSchedule(int pIdentification)
removeSchedule
in interface ScheduleManagerMBean
pIdentification
- Identification returned by addSchedule()
or getSchedules()
.public String getSchedules()
public boolean isPaused()
public void setPaused(boolean pIsPaused)
pIsPaused
- True when the Schedules are paused or false when they resumepublic boolean isStarted()
public void setStartAtStartup(boolean pStartAtStartup)
startService()
gets called (normally at
startup time.
setStartAtStartup
in interface ScheduleManagerMBean
pStartAtStartup
- if the scheduler should be started upon MBean start or notpublic boolean isStartAtStartup()
isStartAtStartup
in interface ScheduleManagerMBean
public void setTimerName(String pTimerName)
ScheduleManagerMBean
setTimerName
in interface ScheduleManagerMBean
pTimerName
- Object Name of the Timer MBean to
be used. If null or not a valid ObjectName
the default will be usedpublic String getTimerName()
getTimerName
in interface ScheduleManagerMBean
public void setFixedRate(boolean fixedRate)
ScheduleManagerMBean
setFixedRate
in interface ScheduleManagerMBean
fixedRate
- the default scheduling to use, fixed-rate or fixed-delay (false, default)public boolean getFixedRate()
getFixedRate
in interface ScheduleManagerMBean
public ObjectName getObjectName(MBeanServer pServer, ObjectName pName) throws MalformedObjectNameException
getObjectName
in class ServiceMBeanSupport
MalformedObjectNameException
protected void startService() throws Exception
startService
in class ServiceMBeanSupport
Exception
protected void stopService()
stopService
in class ServiceMBeanSupport
protected void destroyService()
destroyService
in class ServiceMBeanSupport
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |