java.util.concurrent.Executor, java.util.concurrent.ExecutorServiceBlockingThreadPoolExecutorService@Private
public class SemaphoredDelegatingExecutor
extends org.apache.hadoop.thirdparty.com.google.common.util.concurrent.ForwardingExecutorService
This is a refactoring of BlockingThreadPoolExecutorService; that code
contains the thread pool logic, whereas this isolates the semaphore
and submit logic for use with other thread pools and delegation models.
This is inspired by this s4 threadpool
| Constructor | Description |
|---|---|
SemaphoredDelegatingExecutor(java.util.concurrent.ExecutorService executorDelegatee,
int permitCount,
boolean fair) |
Instantiate without collecting executor aquisition duration information.
|
SemaphoredDelegatingExecutor(java.util.concurrent.ExecutorService executorDelegatee,
int permitCount,
boolean fair,
DurationTrackerFactory trackerFactory) |
Instantiate.
|
| Modifier and Type | Method | Description |
|---|---|---|
protected java.util.concurrent.ExecutorService |
delegate() |
|
void |
execute(java.lang.Runnable command) |
|
int |
getAvailablePermits() |
Get the number of permits available; guaranteed to be
0 <= availablePermits <= size. |
int |
getPermitCount() |
Total number of permits.
|
int |
getWaitingCount() |
Get the number of threads waiting to acquire a permit.
|
<T> java.util.List<java.util.concurrent.Future<T>> |
invokeAll(java.util.Collection<? extends java.util.concurrent.Callable<T>> tasks) |
|
<T> java.util.List<java.util.concurrent.Future<T>> |
invokeAll(java.util.Collection<? extends java.util.concurrent.Callable<T>> tasks,
long timeout,
java.util.concurrent.TimeUnit unit) |
|
<T> T |
invokeAny(java.util.Collection<? extends java.util.concurrent.Callable<T>> tasks) |
|
<T> T |
invokeAny(java.util.Collection<? extends java.util.concurrent.Callable<T>> tasks,
long timeout,
java.util.concurrent.TimeUnit unit) |
|
java.util.concurrent.Future<?> |
submit(java.lang.Runnable task) |
|
<T> java.util.concurrent.Future<T> |
submit(java.lang.Runnable task,
T result) |
|
<T> java.util.concurrent.Future<T> |
submit(java.util.concurrent.Callable<T> task) |
|
java.lang.String |
toString() |
public SemaphoredDelegatingExecutor(java.util.concurrent.ExecutorService executorDelegatee,
int permitCount,
boolean fair,
DurationTrackerFactory trackerFactory)
executorDelegatee - Executor to delegate topermitCount - number of permits into the queue permittedfair - should the semaphore be "fair"trackerFactory - duration tracker factory.public SemaphoredDelegatingExecutor(java.util.concurrent.ExecutorService executorDelegatee,
int permitCount,
boolean fair)
executorDelegatee - Executor to delegate topermitCount - number of permits into the queue permittedfair - should the semaphore be "fair"protected java.util.concurrent.ExecutorService delegate()
delegate in class org.apache.hadoop.thirdparty.com.google.common.util.concurrent.ForwardingExecutorServicepublic <T> java.util.List<java.util.concurrent.Future<T>> invokeAll(java.util.Collection<? extends java.util.concurrent.Callable<T>> tasks)
throws java.lang.InterruptedException
invokeAll in interface java.util.concurrent.ExecutorServiceinvokeAll in class org.apache.hadoop.thirdparty.com.google.common.util.concurrent.ForwardingExecutorServicejava.lang.InterruptedExceptionpublic <T> java.util.List<java.util.concurrent.Future<T>> invokeAll(java.util.Collection<? extends java.util.concurrent.Callable<T>> tasks,
long timeout,
java.util.concurrent.TimeUnit unit)
throws java.lang.InterruptedException
invokeAll in interface java.util.concurrent.ExecutorServiceinvokeAll in class org.apache.hadoop.thirdparty.com.google.common.util.concurrent.ForwardingExecutorServicejava.lang.InterruptedExceptionpublic <T> T invokeAny(java.util.Collection<? extends java.util.concurrent.Callable<T>> tasks)
throws java.lang.InterruptedException,
java.util.concurrent.ExecutionException
invokeAny in interface java.util.concurrent.ExecutorServiceinvokeAny in class org.apache.hadoop.thirdparty.com.google.common.util.concurrent.ForwardingExecutorServicejava.lang.InterruptedExceptionjava.util.concurrent.ExecutionExceptionpublic <T> T invokeAny(java.util.Collection<? extends java.util.concurrent.Callable<T>> tasks,
long timeout,
java.util.concurrent.TimeUnit unit)
throws java.lang.InterruptedException,
java.util.concurrent.ExecutionException,
java.util.concurrent.TimeoutException
invokeAny in interface java.util.concurrent.ExecutorServiceinvokeAny in class org.apache.hadoop.thirdparty.com.google.common.util.concurrent.ForwardingExecutorServicejava.lang.InterruptedExceptionjava.util.concurrent.ExecutionExceptionjava.util.concurrent.TimeoutExceptionpublic <T> java.util.concurrent.Future<T> submit(java.util.concurrent.Callable<T> task)
submit in interface java.util.concurrent.ExecutorServicesubmit in class org.apache.hadoop.thirdparty.com.google.common.util.concurrent.ForwardingExecutorServicepublic <T> java.util.concurrent.Future<T> submit(java.lang.Runnable task,
T result)
submit in interface java.util.concurrent.ExecutorServicesubmit in class org.apache.hadoop.thirdparty.com.google.common.util.concurrent.ForwardingExecutorServicepublic java.util.concurrent.Future<?> submit(java.lang.Runnable task)
submit in interface java.util.concurrent.ExecutorServicesubmit in class org.apache.hadoop.thirdparty.com.google.common.util.concurrent.ForwardingExecutorServicepublic void execute(java.lang.Runnable command)
execute in interface java.util.concurrent.Executorexecute in class org.apache.hadoop.thirdparty.com.google.common.util.concurrent.ForwardingExecutorServicepublic int getAvailablePermits()
0 <= availablePermits <= size.public int getWaitingCount()
public int getPermitCount()
public java.lang.String toString()
toString in class org.apache.hadoop.thirdparty.com.google.common.collect.ForwardingObjectCopyright © 2008–2025 Apache Software Foundation. All rights reserved.