|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.jmonit.Probe org.jmonit.Stopwatch org.jmonit.features.LocalStopwatch
public class LocalStopwatch
Field Summary | |
---|---|
static Factory<Stopwatch> |
FACTORY
|
Constructor Summary | |
---|---|
LocalStopwatch()
|
Method Summary | |
---|---|
void |
cancel()
Cancel monitoring. |
long |
getElapsedTime()
|
Stopwatch |
getFeature()
A feature is identified by the class it exposes to the
monitored application. |
boolean |
isPaused()
|
boolean |
isStarted()
|
boolean |
isStoped()
|
void |
pause()
Temporary stop the Stopwatch. |
void |
resume()
Resume the Stopwatch after a pause. |
void |
setMonitor(Monitor monitor)
Set the monitor this plugin extends. |
void |
setMonitoringEventBus(MonitoringEventBus bus)
Set the event bus used to dispatch monitoring events between the monitor and it's features. |
void |
start()
Start monitoring the process. |
long |
stop()
Stop monitoring the process. |
long |
stop(boolean canceled)
Convenience method to stop or cancel a Stopwatch depending on success of monitored operation |
Methods inherited from class org.jmonit.Stopwatch |
---|
finalize, fireMonitoringEvent, nanotime, start |
Methods inherited from class java.lang.Object |
---|
clone, equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final Factory<Stopwatch> FACTORY
Constructor Detail |
---|
public LocalStopwatch()
Method Detail |
---|
public void cancel()
Stopwatch
In some circumstances you want to monitor time elapsed from early stage of computation, and discover latter if the computed data is relevant. For example, monitoring a messaging system, but beeing interested only by some types of messages. In such case, a Stopwatch can be started early and canceled when the application is able to determine it's relevancy.
In any way, the probe will still report thread concurrency even if canceled.
cancel
in class Stopwatch
public long getElapsedTime()
getElapsedTime
in class Stopwatch
public boolean isPaused()
isPaused
in class Stopwatch
true
if the Stopwatch has been pausedpublic boolean isStarted()
isStarted
in class Stopwatch
true
if the Stopwatch has been startedpublic boolean isStoped()
isStoped
in class Stopwatch
true
if the Stopwatch has been stoppedpublic void pause()
Stopwatch
pause
in class Stopwatch
public void resume()
Stopwatch
resume
in class Stopwatch
public void start()
Stopwatch
start
in class Stopwatch
public long stop()
Stopwatch
Stopwatch.start(Monitor)
cannot be re-used after stopped has been called.
stop
in class Stopwatch
public long stop(boolean canceled)
Stopwatch
stop
in class Stopwatch
public Stopwatch getFeature()
class
it exposes to the
monitored application.
getFeature
in interface Plugin<Stopwatch>
Plugin.getFeature()
public void setMonitoringEventBus(MonitoringEventBus bus)
setMonitoringEventBus
in interface Plugin<Stopwatch>
bus
- the event busPlugin.setMonitoringEventBus(org.jmonit.events.MonitoringEventBus)
public void setMonitor(Monitor monitor)
setMonitor
in interface Plugin<Stopwatch>
monitor
- the extended monitorPlugin.setMonitor(org.jmonit.Monitor)
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |