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

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


org.jboss.varia.scheduler
Class SingleScheduleProvider

java.lang.Object
  extended byorg.jboss.mx.util.JBossNotificationBroadcasterSupport
      extended byorg.jboss.system.ServiceMBeanSupport
          extended byorg.jboss.ha.jmx.HAServiceMBeanSupport
              extended byorg.jboss.ha.singleton.HASingletonSupport
                  extended byorg.jboss.varia.scheduler.AbstractScheduleProvider
                      extended byorg.jboss.varia.scheduler.SingleScheduleProvider
All Implemented Interfaces:
AbstractScheduleProviderMBean, org.jboss.ha.jmx.HAServiceMBean, org.jboss.ha.singleton.HASingleton, org.jboss.ha.singleton.HASingletonMBean, javax.management.MBeanRegistration, javax.management.NotificationBroadcaster, javax.management.NotificationEmitter, org.jboss.system.Service, org.jboss.system.ServiceMBean, SingleScheduleProviderMBean

public class SingleScheduleProvider
extends AbstractScheduleProvider
implements SingleScheduleProviderMBean

This Provider adds a single Schedule to the Schedule Manager but you can create more than one of this MBeans and each will add a different Schedule even when the use the same Target. ATTENTION: This is the provider you used in the older Scheduler when you used a MBean as target.

Version:
$Revision: 1.4 $
Author:
Andreas Schaefer

Field Summary
 
Fields inherited from class org.jboss.system.ServiceMBeanSupport
log, server, SERVICE_CONTROLLER_SIG, serviceName
 
Fields inherited from interface org.jboss.varia.scheduler.SingleScheduleProviderMBean
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
SingleScheduleProvider()
          Default (no-args) Constructor
 
Method Summary
 String getDateFormat()
           
 javax.management.ObjectName getObjectName(javax.management.MBeanServer pServer, javax.management.ObjectName pName)
           
 long getPeriod()
           
 long getRepetitions()
           
 String getStartDate()
           
 String getTargetMethod()
           
 String getTargetName()
           
 void setDateFormat(String dateFormat)
          Sets the date format used to parse date/times
 void setPeriod(long pPeriod)
          Sets the Schedule Period between two scheduled call.
 void setRepetitions(long pNumberOfCalls)
          Sets the initial number of scheduled calls.
 void setStartDate(String pStartDate)
          Sets the first scheduled call.
 void setTargetMethod(String pTargetMethod)
          Sets the method name to be called on the Schedulable MBean.
 void setTargetName(String pTargetObjectName)
          Sets the fully qualified JMX MBean Object Name of the Schedulable MBean to be called.
 void startProviding()
          Add the Schedules to the Schedule Manager
 void stopProviding()
          Stops the Provider from providing and causing him to remove all Schedules
 
Methods inherited from class org.jboss.varia.scheduler.AbstractScheduleProvider
addSchedule, getScheduleManagerName, isHASingleton, removeSchedule, setHASingleton, setScheduleManagerName, startScheduleProviderService, startService, startSingleton, stopScheduleProviderService, stopService, stopSingleton
 
Methods inherited from class org.jboss.ha.singleton.HASingletonSupport
_stopOldMaster, isMasterNode, makeThisNodeMaster, partitionTopologyChanged
 
Methods inherited from class org.jboss.ha.jmx.HAServiceMBeanSupport
_receiveRemoteNotification, callAsyncMethodOnPartition, callMethodOnPartition, callMethodOnPartition, findHAPartitionWithName, getDistributedState, getPartition, getPartitionName, getServiceHAName, isDRMMasterReplica, registerDRMListener, registerRPCHandler, sendNotification, sendNotificationRemote, sendNotificationToLocalListeners, setDistributedState, setPartitionName, setupPartition, unregisterDRMListener, unregisterRPCHandler
 
Methods inherited from class org.jboss.system.ServiceMBeanSupport
create, createService, destroy, destroyService, 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
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface org.jboss.varia.scheduler.AbstractScheduleProviderMBean
getScheduleManagerName, isHASingleton, setHASingleton, setScheduleManagerName
 
Methods inherited from interface org.jboss.ha.singleton.HASingletonMBean
isMasterNode
 
Methods inherited from interface org.jboss.ha.jmx.HAServiceMBean
callMethodOnPartition, getDistributedState, getPartitionName, sendNotification, setDistributedState, setPartitionName
 
Methods inherited from interface org.jboss.system.ServiceMBean
getName, getState, getStateString, jbossInternalLifecycle
 
Methods inherited from interface org.jboss.system.Service
create, destroy, start, stop
 
Methods inherited from interface javax.management.NotificationBroadcaster
addNotificationListener, getNotificationInfo, removeNotificationListener
 

Constructor Detail

SingleScheduleProvider

public SingleScheduleProvider()
Default (no-args) Constructor

Method Detail

startProviding

public void startProviding()
                    throws javax.management.JMException
Description copied from interface: AbstractScheduleProviderMBean
Add the Schedules to the Schedule Manager

Specified by:
startProviding in interface SingleScheduleProviderMBean
Specified by:
startProviding in class AbstractScheduleProvider
Throws:
javax.management.JMException

stopProviding

public void stopProviding()
Description copied from interface: AbstractScheduleProviderMBean
Stops the Provider from providing and causing him to remove all Schedules

Specified by:
stopProviding in interface SingleScheduleProviderMBean
Specified by:
stopProviding in class AbstractScheduleProvider

getTargetName

public String getTargetName()
Specified by:
getTargetName in interface SingleScheduleProviderMBean
Returns:
Object Name of the Target MBean for the timer notifications

setTargetName

public void setTargetName(String pTargetObjectName)
                   throws InvalidParameterException
Sets the fully qualified JMX MBean Object Name of the Schedulable MBean to be called.

Specified by:
setTargetName in interface SingleScheduleProviderMBean
Parameters:
pTargetObjectName - JMX MBean Object Name which should be called.
Throws:
InvalidParameterException - If the given value is an valid Object Name.

getTargetMethod

public String getTargetMethod()
Specified by:
getTargetMethod in interface SingleScheduleProviderMBean
Returns:
Method description of the target MBean to be called

setTargetMethod

public void setTargetMethod(String pTargetMethod)
                     throws InvalidParameterException
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 ).

Specified by:
setTargetMethod in interface SingleScheduleProviderMBean
Parameters:
pTargetMethod - Name of the method to be called optional followed by method arguments (see above).
Throws:
InvalidParameterException - If the given value is not of the right format

getPeriod

public long getPeriod()
Specified by:
getPeriod in interface SingleScheduleProviderMBean
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.

setPeriod

public void setPeriod(long pPeriod)
Sets the Schedule Period between two scheduled call.

Specified by:
setPeriod in interface SingleScheduleProviderMBean
Parameters:
pPeriod - Time between to scheduled calls (after the initial call) in Milliseconds. This value must be bigger than 0.
Throws:
InvalidParameterException - If the given value is less or equal than 0

getDateFormat

public String getDateFormat()
Specified by:
getDateFormat in interface SingleScheduleProviderMBean
Returns:
the date format

setDateFormat

public void setDateFormat(String dateFormat)
Sets the date format used to parse date/times

Specified by:
setDateFormat in interface SingleScheduleProviderMBean
Parameters:
dateFormat - The date format when empty or null the locale is used to parse dates

getStartDate

public String getStartDate()
Specified by:
getStartDate in interface SingleScheduleProviderMBean
Returns:
Date (and time) of the first scheduled. For value see #setInitialStartDate method.

setStartDate

public void setStartDate(String pStartDate)
Sets the first scheduled call. If the date is in the past the scheduler tries to find the next available start date.

Specified by:
setStartDate in interface SingleScheduleProviderMBean
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
  • Date as String parsed using the date format attribute
  • 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).

getRepetitions

public long getRepetitions()
Specified by:
getRepetitions in interface SingleScheduleProviderMBean
Returns:
Number of scheduled calls initially. If -1 then there is not limit.

setRepetitions

public void setRepetitions(long pNumberOfCalls)
Sets the initial number of scheduled calls.

Specified by:
setRepetitions in interface SingleScheduleProviderMBean
Parameters:
pNumberOfCalls - Initial Number of scheduled calls. If -1 then the number is unlimted.
Throws:
InvalidParameterException - If the given value is less or equal than 0

getObjectName

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


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