站内搜索: 请输入搜索关键词
当前页面: 在线文档首页 > JBoss 4.0.1 sp1 varia API Documentation 英文版文档

ScheduleManager (Various API) - JBoss 4.0.1 sp1 varia API Documentation 英文版文档


org.jboss.varia.scheduler
Class ScheduleManager

java.lang.Object
  extended byorg.jboss.mx.util.JBossNotificationBroadcasterSupport
      extended byorg.jboss.system.ServiceMBeanSupport
          extended byorg.jboss.varia.scheduler.ScheduleManager
All Implemented Interfaces:
javax.management.MBeanRegistration, javax.management.NotificationBroadcaster, javax.management.NotificationEmitter, ScheduleManagerMBean, org.jboss.system.Service, org.jboss.system.ServiceMBean

public class ScheduleManager
extends org.jboss.system.ServiceMBeanSupport
implements ScheduleManagerMBean

Schedule Manager which manage the Schedule and their matching Timer notifications and notification listeners. Each provider has to register when it is started where in turn their startProviding() method is called which allows him to add its Schedules because the Manager is now ready.

Version:
$Revision: 1.13 $
Author:
Andreas Schaefer

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(javax.management.ObjectName pProvider, javax.management.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.
 javax.management.ObjectName getObjectName(javax.management.MBeanServer pServer, javax.management.ObjectName pName)
           
 String getSchedules()
          Returns a list of the identifications of all registered schedules
 String getTimerName()
           
 boolean isPaused()
           
 boolean isStartAtStartup()
           
 boolean isStarted()
           
 void registerProvider(String pProviderObjectName)
          Register a Provider to make him available.
 void removeSchedule(int pIdentification)
          Removes a Schedule so that no notification is sent anymore
 void restartSchedule()
          Stops the server right now and starts it right now.
 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)
           
 void startSchedules()
          Starts all the containing Schedules
protected  void startService()
          Creates the requested Timer if not already available and start all added Schedules.
 void stopSchedules(boolean pDoItNow)
          Stops all the sontaining Schedules
protected  void stopService()
          Stops all available 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.system.ServiceMBeanSupport
create, createService, destroy, getLog, getName, getNextNotificationSequenceNumber, getServer, getServiceName, getState, getStateString, jbossInternalCreate, jbossInternalDescription, jbossInternalDestroy, jbossInternalLifecycle, jbossInternalStart, jbossInternalStop, postDeregister, postRegister, preDeregister, preRegister, start, stop
 
Methods inherited from class org.jboss.mx.util.JBossNotificationBroadcasterSupport
addNotificationListener, getNotificationInfo, handleNotification, 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

DEFAULT_TIMER_NAME

public static String DEFAULT_TIMER_NAME
Default Timer Object Name

Constructor Detail

ScheduleManager

public ScheduleManager()
Default (no-args) Constructor

Method Detail

startSchedules

public void startSchedules()
Starts all the containing Schedules

Specified by:
startSchedules in interface ScheduleManagerMBean

stopSchedules

public void stopSchedules(boolean pDoItNow)
Stops all the sontaining Schedules

Specified by:
stopSchedules in interface ScheduleManagerMBean
Parameters:
pDoItNow - If true all the schedules are stopped immeditaly otherwise it waits until the next notification is sent

restartSchedule

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

Specified by:
restartSchedule in interface ScheduleManagerMBean

registerProvider

public void registerProvider(String pProviderObjectName)
Register a Provider to make him available. In turn this method calls "startProviding()" method on the Provider to indicate that the Provider can start adding Schedules.

Specified by:
registerProvider in interface ScheduleManagerMBean
Parameters:
pProviderObjectName - Object Name of the Provider

unregisterProvider

public void unregisterProvider(String pProviderObjectName)
Unregister a Provider which in turn calls "stopProviding()" indicating to the Provider to remove all the Schedules.

Specified by:
unregisterProvider in interface ScheduleManagerMBean
Parameters:
pProviderObjectName - Object Name of the Provider

addSchedule

public int addSchedule(javax.management.ObjectName pProvider,
                       javax.management.ObjectName pTarget,
                       String pMethodName,
                       String[] pMethodSignature,
                       Date pStartDate,
                       long pPeriod,
                       int pRepetitions)
Adds a new Schedule to the Scheduler

Specified by:
addSchedule in interface ScheduleManagerMBean
Parameters:
pTarget - Object Name of the Target MBean
pMethodName - Name of the method to be called
pMethodSignature - List of Attributes of the method to be called where ...
pStartDate - Date when the schedule is started
pRepetitions - Initial Number of repetitions
Returns:
Identification of the Schedule used later to remove it if necessary

removeSchedule

public void removeSchedule(int pIdentification)
Removes a Schedule so that no notification is sent anymore

Specified by:
removeSchedule in interface ScheduleManagerMBean
Parameters:
pIdentification - Identification returned by addSchedule() or getSchedules().

getSchedules

public String getSchedules()
Returns a list of the identifications of all registered schedules

Returns:
List of Identifications separated by a ","

isPaused

public boolean isPaused()
Returns:
True if all the Schedules are paused meaning that even when the notifications are sent to the listener they are ignored. ATTENTION: this applies to all registered Schedules and any notifications are lost during pausing

setPaused

public void setPaused(boolean pIsPaused)
Pauses or restarts the Schedules which either suspends the notifications or start transfering them to the target

Parameters:
pIsPaused - True when the Schedules are paused or false when they resumes

isStarted

public boolean isStarted()
Returns:
True if the Schedule Manager is started

isStartAtStartup

public boolean isStartAtStartup()
Specified by:
isStartAtStartup in interface ScheduleManagerMBean
Returns:
True if the Schedule when the Scheduler is started

setStartAtStartup

public void setStartAtStartup(boolean pStartAtStartup)
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.

Specified by:
setStartAtStartup in interface ScheduleManagerMBean
Parameters:
pStartAtStartup - True if Schedule has to be started at startup time

getTimerName

public String getTimerName()
Specified by:
getTimerName in interface ScheduleManagerMBean
Returns:
Name of the Timer MBean used in here

setTimerName

public void setTimerName(String pTimerName)
Specified by:
setTimerName in interface ScheduleManagerMBean
Parameters:
pTimerName - Object Name of the Timer MBean to be used. If null or not a valid ObjectName the default will be used

getObjectName

public javax.management.ObjectName getObjectName(javax.management.MBeanServer pServer,
                                                 javax.management.ObjectName pName)
                                          throws javax.management.MalformedObjectNameException
Throws:
javax.management.MalformedObjectNameException

destroyService

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.


startService

protected void startService()
                     throws Exception
Creates the requested Timer if not already available and start all added Schedules. ATTENTION: the start of the schedules is not necessary when the service is started but this method is also called when the service is restarted and therefore schedules can be available.

Throws:
Exception

stopService

protected void stopService()
Stops all available Schedules.



Copyright © 2002 JBoss Group, LLC. All Rights Reserved.