Class DelegatingSecurityContextExecutorService
java.lang.Object
org.springframework.security.concurrent.DelegatingSecurityContextExecutor
org.springframework.security.concurrent.DelegatingSecurityContextExecutorService
- All Implemented Interfaces:
Executor
,ExecutorService
- Direct Known Subclasses:
DelegatingSecurityContextScheduledExecutorService
public class DelegatingSecurityContextExecutorService
extends DelegatingSecurityContextExecutor
implements ExecutorService
An
ExecutorService
which wraps each Runnable
in a
DelegatingSecurityContextRunnable
and each Callable
in a
DelegatingSecurityContextCallable
.- Since:
- 3.2
-
Constructor Summary
ConstructorDescriptionCreates a newDelegatingSecurityContextExecutorService
that uses the currentSecurityContext
from theSecurityContextHolder
.DelegatingSecurityContextExecutorService
(ExecutorService delegateExecutorService, SecurityContext securityContext) Creates a newDelegatingSecurityContextExecutorService
that uses the specifiedSecurityContext
. -
Method Summary
Modifier and TypeMethodDescriptionfinal boolean
awaitTermination
(long timeout, TimeUnit unit) final List
invokeAll
(Collection tasks) final List
invokeAll
(Collection tasks, long timeout, TimeUnit unit) final Object
invokeAny
(Collection tasks) final Object
invokeAny
(Collection tasks, long timeout, TimeUnit unit) final boolean
final boolean
final void
shutdown()
final Future<?>
final <T> Future<T>
final <T> Future<T>
protected final Runnable
protected final <T> Callable<T>
Methods inherited from class org.springframework.security.concurrent.DelegatingSecurityContextExecutor
execute, getDelegateExecutor, setSecurityContextHolderStrategy
-
Constructor Details
-
DelegatingSecurityContextExecutorService
public DelegatingSecurityContextExecutorService(ExecutorService delegateExecutorService, SecurityContext securityContext) Creates a newDelegatingSecurityContextExecutorService
that uses the specifiedSecurityContext
.- Parameters:
delegateExecutorService
- theExecutorService
to delegate to. Cannot be null.securityContext
- theSecurityContext
to use for eachDelegatingSecurityContextRunnable
and eachDelegatingSecurityContextCallable
.
-
DelegatingSecurityContextExecutorService
Creates a newDelegatingSecurityContextExecutorService
that uses the currentSecurityContext
from theSecurityContextHolder
.- Parameters:
delegate
- theExecutorService
to delegate to. Cannot be null.
-
-
Method Details
-
shutdown
public final void shutdown()- Specified by:
shutdown
in interfaceExecutorService
-
shutdownNow
- Specified by:
shutdownNow
in interfaceExecutorService
-
isShutdown
public final boolean isShutdown()- Specified by:
isShutdown
in interfaceExecutorService
-
isTerminated
public final boolean isTerminated()- Specified by:
isTerminated
in interfaceExecutorService
-
awaitTermination
- Specified by:
awaitTermination
in interfaceExecutorService
- Throws:
InterruptedException
-
submit
- Specified by:
submit
in interfaceExecutorService
-
submit
- Specified by:
submit
in interfaceExecutorService
-
submit
- Specified by:
submit
in interfaceExecutorService
-
invokeAll
- Specified by:
invokeAll
in interfaceExecutorService
- Throws:
InterruptedException
-
invokeAll
public final List invokeAll(Collection tasks, long timeout, TimeUnit unit) throws InterruptedException - Specified by:
invokeAll
in interfaceExecutorService
- Throws:
InterruptedException
-
invokeAny
- Specified by:
invokeAny
in interfaceExecutorService
- Throws:
InterruptedException
ExecutionException
-
invokeAny
public final Object invokeAny(Collection tasks, long timeout, TimeUnit unit) throws InterruptedException, ExecutionException, TimeoutException - Specified by:
invokeAny
in interfaceExecutorService
- Throws:
InterruptedException
ExecutionException
TimeoutException
-
wrap
-
wrap
-