Rio Project 4.2 API Documentation



org.rioproject.watch
Class PeriodicWatch

java.lang.Object
  extended by org.rioproject.watch.Watch
      extended by org.rioproject.watch.ThresholdWatch
          extended by org.rioproject.watch.PeriodicWatch
All Implemented Interfaces:
PeriodicWatchMBean, ThresholdWatchMBean, WatchMBean
Direct Known Subclasses:
MeasurableCapability, SamplingWatch

public abstract class PeriodicWatch
extends ThresholdWatch
implements PeriodicWatchMBean

A PeriodicWatch provides a mechanism to obtain information at preset intervals of time.


Field Summary
static long DEFAULT_PERIOD
          Holds value of property period.
 
Fields inherited from class org.rioproject.watch.Watch
COMPONENT, DEFAULT_VIEW, id, localRef, logger, watchDataSource
 
Constructor Summary
PeriodicWatch(String id)
          Creates new Periodic Watch
PeriodicWatch(String id, Configuration config)
          Creates new PeriodicWatch, creates and exports a WatchDataSourceImpl if the WatchDataSource is null using the Configuration object provided
PeriodicWatch(WatchDataSource watchDataSource, String id)
          Creates new PeriodicWatch
 
Method Summary
 long getPeriod()
          Getter for property period.
 void setPeriod(long newPeriod)
          Setter for property period.
 void start()
          Start the PeriodicWatch.
 void stop()
          Stop the PeriodicWatch
 
Methods inherited from class org.rioproject.watch.ThresholdWatch
addThresholdListener, addWatchRecord, getBreachedCount, getClearedCount, getCurrentHighThreshold, getCurrentLowThreshold, getHighThreshold, getLowThreshold, getThresholdManager, getThresholdValues, removeThresholdListener, setCurrentHighThreshold, setCurrentLowThreshold, setThresholdValues
 
Methods inherited from class org.rioproject.watch.Watch
clear, equals, getCalculables, getId, getLastCalculableValue, getView, getWatchDataSource, hashCode, main, setView, setWatchDataSource, toString
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface org.rioproject.watch.PeriodicWatchMBean
checkValue
 
Methods inherited from interface org.rioproject.watch.ThresholdWatchMBean
getBreachedCount, getClearedCount, getCurrentHighThreshold, getCurrentLowThreshold, getHighThreshold, getLowThreshold, setCurrentHighThreshold, setCurrentLowThreshold
 
Methods inherited from interface org.rioproject.watch.WatchMBean
clear, getCalculables, getId, getLastCalculableValue
 

Field Detail

DEFAULT_PERIOD

public static final long DEFAULT_PERIOD
Holds value of property period.

See Also:
Constant Field Values
Constructor Detail

PeriodicWatch

public PeriodicWatch(String id)
Creates new Periodic Watch

Parameters:
id - the identifier for this watch

PeriodicWatch

public PeriodicWatch(String id,
                     Configuration config)
Creates new PeriodicWatch, creates and exports a WatchDataSourceImpl if the WatchDataSource is null using the Configuration object provided

Parameters:
id - The identifier for this watch
config - Configuration object used for constructing a WatchDataSource

PeriodicWatch

public PeriodicWatch(WatchDataSource watchDataSource,
                     String id)
Creates new PeriodicWatch

Parameters:
watchDataSource - the watch data source associated with this watch
id - the identifier for this watch
Method Detail

start

public void start()
Description copied from interface: PeriodicWatchMBean
Start the PeriodicWatch. The PeriodicWatch will be started using repeated fixed-delay executions, with the first invocation of checkValue occurring at the time this method is invoked plus the time specified for the property value In fixed-delay execution, each execution is scheduled relative to the actual execution time of the previous execution. If an execution is delayed for any reason (such as garbage collection or other background activity), subsequent executions will be delayed as well. A new Timer will be created each time this method is called. If a Timer already exists, it will be cancelled.

Specified by:
start in interface PeriodicWatchMBean
See Also:
PeriodicWatchMBean.start()

stop

public void stop()
Description copied from interface: PeriodicWatchMBean
Stop the PeriodicWatch

Specified by:
stop in interface PeriodicWatchMBean
See Also:
PeriodicWatchMBean.stop()

getPeriod

public long getPeriod()
Description copied from interface: PeriodicWatchMBean
Getter for property period.

Specified by:
getPeriod in interface PeriodicWatchMBean
Returns:
Value of property period.
See Also:
PeriodicWatchMBean.getPeriod()

setPeriod

public void setPeriod(long newPeriod)
Description copied from interface: PeriodicWatchMBean
Setter for property period.

Specified by:
setPeriod in interface PeriodicWatchMBean
Parameters:
newPeriod - New value of property period. The result of invoking this method will be to stop the PeriodicWatch and reschedule the subsequent fixed-delay execution based on the value provided for period
See Also:
PeriodicWatchMBean.setPeriod(long)

Copyright © Rio Project.

Copyright © 2006-2011 Rio Project. All Rights Reserved.