org.jboss.ejb.txtimer
Class DatabasePersistencePolicy

java.lang.Object
  extended by org.jboss.mx.util.JBossNotificationBroadcasterSupport
      extended by org.jboss.system.ServiceMBeanSupport
          extended by org.jboss.ejb.txtimer.DatabasePersistencePolicy
All Implemented Interfaces:
javax.management.MBeanRegistration, javax.management.NotificationBroadcaster, javax.management.NotificationEmitter, DatabasePersistencePolicyMBean, PersistencePolicy, org.jboss.system.Service, org.jboss.system.ServiceMBean

public class DatabasePersistencePolicy
extends org.jboss.system.ServiceMBeanSupport
implements DatabasePersistencePolicyMBean

This service implements a PersistencePolicy that persistes the timer to a database.

Since:
09-Sep-2004
Version:
$Revision: 57209 $
Author:
Thomas.Diesler@jboss.org, Scott.Stark@jboss.org, Dimitris.Andreadis@jboss.org

Field Summary
 
Fields inherited from class org.jboss.system.ServiceMBeanSupport
server, SERVICE_CONTROLLER_SIG, serviceName
 
Fields inherited from interface org.jboss.ejb.txtimer.DatabasePersistencePolicyMBean
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
DatabasePersistencePolicy()
           
 
Method Summary
 void clearTimers()
          Delete all persisted timers
 void deleteTimer(String timerId, TimedObjectId timedObjectId)
          Removes the timer from persistent storage.
 String getDatabasePersistencePlugin()
           
 javax.management.ObjectName getDataSource()
           
 void insertTimer(String timerId, TimedObjectId timedObjectId, Date firstEvent, long intervalDuration, Serializable info)
          Creates the timer in persistent storage.
 List listTimerHandles()
          Return a List of TimerHandle objects.
 List listTimerHandles(javax.management.ObjectName containerId, ClassLoader loader)
          List the persisted timer handles for a particular container
 void resetAndRestoreTimers()
          Re-read the current persistent timers list, clear the db of timers, and restore the timers.
 void restoreTimers()
          Restore the persistent timers seen during service startup
 void setDatabasePersistencePlugin(String dbpPluginClass)
          The used database persistence plugin class
 void setDataSource(javax.management.ObjectName dataSource)
          The used datasource
 void startService()
          Initializes this service.
 
Methods inherited from class org.jboss.system.ServiceMBeanSupport
create, createService, destroy, destroyService, getDeploymentInfo, getLog, getName, getNextNotificationSequenceNumber, getObjectName, getServer, getServiceName, getState, getStateString, jbossInternalCreate, jbossInternalDescription, jbossInternalDestroy, jbossInternalLifecycle, jbossInternalStart, jbossInternalStop, postDeregister, postRegister, preDeregister, preRegister, start, stop, stopService
 
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.Service
create, destroy, start, stop
 

Constructor Detail

DatabasePersistencePolicy

public DatabasePersistencePolicy()
Method Detail

startService

public void startService()
                  throws Exception
Initializes this service.

Overrides:
startService in class org.jboss.system.ServiceMBeanSupport
Throws:
Exception

insertTimer

public void insertTimer(String timerId,
                        TimedObjectId timedObjectId,
                        Date firstEvent,
                        long intervalDuration,
                        Serializable info)
Creates the timer in persistent storage.

Specified by:
insertTimer in interface PersistencePolicy
Parameters:
timerId - The timer id
timedObjectId - The timed object id
firstEvent - The point in time at which the first txtimer expiration must occur.
intervalDuration - The number of milliseconds that must elapse between txtimer expiration notifications.
info - A serializable handback object.

deleteTimer

public void deleteTimer(String timerId,
                        TimedObjectId timedObjectId)
Removes the timer from persistent storage.

Specified by:
deleteTimer in interface PersistencePolicy
Parameters:
timerId - The timer id
timedObjectId - The id of the timed object

listTimerHandles

public List listTimerHandles(javax.management.ObjectName containerId,
                             ClassLoader loader)
List the persisted timer handles for a particular container

Specified by:
listTimerHandles in interface PersistencePolicy
Parameters:
containerId - The Container ObjectName
loader - The ClassLoader to use for loading the handles
Returns:
a list of TimerHandleImpl objects

listTimerHandles

public List listTimerHandles()
Return a List of TimerHandle objects.

Specified by:
listTimerHandles in interface PersistencePolicy
Returns:
a list of TimerHandleImpl objects

restoreTimers

public void restoreTimers()
Restore the persistent timers seen during service startup


clearTimers

public void clearTimers()
Delete all persisted timers

Specified by:
clearTimers in interface PersistencePolicy

resetAndRestoreTimers

public void resetAndRestoreTimers()
                           throws SQLException
Re-read the current persistent timers list, clear the db of timers, and restore the timers.

Specified by:
resetAndRestoreTimers in interface DatabasePersistencePolicyMBean
Throws:
SQLException

getDataSource

public javax.management.ObjectName getDataSource()
Specified by:
getDataSource in interface DatabasePersistencePolicyMBean

setDataSource

public void setDataSource(javax.management.ObjectName dataSource)
Description copied from interface: DatabasePersistencePolicyMBean
The used datasource

Specified by:
setDataSource in interface DatabasePersistencePolicyMBean

getDatabasePersistencePlugin

public String getDatabasePersistencePlugin()
Specified by:
getDatabasePersistencePlugin in interface DatabasePersistencePolicyMBean

setDatabasePersistencePlugin

public void setDatabasePersistencePlugin(String dbpPluginClass)
Description copied from interface: DatabasePersistencePolicyMBean
The used database persistence plugin class

Specified by:
setDatabasePersistencePlugin in interface DatabasePersistencePolicyMBean


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