Package org.springframework.security.concurrent

# 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

Constructors
Constructor
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`.

## Method Summary

Modifier and Type
Method
Description
`final 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`
`isShutdown()`
`final boolean`
`isTerminated()`
`final void`
`shutdown()`
`final List<Runnable>`
`shutdownNow()`
`final Future<?>`
`submit(Runnable task)`
`final <T> Future<T>`
`submit(Runnable task, T result)`
`final <T> Future<T>`
`submit(Callable<T> task)`
`protected final Runnable`
`wrap(Runnable delegate)`
`protected final <T> Callable<T>`
`wrap(Callable<T> delegate)`

### Methods inherited from class org.springframework.security.concurrent.DelegatingSecurityContextExecutor

`execute, getDelegateExecutor, setSecurityContextHolderStrategy`

### 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 Details

### 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:
  `delegate` - the `ExecutorService` to delegate to. Cannot be null.

## Method Details

### 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)