com.atlassian.sal.core.executor
Class DefaultThreadLocalDelegateExecutorFactory

java.lang.Object
  extended by com.atlassian.sal.core.executor.DefaultThreadLocalDelegateExecutorFactory
All Implemented Interfaces:
ThreadLocalDelegateExecutorFactory
Direct Known Subclasses:
BambooThreadLocalDelegateExecutorFactory

public class DefaultThreadLocalDelegateExecutorFactory
extends Object
implements ThreadLocalDelegateExecutorFactory

Creates delegating executable classes that copy thread local state


Constructor Summary
protected DefaultThreadLocalDelegateExecutorFactory(ThreadLocalContextManager manager)
           
 
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.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DefaultThreadLocalDelegateExecutorFactory

protected DefaultThreadLocalDelegateExecutorFactory(ThreadLocalContextManager manager)
Method Detail

createExecutor

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

Specified by:
createExecutor in interface ThreadLocalDelegateExecutorFactory
Parameters:
delegate - The Executor instance to delegate to
Returns:
The wrapping executor that manages thread local state transfer

createExecutorService

public 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.

Specified by:
createExecutorService in interface ThreadLocalDelegateExecutorFactory
Parameters:
delegate - The ExecutorService instance to delegate to
Returns:
The wrapping ExecutorService that manages thread local state transfer

createScheduledExecutorService

public 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.

Specified by:
createScheduledExecutorService in interface ThreadLocalDelegateExecutorFactory
Parameters:
delegate - The ScheduledExecutorService instance to delegate to
Returns:
The wrapping ScheduledExecutorService that manages thread local state transfer

createRunnable

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

Specified by:
createRunnable in interface ThreadLocalDelegateExecutorFactory
Parameters:
delegate - The runnable to delegate to
Returns:
The wrapping Runnable that manages thread local state transfer

createCallable

public <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.

Specified by:
createCallable in interface ThreadLocalDelegateExecutorFactory
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.