org.apache.james.util.watchdog
Class SchedulerWatchdogFactory

java.lang.Object
  extended by org.apache.james.util.watchdog.SchedulerWatchdogFactory
All Implemented Interfaces:
WatchdogFactory

public class SchedulerWatchdogFactory
extends java.lang.Object
implements WatchdogFactory

This class is a factory to produce Watchdogs, each of which is associated with a single TimeScheduler Target and a TimeScheduler object. This could be used in James by adding a server configuration parameter: schedulerWatchdogs = conf.getChild("useSchedulerWatchdogs").getValueAsBoolean(false); getting the TimeScheduler component: scheduler = (TimeScheduler) compMgr.lookup(TimeScheduler.ROLE); and changing AbstractJamesService.getWatchdogFactory to look something like: protected WatchdogFactory getWatchdogFactory() { WatchdogFactory theWatchdogFactory = null; if (schedulerWatchdogs) { theWatchdogFactory = new SchedulerWatchdogFactory(scheduler, timeout); } else { theWatchdogFactory = new ThreadPerWatchdogFactory(threadPool, timeout); } if (theWatchdogFactory instanceof LogEnabled) { ((LogEnabled)theWatchdogFactory).enableLogging(getLogger()); } return theWatchdogFactory; }


Constructor Summary
SchedulerWatchdogFactory(org.apache.avalon.cornerstone.services.scheduler.TimeScheduler theTimeScheduler, long timeout)
          Creates the factory and sets the TimeScheduler used to implement the watchdogs.
 
Method Summary
 Watchdog getWatchdog(WatchdogTarget theTarget)
          Gets a Watchdog
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

SchedulerWatchdogFactory

public SchedulerWatchdogFactory(org.apache.avalon.cornerstone.services.scheduler.TimeScheduler theTimeScheduler,
                                long timeout)
Creates the factory and sets the TimeScheduler used to implement the watchdogs.

Parameters:
theTimeScheduler - the scheduler that manages Watchdog triggering for Watchdogs produced by this factory
timeout - the timeout for Watchdogs produced by this factory
Method Detail

getWatchdog

public Watchdog getWatchdog(WatchdogTarget theTarget)
Description copied from interface: WatchdogFactory
Gets a Watchdog

Specified by:
getWatchdog in interface WatchdogFactory
Parameters:
theTarget - the WatchdogTarget to be triggered upon expiration
See Also:
WatchdogFactory.getWatchdog(WatchdogTarget)


Copyright © 2002-2007 The Apache Software Foundation. All Rights Reserved.