Class DelegatingSecurityContextExecutorService
- java.lang.Object
-
- org.springframework.security.concurrent.DelegatingSecurityContextExecutor
-
- org.springframework.security.concurrent.DelegatingSecurityContextExecutorService
-
- All Implemented Interfaces:
java.util.concurrent.Executor
,java.util.concurrent.ExecutorService
- Direct Known Subclasses:
DelegatingSecurityContextScheduledExecutorService
public class DelegatingSecurityContextExecutorService extends DelegatingSecurityContextExecutor implements java.util.concurrent.ExecutorService
AnExecutorService
which wraps eachRunnable
in aDelegatingSecurityContextRunnable
and eachCallable
in aDelegatingSecurityContextCallable
.- Since:
- 3.2
-
-
Constructor Summary
Constructors Constructor Description DelegatingSecurityContextExecutorService(java.util.concurrent.ExecutorService delegate)
Creates a newDelegatingSecurityContextExecutorService
that uses the currentSecurityContext
from theSecurityContextHolder
.DelegatingSecurityContextExecutorService(java.util.concurrent.ExecutorService delegateExecutorService, SecurityContext securityContext)
Creates a newDelegatingSecurityContextExecutorService
that uses the specifiedSecurityContext
.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description boolean
awaitTermination(long timeout, java.util.concurrent.TimeUnit unit)
java.util.List
invokeAll(java.util.Collection tasks)
java.util.List
invokeAll(java.util.Collection tasks, long timeout, java.util.concurrent.TimeUnit unit)
java.lang.Object
invokeAny(java.util.Collection tasks)
java.lang.Object
invokeAny(java.util.Collection tasks, long timeout, java.util.concurrent.TimeUnit unit)
boolean
isShutdown()
boolean
isTerminated()
void
shutdown()
java.util.List<java.lang.Runnable>
shutdownNow()
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)
protected java.lang.Runnable
wrap(java.lang.Runnable delegate)
protected <T> java.util.concurrent.Callable<T>
wrap(java.util.concurrent.Callable<T> delegate)
-
Methods inherited from class org.springframework.security.concurrent.DelegatingSecurityContextExecutor
execute, getDelegateExecutor
-
-
-
-
Constructor Detail
-
DelegatingSecurityContextExecutorService
public DelegatingSecurityContextExecutorService(java.util.concurrent.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
public DelegatingSecurityContextExecutorService(java.util.concurrent.ExecutorService delegate)
Creates a newDelegatingSecurityContextExecutorService
that uses the currentSecurityContext
from theSecurityContextHolder
.- Parameters:
delegate
- theExecutorService
to delegate to. Cannot be null.
-
-
Method Detail
-
shutdown
public final void shutdown()
- Specified by:
shutdown
in interfacejava.util.concurrent.ExecutorService
-
shutdownNow
public final java.util.List<java.lang.Runnable> shutdownNow()
- Specified by:
shutdownNow
in interfacejava.util.concurrent.ExecutorService
-
isShutdown
public final boolean isShutdown()
- Specified by:
isShutdown
in interfacejava.util.concurrent.ExecutorService
-
isTerminated
public final boolean isTerminated()
- Specified by:
isTerminated
in interfacejava.util.concurrent.ExecutorService
-
awaitTermination
public final boolean awaitTermination(long timeout, java.util.concurrent.TimeUnit unit) throws java.lang.InterruptedException
- Specified by:
awaitTermination
in interfacejava.util.concurrent.ExecutorService
- Throws:
java.lang.InterruptedException
-
submit
public final <T> java.util.concurrent.Future<T> submit(java.util.concurrent.Callable<T> task)
- Specified by:
submit
in interfacejava.util.concurrent.ExecutorService
-
submit
public final <T> java.util.concurrent.Future<T> submit(java.lang.Runnable task, T result)
- Specified by:
submit
in interfacejava.util.concurrent.ExecutorService
-
submit
public final java.util.concurrent.Future<?> submit(java.lang.Runnable task)
- Specified by:
submit
in interfacejava.util.concurrent.ExecutorService
-
invokeAll
public final java.util.List invokeAll(java.util.Collection tasks) throws java.lang.InterruptedException
- Specified by:
invokeAll
in interfacejava.util.concurrent.ExecutorService
- Throws:
java.lang.InterruptedException
-
invokeAll
public final java.util.List invokeAll(java.util.Collection tasks, long timeout, java.util.concurrent.TimeUnit unit) throws java.lang.InterruptedException
- Specified by:
invokeAll
in interfacejava.util.concurrent.ExecutorService
- Throws:
java.lang.InterruptedException
-
invokeAny
public final java.lang.Object invokeAny(java.util.Collection tasks) throws java.lang.InterruptedException, java.util.concurrent.ExecutionException
- Specified by:
invokeAny
in interfacejava.util.concurrent.ExecutorService
- Throws:
java.lang.InterruptedException
java.util.concurrent.ExecutionException
-
invokeAny
public final java.lang.Object invokeAny(java.util.Collection tasks, long timeout, java.util.concurrent.TimeUnit unit) throws java.lang.InterruptedException, java.util.concurrent.ExecutionException, java.util.concurrent.TimeoutException
- Specified by:
invokeAny
in interfacejava.util.concurrent.ExecutorService
- Throws:
java.lang.InterruptedException
java.util.concurrent.ExecutionException
java.util.concurrent.TimeoutException
-
wrap
protected final java.lang.Runnable wrap(java.lang.Runnable delegate)
-
wrap
protected final <T> java.util.concurrent.Callable<T> wrap(java.util.concurrent.Callable<T> delegate)
-
-