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
ConstructorsConstructorDescriptionStatsExecutor(String serviceName) StatsExecutor(String serviceName, long samplingTime) -
Method Summary
Modifier and TypeMethodDescriptionprotected booleandoStats()Checks ifgetSamplingTime()has passed.voidRuns the action, intercepts anyExceptionit generates. increasegetTotalCalls()and, if there is an exception,getFailedCalls()too.protected intThis is reset everygetSamplingTime()ms.intThis is updated everygetSamplingTime()intThis is updated everygetSamplingTime()longStatistics are logged and then reset every this amount of time, in ms.protected intThis is reset everygetSamplingTime()ms.booleansetPopUpExceptions(boolean popUpExceptions) voidsetSamplingTime(long samplingTime)
-
Constructor Details
-
StatsExecutor
-
StatsExecutor
-
-
Method Details
-
execute
Runs the action, intercepts anyExceptionit 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()- See Also:
-
setPopUpExceptions
-
getSamplingTime
public long getSamplingTime()Statistics are logged and then reset every this amount of time, in ms. -
setSamplingTime
public void setSamplingTime(long samplingTime)
-