Package com.adobe.acs.commons.fam
Interface ThrottledTaskRunner
- All Superinterfaces:
ThrottledTaskRunnerMBean
In addition to MBean operations, a ThrottledTaskRunner lets the caller schedule work and provides a throttle method.
The logCompletion method should also allow a runnable action provide appropriate notification of success/failure
-
Method Summary
Modifier and TypeMethodDescriptionintGet number of maximum threads supported by this thread managervoidlogCompletion(long created, long started, long executed, long finished, boolean successful, Throwable error) Record statisticsvoidscheduleWork(Runnable work) Schedule some kind of work to run in the future using the internal thread pool.voidscheduleWork(Runnable work, int priority) Schedule some kind of work to run in the future using the internal thread pool.voidscheduleWork(Runnable work, CancelHandler cancelHandler) Schedule some kind of work to run in the future using the internal thread pool.voidscheduleWork(Runnable work, CancelHandler cancelHandler, int priority) Schedule some kind of work to run in the future using the internal thread pool.voidWaits for CPU and Memory usage to fall below an acceptable threshold.Methods inherited from interface com.adobe.acs.commons.fam.mbean.ThrottledTaskRunnerMBean
clearProcessingStatistics, getActiveCount, getCompletedTaskCount, getStatistics, getTaskCount, isRunning, pauseExecution, resumeExecution, setThreadPoolSize, stopExecution
-
Method Details
-
waitForLowCpuAndLowMemory
Waits for CPU and Memory usage to fall below an acceptable threshold. NEVER call this inside a critical section as it will result in sluggish lock contention. Only call this BEFORE starting a critical section.- Throws:
InterruptedException- If the thread was interrupted
-
scheduleWork
Schedule some kind of work to run in the future using the internal thread pool. The work will be throttled according to the CPU/Memory settings- Parameters:
work-
-
scheduleWork
Schedule some kind of work to run in the future using the internal thread pool. The work will be throttled according to the CPU/Memory settings. This action can be canceled at any time.- Parameters:
work-cancelHandler-
-
scheduleWork
Schedule some kind of work to run in the future using the internal thread pool. The work will be throttled according to the CPU/Memory settings- Parameters:
work-priority- the priority of the task
-
scheduleWork
Schedule some kind of work to run in the future using the internal thread pool. The work will be throttled according to the CPU/Memory settings. This action can be canceled at any time.- Parameters:
work-cancelHandler-priority- the priority of the task
-
logCompletion
void logCompletion(long created, long started, long executed, long finished, boolean successful, Throwable error) Record statistics- Parameters:
created- Task creation time (Milliseconds since epoch) -- This is when the work is added to the queuestarted- Start time (Milliseconds since epoch) -- This is recorded when the work is picked up by a threadexecuted- Execution time (Milliseconds since epoch) -- this is recorded after CPU/Memory throttle completesfinished- Finish time (Milliseconds since epoch) -- This is recorded when work finishes (or throws an error)successful- If true, action concluded normallyerror- Exception caught, if any.
-
getMaxThreads
int getMaxThreads()Get number of maximum threads supported by this thread manager- Returns:
- Thread pool maximum size
-