Package 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
Modifier and TypeMethodDescription<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.createExecutor(Executor delegate) Creates an executor that ensures the executed delegate instance runs in the same thread local context as the calling code.createExecutorService(ExecutorService delegate) Creates an executor service that ensures the executed delegate instance runs in the same thread local context as the calling code.createRunnable(Runnable delegate) Creates a runnable that ensures the executed runnable instance runs in the same thread local context as the calling codeCreates a scheduled executor service that ensures the executed delegate instance runs in the same thread local context as the calling code.
-
Method Details
-
createExecutor
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
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
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
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
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
-