## org.jboss.util
Class SchedulableExample

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

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

public class SchedulableExample
extends ServiceMBeanSupport
implements SchedulableExampleMBean

Scheduler Instance to allow clients to run this as a scheduling service for any Schedulable instances.
ATTENTION: The scheduler instance only allows to run one schedule at a time. Therefore when you want to run two schedules create to instances with this MBean. Suggested Object Name for the MBean are:
jboss:service=Scheduler,schedule=<you schedule name>
This way you should not run into a name conflict.

Author:
  Andreas Schaefer, Cameron (camtabor)

  Revisions:

  20010814 Cameron:

  - Checks if the TimerMBean is already loaded
  - Created a SchedulerNotificationFilter so that each Scheduler only get its notifications
  - Stop was broken because removeNotification( Integer ) was broken

  20011026 Andy:

  - Move the SchedulerNotificationFilter to become an internal class and renamed to NotificationFilter
  - MBean is not bind/unbind to JNDI server anymore

  20020117 Andy:

  - Change the behaviour when the Start Date is in the past. Now the Scheduler will behave as the Schedule is never stopped and find the next available time to start with respect to the settings. Therefore you can restart JBoss without adjust your Schedule every time. BUT you will still loose the calls during the Schedule was donw.
  - Added parsing capabilities to setInitialStartDate. Now NOW: current time, and a string in a format the SimpleDataFormat understand in your environment (US: m/d/yy h:m a) but of course the time in ms since 1/1/1970.
  - Some fixes like the stopping a Schedule even if it already stopped etc.

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

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

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

Constructor Summary
`SchedulableExample()` Default (no-args) Constructor

Method Summary
`java.lang.String` `getName()`
`javax.management.ObjectName` `getObjectName(javax.management.MBeanServer pServer, javax.management.ObjectName pName)`
`void` `hit(javax.management.Notification lNotification, java.util.Date lDate, long lRepetitions, javax.management.ObjectName lName, java.lang.String lTest)`

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

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`

Constructor Detail

### SchedulableExample

    public SchedulableExample()

  Default (no-args) Constructor

Method Detail

### hit

    public void hit(javax.management.Notification lNotification,
                    java.util.Date lDate,
                    long lRepetitions,
                    javax.management.ObjectName lName,
                    java.lang.String lTest)

  Specified by:
    `hit` in interface `SchedulableExampleMBean`

### getObjectName

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

  Overrides:
    `getObjectName` in class `ServiceMBeanSupport`

### getName

    public java.lang.String getName()

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

Copyright © 2000 The JBoss Organization. All Rights Reserved.