Package uk.ac.ebi.utils.runcontrol
Class StatsExecutor
java.lang.Object
uk.ac.ebi.utils.runcontrol.StatsExecutor
- All Implemented Interfaces:
Executor
An executor that logs statistics on the executions it receives to run.
- Author:
- brandizi
- Date:
- 5 Oct 2015
-
Constructor Summary
ConstructorDescriptionStatsExecutor
(String serviceName) StatsExecutor
(String serviceName, long samplingTime) -
Method Summary
Modifier and TypeMethodDescriptionprotected boolean
doStats()
Checks ifgetSamplingTime()
has passed.void
Runs the action, intercepts anyException
it generates. increasegetTotalCalls()
and, if there is an exception,getFailedCalls()
too.protected int
This is reset everygetSamplingTime()
ms.int
This is updated everygetSamplingTime()
int
This is updated everygetSamplingTime()
long
Statistics are logged and then reset every this amount of time, in ms.protected int
This is reset everygetSamplingTime()
ms.boolean
setPopUpExceptions
(boolean popUpExceptions) void
setSamplingTime
(long samplingTime)
-
Constructor Details
-
StatsExecutor
-
StatsExecutor
-
-
Method Details
-
execute
Runs the action, intercepts anyException
it generates. increasegetTotalCalls()
and, if there is an exception,getFailedCalls()
too. Eventually invokesdoStats()
. IfisPopUpExceptions()
exceptions are let to reach the invoker. -
doStats
protected boolean doStats()Checks ifgetSamplingTime()
has passed. If yes, logs statistics on recorded calls/min and failed calls. -
getTotalCalls
protected int getTotalCalls()This is reset everygetSamplingTime()
ms. -
getFailedCalls
protected int getFailedCalls()This is reset everygetSamplingTime()
ms. -
getLastTotalCalls
public int getLastTotalCalls()This is updated everygetSamplingTime()
-
getLastFailedCalls
public int getLastFailedCalls()This is updated everygetSamplingTime()
-
isPopUpExceptions
public boolean isPopUpExceptions() -
setPopUpExceptions
-
getSamplingTime
public long getSamplingTime()Statistics are logged and then reset every this amount of time, in ms. -
setSamplingTime
public void setSamplingTime(long samplingTime)
-