org.springframework.security.concurrent
Class DelegatingSecurityContextExecutorService

java.lang.Object
  extended by org.springframework.security.concurrent.DelegatingSecurityContextExecutor
      extended by 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
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.
 
Method Summary
 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)
           
 
Methods inherited from class org.springframework.security.concurrent.DelegatingSecurityContextExecutor
execute, getDelegateExecutor
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface java.util.concurrent.Executor
execute
 

Constructor Detail

DelegatingSecurityContextExecutorService

public DelegatingSecurityContextExecutorService(ExecutorService delegateExecutorService,
                                                SecurityContext securityContext)
Creates a new DelegatingSecurityContextExecutorService that uses the specified SecurityContext.

Parameters:
delegateExecutorService - the ExecutorService to delegate to. Cannot be null.
securityContext - the SecurityContext to use for each DelegatingSecurityContextRunnable and each DelegatingSecurityContextCallable.

DelegatingSecurityContextExecutorService

public DelegatingSecurityContextExecutorService(ExecutorService delegate)
Creates a new DelegatingSecurityContextExecutorService that uses the current SecurityContext from the SecurityContextHolder.

Parameters:
delegateTaskExecutor - the TaskExecutor to delegate to. Cannot be null.
Method Detail

shutdown

public final void shutdown()
Specified by:
shutdown in interface ExecutorService

shutdownNow

public final List<Runnable> shutdownNow()
Specified by:
shutdownNow in interface ExecutorService

isShutdown

public final boolean isShutdown()
Specified by:
isShutdown in interface ExecutorService

isTerminated

public final boolean isTerminated()
Specified by:
isTerminated in interface ExecutorService

awaitTermination

public final boolean awaitTermination(long timeout,
                                      TimeUnit unit)
                               throws InterruptedException
Specified by:
awaitTermination in interface ExecutorService
Throws:
InterruptedException

submit

public final <T> Future<T> submit(Callable<T> task)
Specified by:
submit in interface ExecutorService

submit

public final <T> Future<T> submit(Runnable task,
                                  T result)
Specified by:
submit in interface ExecutorService

submit

public final Future<?> submit(Runnable task)
Specified by:
submit in interface ExecutorService

invokeAll

public final List invokeAll(Collection tasks)
                     throws InterruptedException
Specified by:
invokeAll in interface ExecutorService
Throws:
InterruptedException

invokeAll

public final List invokeAll(Collection tasks,
                            long timeout,
                            TimeUnit unit)
                     throws InterruptedException
Specified by:
invokeAll in interface ExecutorService
Throws:
InterruptedException

invokeAny

public final Object invokeAny(Collection tasks)
                       throws InterruptedException,
                              ExecutionException
Specified by:
invokeAny in interface ExecutorService
Throws:
InterruptedException
ExecutionException

invokeAny

public final Object invokeAny(Collection tasks,
                              long timeout,
                              TimeUnit unit)
                       throws InterruptedException,
                              ExecutionException,
                              TimeoutException
Specified by:
invokeAny in interface ExecutorService
Throws:
InterruptedException
ExecutionException
TimeoutException

wrap

protected final Runnable wrap(Runnable delegate)

wrap

protected final <T> Callable<T> wrap(Callable<T> delegate)