@PublicApi public interface

OffRequestThreadExecutor

implements Executor
com.atlassian.jira.util.thread.OffRequestThreadExecutor
Known Indirect Subclasses

@PublicApi

This interface is designed for plugins to consume (call its methods).

Clients of @PublicApi can expect that programs compiled against a given version will remain binary compatible with later versions of the @PublicApi as per each product's API policy as long as the client does not implement/extend @PublicApi interfaces or classes (refer to each product's API policy for the exact guarantee---usually binary compatibility is guaranteed at least across minor versions).

Note: since @PublicApi interfaces and classes are not designed to be implemented or extended by clients, we may perform certain types of binary-incompatible changes to these classes and interfaces, but these will not affect well-behaved clients that do not extend/implement these types (in general, only classes and interfaces annotated with @PublicSpi are safe to extend/implement).

Class Overview

If you ever need to run code in JIRA off a HTTP request thread then you can sue this class to help setup and clean up the thread environment.

JIRA uses a fair few ThreadLocal variables setup during HTTP requests to contain common information such as the logged in user and their Locale and so on say via JiraAuthenticationContext

This class will help you run the off request thread code and clean up after it properly.

Summary

Public Methods
void execute(Runnable command)
Executes the code with No user in context via JiraAuthenticationContext
void execute(ApplicationUser runAsUser, Runnable command)
Executes the code with the specified user in context via JiraAuthenticationContext
[Expand]
Inherited Methods
From interface java.util.concurrent.Executor

Public Methods

public void execute (Runnable command)

Executes the code with No user in context via JiraAuthenticationContext

Parameters
command the code to run

public void execute (ApplicationUser runAsUser, Runnable command)

Executes the code with the specified user in context via JiraAuthenticationContext

Parameters
runAsUser the user to run the code as
command the code to run