Package com.arpnetworking.utility
Class InstrumentingPoolAdapter
java.lang.Object
java.util.concurrent.AbstractExecutorService
java.util.concurrent.ForkJoinPool
com.arpnetworking.utility.InstrumentingPoolAdapter
- All Implemented Interfaces:
Executor
,ExecutorService
An adapter used to facilitate the instrumentation of work pools. Allows for the use of
functions that measure the state of the pool, but will throw an exception on any methods
that submit work units or query work units.
- Author:
- Brandon Arp (brandon dot arp at smartsheet dot com), Ville Koskela (ville dot koskela at inscopemetrics dot io)
-
Nested Class Summary
Nested classes/interfaces inherited from class java.util.concurrent.ForkJoinPool
ForkJoinPool.ForkJoinWorkerThreadFactory, ForkJoinPool.ManagedBlocker
-
Field Summary
Fields inherited from class java.util.concurrent.ForkJoinPool
defaultForkJoinWorkerThreadFactory
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionboolean
awaitQuiescence
(long timeout, TimeUnit unit) boolean
awaitTermination
(long timeout, TimeUnit unit) protected int
drainTasksTo
(Collection<? super ForkJoinTask<?>> c) void
void
execute
(ForkJoinTask<?> task) abstract int
boolean
abstract int
abstract int
abstract int
abstract long
abstract int
abstract long
abstract boolean
<T> T
invoke
(ForkJoinTask<T> task) invokeAll
(Collection<? extends Callable<T>> tasks) invokeAll
(Collection<? extends Callable<T>> tasks, long timeout, TimeUnit unit) <T> T
invokeAny
(Collection<? extends Callable<T>> tasks) <T> T
invokeAny
(Collection<? extends Callable<T>> tasks, long timeout, TimeUnit unit) abstract boolean
boolean
boolean
boolean
protected <T> RunnableFuture<T>
newTaskFor
(Runnable runnable, T value) protected <T> RunnableFuture<T>
newTaskFor
(Callable<T> callable) protected ForkJoinTask<?>
void
shutdown()
ForkJoinTask<?>
<T> ForkJoinTask<T>
<T> ForkJoinTask<T>
<T> ForkJoinTask<T>
submit
(ForkJoinTask<T> task) abstract String
toString()
Methods inherited from class java.util.concurrent.ForkJoinPool
commonPool, getCommonPoolParallelism, managedBlock
-
Constructor Details
-
InstrumentingPoolAdapter
public InstrumentingPoolAdapter()
-
-
Method Details
-
invoke
- Overrides:
invoke
in classForkJoinPool
-
execute
- Overrides:
execute
in classForkJoinPool
-
execute
- Specified by:
execute
in interfaceExecutor
- Overrides:
execute
in classForkJoinPool
-
submit
- Overrides:
submit
in classForkJoinPool
-
submit
- Specified by:
submit
in interfaceExecutorService
- Overrides:
submit
in classForkJoinPool
-
invokeAny
public <T> T invokeAny(Collection<? extends Callable<T>> tasks) throws InterruptedException, ExecutionException - Specified by:
invokeAny
in interfaceExecutorService
- Overrides:
invokeAny
in classForkJoinPool
- Throws:
InterruptedException
ExecutionException
-
invokeAny
public <T> T invokeAny(Collection<? extends Callable<T>> tasks, long timeout, TimeUnit unit) throws InterruptedException, ExecutionException, TimeoutException - Specified by:
invokeAny
in interfaceExecutorService
- Overrides:
invokeAny
in classForkJoinPool
- Throws:
InterruptedException
ExecutionException
TimeoutException
-
submit
- Specified by:
submit
in interfaceExecutorService
- Overrides:
submit
in classForkJoinPool
-
submit
- Specified by:
submit
in interfaceExecutorService
- Overrides:
submit
in classForkJoinPool
-
invokeAll
- Specified by:
invokeAll
in interfaceExecutorService
- Overrides:
invokeAll
in classForkJoinPool
-
invokeAll
public <T> List<Future<T>> invokeAll(Collection<? extends Callable<T>> tasks, long timeout, TimeUnit unit) throws InterruptedException - Specified by:
invokeAll
in interfaceExecutorService
- Overrides:
invokeAll
in classForkJoinPool
- Throws:
InterruptedException
-
getFactory
- Overrides:
getFactory
in classForkJoinPool
-
getUncaughtExceptionHandler
- Overrides:
getUncaughtExceptionHandler
in classForkJoinPool
-
getAsyncMode
public boolean getAsyncMode()- Overrides:
getAsyncMode
in classForkJoinPool
-
shutdown
public void shutdown()- Specified by:
shutdown
in interfaceExecutorService
- Overrides:
shutdown
in classForkJoinPool
-
shutdownNow
- Specified by:
shutdownNow
in interfaceExecutorService
- Overrides:
shutdownNow
in classForkJoinPool
-
isTerminated
public boolean isTerminated()- Specified by:
isTerminated
in interfaceExecutorService
- Overrides:
isTerminated
in classForkJoinPool
-
isTerminating
public boolean isTerminating()- Overrides:
isTerminating
in classForkJoinPool
-
isShutdown
public boolean isShutdown()- Specified by:
isShutdown
in interfaceExecutorService
- Overrides:
isShutdown
in classForkJoinPool
-
awaitTermination
- Specified by:
awaitTermination
in interfaceExecutorService
- Overrides:
awaitTermination
in classForkJoinPool
- Throws:
InterruptedException
-
awaitQuiescence
- Overrides:
awaitQuiescence
in classForkJoinPool
-
getParallelism
public abstract int getParallelism()- Overrides:
getParallelism
in classForkJoinPool
-
getPoolSize
public abstract int getPoolSize()- Overrides:
getPoolSize
in classForkJoinPool
-
getRunningThreadCount
public abstract int getRunningThreadCount()- Overrides:
getRunningThreadCount
in classForkJoinPool
-
getActiveThreadCount
public abstract int getActiveThreadCount()- Overrides:
getActiveThreadCount
in classForkJoinPool
-
isQuiescent
public abstract boolean isQuiescent()- Overrides:
isQuiescent
in classForkJoinPool
-
getStealCount
public abstract long getStealCount()- Overrides:
getStealCount
in classForkJoinPool
-
getQueuedTaskCount
public abstract long getQueuedTaskCount()- Overrides:
getQueuedTaskCount
in classForkJoinPool
-
getQueuedSubmissionCount
public abstract int getQueuedSubmissionCount()- Overrides:
getQueuedSubmissionCount
in classForkJoinPool
-
hasQueuedSubmissions
public abstract boolean hasQueuedSubmissions()- Overrides:
hasQueuedSubmissions
in classForkJoinPool
-
toString
- Overrides:
toString
in classForkJoinPool
-
pollSubmission
- Overrides:
pollSubmission
in classForkJoinPool
-
drainTasksTo
- Overrides:
drainTasksTo
in classForkJoinPool
-
newTaskFor
- Overrides:
newTaskFor
in classForkJoinPool
-
newTaskFor
- Overrides:
newTaskFor
in classForkJoinPool
-