public interface StatisticExecutor extends SubmitterExecutor
Modifier and Type | Method and Description |
---|---|
double |
getAverageExecutionDelay()
This reports the rolling average delay from when a task was expected to run, till when the
executor actually started the task.
|
double |
getAverageExecutionDuration()
Get the average duration that tasks submitted through this executor have spent executing.
|
java.util.Map<java.lang.Double,java.lang.Long> |
getExecutionDelayPercentiles(double... percentiles)
Gets percentile values for execution delays.
|
java.util.List<java.lang.Long> |
getExecutionDelaySamples()
Get raw sample data for task execution delays.
|
java.util.Map<java.lang.Double,java.lang.Long> |
getExecutionDurationPercentiles(double... percentiles)
Gets percentile values for execution duration.
|
java.util.List<java.lang.Long> |
getExecutionDurationSamples()
Get raw sample data for task run durations.
|
java.util.List<Pair<java.lang.Runnable,java.lang.StackTraceElement[]>> |
getLongRunningTasks(long durationLimitMillis)
Call to get a list of runnables and stack traces from tasks which have been actively
executing for a longer duration than the one provided.
|
int |
getLongRunningTasksQty(long durationLimitMillis)
Call to return the number of tasks which have been running longer than the provided duration
in milliseconds.
|
int |
getQueuedTaskCount()
Returns how many tasks are either waiting to be executed, or are scheduled to be executed at
a future point.
|
long |
getTotalExecutionCount()
Call to get the total quantity of tasks this executor has handled.
|
void |
resetCollectedStats()
Clears all collected rolling statistics.
|
submit, submit, submit
int getQueuedTaskCount()
java.util.List<java.lang.Long> getExecutionDelaySamples()
StatisticsUtils
for additional statistics.double getAverageExecutionDelay()
-1
if no samples have been
collected yet.java.util.Map<java.lang.Double,java.lang.Long> getExecutionDelayPercentiles(double... percentiles)
The returned map's keys correspond exactly to the percentiles provided. Iterating over the returned map will iterate in order of the requested percentiles as well.
percentiles
- Percentiles requested, any decimal values between 0 and 100 (inclusive)java.util.List<java.lang.Long> getExecutionDurationSamples()
StatisticsUtils
for additional statistics.double getAverageExecutionDuration()
java.util.Map<java.lang.Double,java.lang.Long> getExecutionDurationPercentiles(double... percentiles)
The returned map's keys correspond exactly to the percentiles provided. Iterating over the returned map will iterate in order of the requested percentiles as well.
percentiles
- Percentiles requested, any decimal values between 0 and 100 (inclusive)java.util.List<Pair<java.lang.Runnable,java.lang.StackTraceElement[]>> getLongRunningTasks(long durationLimitMillis)
If only the quantity of long running tasks is needed, please use
getLongRunningTasksQty(long)
. Since it does not need to generate stack traces it is
a cheaper alternative.
The left side of the Pair
is the runnable task submitted. If the task was submitted
as a Callable
the Runnable will be of type:
ListenableFutureTask
. Casting and invoking
ListenableFutureTask.getContainedCallable()
will allow
you to get to your original Callable
.
The right side of the Pair
is a single sample of what that long running tasks stack
was. Because these tasks are running concurrently by the time this function returns the
provided tasks may have completed.
durationLimitMillis
- Limit for tasks execution, if task execution time is below this they will be ignoredint getLongRunningTasksQty(long durationLimitMillis)
durationLimitMillis
- threshold of time in milliseconds a task must have been executinglong getTotalExecutionCount()
void resetCollectedStats()
This does NOT reset the total execution counts.