Rio Project 4.2 API Documentation



org.rioproject.watch
Class StopWatch

java.lang.Object
  extended by org.rioproject.watch.Watch
      extended by org.rioproject.watch.ThresholdWatch
          extended by org.rioproject.watch.StopWatch
All Implemented Interfaces:
StopWatchMBean, ThresholdWatchMBean, WatchMBean

public class StopWatch
extends ThresholdWatch
implements StopWatchMBean

A Watch for capturing elapsed time


Field Summary
static String VIEW
           
 
Fields inherited from class org.rioproject.watch.Watch
COMPONENT, DEFAULT_VIEW, id, localRef, logger, watchDataSource
 
Constructor Summary
StopWatch(String id)
          Creates new Stop Watch
StopWatch(String id, Configuration config)
          Creates new StopWatch, creates and exports a WatchDataSourceImpl if the WatchDataSource is null using the Configuration object provided
StopWatch(WatchDataSource watchDataSource, String id)
          Creates new Stop Watch
 
Method Summary
 long getStartTime()
          Getter for property startTime
 void setElapsedTime(long elapsed)
          Sets the elapsed time of the measured interval
 void setElapsedTime(long elapsed, long now)
          Sets the elapsed time of the measured interval
 void setStartTime(long startTime)
          Setter for property startTime
 void startTiming()
          Start the timing for the watch
 void stopTiming()
          Stop the timing for the watch
 
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.ThresholdWatchMBean
getBreachedCount, getClearedCount, getCurrentHighThreshold, getCurrentLowThreshold, getHighThreshold, getLowThreshold, setCurrentHighThreshold, setCurrentLowThreshold
 
Methods inherited from interface org.rioproject.watch.WatchMBean
clear, getCalculables, getId, getLastCalculableValue
 

Field Detail

VIEW

public static final String VIEW
See Also:
Constant Field Values
Constructor Detail

StopWatch

public StopWatch(String id)
Creates new Stop Watch

Parameters:
id - the identifier for this watch

StopWatch

public StopWatch(String id,
                 Configuration config)
Creates new StopWatch, 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

StopWatch

public StopWatch(WatchDataSource watchDataSource,
                 String id)
Creates new Stop Watch

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

startTiming

public void startTiming()
Description copied from interface: StopWatchMBean
Start the timing for the watch

Specified by:
startTiming in interface StopWatchMBean
See Also:
StopWatchMBean.startTiming()

stopTiming

public void stopTiming()
Description copied from interface: StopWatchMBean
Stop the timing for the watch

Specified by:
stopTiming in interface StopWatchMBean
See Also:
StopWatchMBean.stopTiming()

setElapsedTime

public void setElapsedTime(long elapsed)
Description copied from interface: StopWatchMBean
Sets the elapsed time of the measured interval

Specified by:
setElapsedTime in interface StopWatchMBean
Parameters:
elapsed - milliseconds of elapsed time
See Also:
StopWatchMBean.setElapsedTime(long)

setElapsedTime

public void setElapsedTime(long elapsed,
                           long now)
Description copied from interface: StopWatchMBean
Sets the elapsed time of the measured interval

Specified by:
setElapsedTime in interface StopWatchMBean
Parameters:
elapsed - milliseconds of elapsed time
now - the current time in milliseconcds since the epoch.
See Also:
StopWatchMBean.setElapsedTime(long, long)

getStartTime

public long getStartTime()
Description copied from interface: StopWatchMBean
Getter for property startTime

Specified by:
getStartTime in interface StopWatchMBean
Returns:
Value of property startTime.
See Also:
StopWatchMBean.getStartTime()

setStartTime

public void setStartTime(long startTime)
Description copied from interface: StopWatchMBean
Setter for property startTime

Specified by:
setStartTime in interface StopWatchMBean
Parameters:
startTime - New value of property startTime.
See Also:
StopWatchMBean.setStartTime(long)

Copyright © Rio Project.

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