Overview | Package | Class | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## org.jboss.util
Class Scheduler

    java.lang.Object
      |
      +--javax.management.NotificationBroadcasterSupport
            |
            +--org.jboss.util.ServiceMBeanSupport
                  |
                  +--org.jboss.util.Scheduler

All Implemented Interfaces:
  javax.management.MBeanRegistration, javax.management.NotificationBroadcaster, SchedulerMBean, Service, ServiceMBean

public class Scheduler
extends ServiceMBeanSupport
implements SchedulerMBean

Scheduler Instance to allow clients to run this as a scheduling service for any Schedulable instances.

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

Inner Class Summary
`class` | `Scheduler.Listener`
`static class` | `Scheduler.SchedulableExample` A test class for a Schedulable Class

Field Summary
`static java.lang.String` | `JMX_NAME`
`static java.lang.String` | `JNDI_NAME`

Fields inherited from class org.jboss.util.ServiceMBeanSupport
`log, server`

Fields inherited from interface org.jboss.util.SchedulerMBean
`OBJECT_NAME`

Fields inherited from interface org.jboss.util.ServiceMBean
`STARTED, STARTING, states, STOPPED, STOPPING`

Constructor Summary
`Scheduler()` Default (no-args) Constructor
`Scheduler(java.lang.String pName)` Constructor with the necessary attributes to be set
`Scheduler(java.lang.String pName, java.lang.String pSchedulableClass, java.lang.String pInitArguments, java.lang.String pInitTypes, long pInitialStartDate, long pSchedulePeriod, long pNumberOfRepetitions)` Constructor with the necessary attributes to be set

Method Summary
`long` | `getInitialRepetitions()`
`java.lang.String` | `getJNDIName()`
`java.lang.String` | `getName()`
`javax.management.ObjectName` | `getObjectName(javax.management.MBeanServer pServer, javax.management.ObjectName pName)`
`long` | `getRemainingRepetitions()`
`java.lang.String` | `getSchedulableArguments()`
`java.lang.String` | `getSchedulableArgumentTypes()`
`java.lang.String` | `getSchedulableClass()`
`long` | `getSchedulePeriod()`
`protected void` | `initService()`
`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.
`protected void` | `startService()`
`void` | `stopSchedule(boolean pDoItNow)` Stops the schedule because it is either not used anymore or to restart it with new values.
`protected void` | `stopService()`

Methods inherited from class org.jboss.util.ServiceMBeanSupport
`destroy, destroyService, getServer, getState, getStateString, init, nextSequenceNumber, postDeregister, postRegister, preDeregister, preRegister, start, stop`

Methods inherited from class javax.management.NotificationBroadcasterSupport
`addNotificationListener, getNotificationInfo, 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.util.ServiceMBean
`getState, getStateString`

Methods inherited from interface org.jboss.util.Service
`destroy, init, start, stop`

Field Detail

### JNDI_NAME

    public static java.lang.String JNDI_NAME

### JMX_NAME

    public static java.lang.String JMX_NAME

Constructor Detail

### Scheduler

    public Scheduler()

  Default (no-args) Constructor

### Scheduler

    public Scheduler(java.lang.String pName)

  Constructor with the necessary attributes to be set
  Parameters:
    `pName` - Name of the MBean

### Scheduler

    public Scheduler(java.lang.String pName,
                     java.lang.String pSchedulableClass,
                     java.lang.String pInitArguments,
                     java.lang.String pInitTypes,
                     long pInitialStartDate,
                     long pSchedulePeriod,
                     long pNumberOfRepetitions)

  Constructor with the necessary attributes to be set
  Parameters:
    `pName` - Name of the MBean

Method Detail

### startSchedule

    public void startSchedule()

  Description copied from interface: `SchedulerMBean`
  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.
  Specified by:
    `startSchedule` in interface `SchedulerMBean`
  Following copied from interface: `org.jboss.util.SchedulerMBean`
  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)

  Description copied from interface: `SchedulerMBean`
  Stops the schedule because it is either not used anymore or to restart it with new values.
  Specified by:
    `stopSchedule` in interface `SchedulerMBean`
  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.

### restartSchedule

    public void restartSchedule()

  Description copied from interface: `SchedulerMBean`
  Stops the server right now and starts it right now.
  Specified by:
    `restartSchedule` in interface `SchedulerMBean`

### getSchedulableClass

    public java.lang.String getSchedulableClass()

  Specified by:
    `getSchedulableClass` in interface `SchedulerMBean`
  Following copied from interface: `org.jboss.util.SchedulerMBean`
  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

  Description copied from interface: `SchedulerMBean`
  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 `SchedulerMBean.setSchedulableArguments(java.lang.String)` and `SchedulerMBean.setSchedulableArgumentTypes(java.lang.String)`.
  Specified by:
    `setSchedulableClass` in interface `SchedulerMBean`
  Following copied from interface: `org.jboss.util.SchedulerMBean`
  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()

  Specified by:
    `getSchedulableArguments` in interface `SchedulerMBean`
  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)

  Description copied from interface: `SchedulerMBean`
  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.
  Specified by:
    `setSchedulableArguments` in interface `SchedulerMBean`
  Following copied from interface: `org.jboss.util.SchedulerMBean`
  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()

  Specified by:
    `getSchedulableArgumentTypes` in interface `SchedulerMBean`
  Following copied from interface: `org.jboss.util.SchedulerMBean`
  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

  Description copied from interface: `SchedulerMBean`
  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.
  Specified by:
    `setSchedulableArgumentTypes` in interface `SchedulerMBean`
  Following copied from interface: `org.jboss.util.SchedulerMBean`
  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()

  Specified by:
    `getSchedulePeriod` in interface `SchedulerMBean`
  Following copied from interface: `org.jboss.util.SchedulerMBean`
  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)

  Description copied from interface: `SchedulerMBean`
  Sets the Schedule Period between two scheduled call.
  Specified by:
    `setSchedulePeriod` in interface `SchedulerMBean`
  Following copied from interface: `org.jboss.util.SchedulerMBean`
  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()

  Specified by:
    `getInitialRepetitions` in interface `SchedulerMBean`
  Following copied from interface: `org.jboss.util.SchedulerMBean`
  Returns:
    Number of scheduled calls initially. If -1 then there is not limit.

### setInitialRepetitions

    public void setInitialRepetitions(long pNumberOfCalls)

  Description copied from interface: `SchedulerMBean`
  Sets the initial number of scheduled calls.
  Specified by:
    `setInitialRepetitions` in interface `SchedulerMBean`
  Following copied from interface: `org.jboss.util.SchedulerMBean`
  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()

  Specified by:
    `getRemainingRepetitions` in interface `SchedulerMBean`
  Following copied from interface: `org.jboss.util.SchedulerMBean`
  Returns:
    Number of remaining repetitions. If -1 then there is no limit.

### isStarted

    public boolean isStarted()

  Specified by:
    `isStarted` in interface `SchedulerMBean`
  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.

### isRestartPending

    public boolean isRestartPending()

  Specified by:
    `isRestartPending` in interface `SchedulerMBean`
  Following copied from interface: `org.jboss.util.SchedulerMBean`
  Returns:
    True if any attributes are changed but the Schedule is not restarted yet.

### getObjectName

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

  Overrides:
    `getObjectName` in class `ServiceMBeanSupport`

### getJNDIName

    public java.lang.String getJNDIName()

### getName

    public java.lang.String getName()

  Specified by:
    `getName` in interface `ServiceMBean`
  Overrides:
    `getName` in class `ServiceMBeanSupport`

### initService

    protected void initService()
                        throws java.lang.Exception

  Overrides:
    `initService` in class `ServiceMBeanSupport`

### startService

    protected void startService()
                         throws java.lang.Exception

  Overrides:
    `startService` in class `ServiceMBeanSupport`

### stopService

    protected void stopService()

  Overrides:
    `stopService` in class `ServiceMBeanSupport`

Overview | Package | Class | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

Copyright © 2000 The JBoss Organization. All Rights Reserved.