com.atlassian.sal.api.executor
Interface ThreadLocalDelegateExecutorFactory


public interface ThreadLocalDelegateExecutorFactory

Factory to create Executor instances that delegate to a specific Executor and ensure the executed code runs in the same thread local context.

Since:
2.0

Method Summary
<T> Callable<T>
createCallable(Callable<T> delegate)
          Creates a callable that ensures the executed runnable instance runs in the same thread local context as the calling code.
 Executor createExecutor(Executor delegate)
          Creates an executor that ensures the executed delegate instance runs in the same thread local context as the calling code.
 ExecutorService createExecutorService(ExecutorService delegate)
          Creates an executor service that ensures the executed delegate instance runs in the same thread local context as the calling code.
 Runnable createRunnable(Runnable delegate)
          Creates a runnable that ensures the executed runnable instance runs in the same thread local context as the calling code
 ScheduledExecutorService createScheduledExecutorService(ScheduledExecutorService delegate)
          Creates a scheduled executor service that ensures the executed delegate instance runs in the same thread local context as the calling code.
 

Method Detail

createExecutor

Executor createExecutor(Executor delegate)
Creates an executor that ensures the executed delegate instance runs in the same thread local context as the calling code.

Parameters:
delegate - The Executor instance to delegate to
Returns:
The wrapping executor that manages thread local state transfer

createExecutorService

ExecutorService createExecutorService(ExecutorService delegate)
Creates an executor service that ensures the executed delegate instance runs in the same thread local context as the calling code.

Parameters:
delegate - The ExecutorService instance to delegate to
Returns:
The wrapping ExecutorService that manages thread local state transfer

createScheduledExecutorService

ScheduledExecutorService createScheduledExecutorService(ScheduledExecutorService delegate)
Creates a scheduled executor service that ensures the executed delegate instance runs in the same thread local context as the calling code.

Parameters:
delegate - The ScheduledExecutorService instance to delegate to
Returns:
The wrapping ScheduledExecutorService that manages thread local state transfer

createRunnable

Runnable createRunnable(Runnable delegate)
Creates a runnable that ensures the executed runnable instance runs in the same thread local context as the calling code

Parameters:
delegate - The runnable to delegate to
Returns:
The wrapping Runnable that manages thread local state transfer

createCallable

<T> Callable<T> createCallable(Callable<T> delegate)
Creates a callable that ensures the executed runnable instance runs in the same thread local context as the calling code.

Type Parameters:
T - The type that the callable returns
Parameters:
delegate - The callable to delegate to
Returns:
The wrapping Callable that manages thread local state transfer


Copyright © 2010 Atlassian. All Rights Reserved.