org.ow2.jonas.workcleaner.internal
Class JOnASWorkCleanerService

java.lang.Object
  extended by javax.management.NotificationBroadcasterSupport
      extended by org.ow2.jonas.lib.reconfig.ReconfigEmitter
          extended by org.ow2.jonas.lib.service.AbsServiceImpl
              extended by org.ow2.jonas.workcleaner.internal.JOnASWorkCleanerService
All Implemented Interfaces:
NotificationBroadcaster, NotificationEmitter, Service, WorkCleanerServiceMBean, WorkCleanerService

public class JOnASWorkCleanerService
extends AbsServiceImpl
implements WorkCleanerService, WorkCleanerServiceMBean

The JOnAS WorkCleaner is returned by this service.

Author:
Francois Fornaciari

Field Summary
 
Fields inherited from class org.ow2.jonas.lib.reconfig.ReconfigEmitter
RECONFIG_TYPE, SAVE_RECONFIG_TYPE
 
Constructor Summary
JOnASWorkCleanerService()
          Create a JOnASWorkCleanerService.
 
Method Summary
protected  void doStart()
          Start a new WorkCleaner service.
protected  void doStop()
          Stop the WorkCleaner.
 void executeTasks()
          Execute the registered tasks.
 int getPeriod()
          Returns the WorkCleaner clean period.
 void registerTask(CleanTask cleanTask)
          Register a new clean task.
 void setJmxService(JmxService jmxService)
           
 void setPeriod(int period)
           
 void unregisterTask(CleanTask cleanTask)
          Unregister a clean task.
 
Methods inherited from class org.ow2.jonas.lib.service.AbsServiceImpl
convertToList, doInit, getDomainName, getJonasServerName, getName, getServerProperties, init, isStarted, setName, setServerProperties, start, stop, throwRequirementException, toString
 
Methods inherited from class org.ow2.jonas.lib.reconfig.ReconfigEmitter
initLogger, sendReconfigNotification, sendSaveNotification
 
Methods inherited from class javax.management.NotificationBroadcasterSupport
addNotificationListener, getNotificationInfo, handleNotification, removeNotificationListener, removeNotificationListener, sendNotification
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

JOnASWorkCleanerService

public JOnASWorkCleanerService()
Create a JOnASWorkCleanerService.

Method Detail

getPeriod

public int getPeriod()
Returns the WorkCleaner clean period.

Returns:
The WorkCleaner clean period

setPeriod

public void setPeriod(int period)
Parameters:
period - Clean period used by the WorkCleaner

doStart

protected void doStart()
                throws ServiceException
Start a new WorkCleaner service. Abstract start-up method to be implemented by sub-classes.

Specified by:
doStart in class AbsServiceImpl
Throws:
ServiceException - service start-up failed

doStop

protected void doStop()
               throws ServiceException
Stop the WorkCleaner. Abstract method for service stopping to be implemented by sub-classes.

Specified by:
doStop in class AbsServiceImpl
Throws:
ServiceException - service stopping failed

registerTask

public void registerTask(CleanTask cleanTask)
                  throws WorkCleanerException
Register a new clean task.

Specified by:
registerTask in interface WorkCleanerService
Parameters:
cleanTask - the task to add
Throws:
WorkCleanerException - if the task cannot be registred

unregisterTask

public void unregisterTask(CleanTask cleanTask)
                    throws WorkCleanerException
Unregister a clean task.

Specified by:
unregisterTask in interface WorkCleanerService
Parameters:
cleanTask - The task to unregister
Throws:
WorkCleanerException - If the task cannot be unregistered

executeTasks

public void executeTasks()
Execute the registered tasks.

Specified by:
executeTasks in interface WorkCleanerServiceMBean
Specified by:
executeTasks in interface WorkCleanerService

setJmxService

public void setJmxService(JmxService jmxService)
Parameters:
jmxService - the jmxService to set


Copyright © 2010 OW2 Consortium. All Rights Reserved.