public class DelegatingSecurityContextExecutorService extends DelegatingSecurityContextExecutor implements ExecutorService
ExecutorService
which wraps each Runnable
in a DelegatingSecurityContextRunnable
and each
Callable
in a DelegatingSecurityContextCallable
.Constructor and Description |
---|
DelegatingSecurityContextExecutorService(ExecutorService delegate)
Creates a new
DelegatingSecurityContextExecutorService that uses the current SecurityContext from
the SecurityContextHolder . |
DelegatingSecurityContextExecutorService(ExecutorService delegateExecutorService,
SecurityContext securityContext)
Creates a new
DelegatingSecurityContextExecutorService that uses the specified SecurityContext . |
Modifier and Type | Method and Description |
---|---|
boolean |
awaitTermination(long timeout,
TimeUnit unit) |
List |
invokeAll(Collection tasks) |
List |
invokeAll(Collection tasks,
long timeout,
TimeUnit unit) |
Object |
invokeAny(Collection tasks) |
Object |
invokeAny(Collection tasks,
long timeout,
TimeUnit unit) |
boolean |
isShutdown() |
boolean |
isTerminated() |
void |
shutdown() |
List<Runnable> |
shutdownNow() |
<T> Future<T> |
submit(Callable<T> task) |
Future<?> |
submit(Runnable task) |
<T> Future<T> |
submit(Runnable task,
T result) |
protected <T> Callable<T> |
wrap(Callable<T> delegate) |
protected Runnable |
wrap(Runnable delegate) |
execute, getDelegateExecutor
public DelegatingSecurityContextExecutorService(ExecutorService delegateExecutorService, SecurityContext securityContext)
DelegatingSecurityContextExecutorService
that uses the specified SecurityContext
.delegateExecutorService
- the ExecutorService
to delegate to. Cannot be null.securityContext
- the SecurityContext
to use for each DelegatingSecurityContextRunnable
and
each DelegatingSecurityContextCallable
.public DelegatingSecurityContextExecutorService(ExecutorService delegate)
DelegatingSecurityContextExecutorService
that uses the current SecurityContext
from
the SecurityContextHolder
.delegateTaskExecutor
- the TaskExecutor
to delegate to. Cannot be null.public final void shutdown()
shutdown
in interface ExecutorService
public final List<Runnable> shutdownNow()
shutdownNow
in interface ExecutorService
public final boolean isShutdown()
isShutdown
in interface ExecutorService
public final boolean isTerminated()
isTerminated
in interface ExecutorService
public final boolean awaitTermination(long timeout, TimeUnit unit) throws InterruptedException
awaitTermination
in interface ExecutorService
InterruptedException
public final <T> Future<T> submit(Callable<T> task)
submit
in interface ExecutorService
public final <T> Future<T> submit(Runnable task, T result)
submit
in interface ExecutorService
public final Future<?> submit(Runnable task)
submit
in interface ExecutorService
public final List invokeAll(Collection tasks) throws InterruptedException
invokeAll
in interface ExecutorService
InterruptedException
public final List invokeAll(Collection tasks, long timeout, TimeUnit unit) throws InterruptedException
invokeAll
in interface ExecutorService
InterruptedException
public final Object invokeAny(Collection tasks) throws InterruptedException, ExecutionException
invokeAny
in interface ExecutorService
InterruptedException
ExecutionException
public final Object invokeAny(Collection tasks, long timeout, TimeUnit unit) throws InterruptedException, ExecutionException, TimeoutException
invokeAny
in interface ExecutorService
InterruptedException
ExecutionException
TimeoutException