org.springframework.security.concurrent
Class DelegatingSecurityContextExecutor

java.lang.Object
  extended by org.springframework.security.concurrent.DelegatingSecurityContextExecutor
All Implemented Interfaces:
Executor
Direct Known Subclasses:
DelegatingSecurityContextExecutorService, DelegatingSecurityContextTaskExecutor

public class DelegatingSecurityContextExecutor
extends Object
implements Executor

An Executor which wraps each Runnable in a DelegatingSecurityContextRunnable.

Since:
3.2

Constructor Summary
DelegatingSecurityContextExecutor(Executor delegate)
          Creates a new DelegatingSecurityContextExecutor that uses the current SecurityContext from the SecurityContextHolder at the time the task is submitted.
DelegatingSecurityContextExecutor(Executor delegateExecutor, SecurityContext securityContext)
          Creates a new DelegatingSecurityContextExecutor that uses the specified SecurityContext.
 
Method Summary
 void execute(Runnable task)
           
protected  Executor getDelegateExecutor()
           
protected
<T> Callable<T>
wrap(Callable<T> delegate)
           
protected  Runnable wrap(Runnable delegate)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DelegatingSecurityContextExecutor

public DelegatingSecurityContextExecutor(Executor delegateExecutor,
                                         SecurityContext securityContext)
Creates a new DelegatingSecurityContextExecutor that uses the specified SecurityContext.

Parameters:
delegateExecutor - the Executor to delegate to. Cannot be null.
securityContext - the SecurityContext to use for each DelegatingSecurityContextRunnable or null to default to the current SecurityContext

DelegatingSecurityContextExecutor

public DelegatingSecurityContextExecutor(Executor delegate)
Creates a new DelegatingSecurityContextExecutor that uses the current SecurityContext from the SecurityContextHolder at the time the task is submitted.

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

execute

public final void execute(Runnable task)
Specified by:
execute in interface Executor

getDelegateExecutor

protected final Executor getDelegateExecutor()

wrap

protected final Runnable wrap(Runnable delegate)

wrap

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