com.atlassian.jira.util.thread
Interface OffRequestThreadExecutor

All Superinterfaces:
Executor
All Known Implementing Classes:
OffRequestThreadExecutorImpl

@PublicApi
public interface OffRequestThreadExecutor
extends Executor

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.

Since:
v6.0

Method Summary
 void execute(ApplicationUser runAsUser, Runnable command)
          Executes the code with the specified user in context via JiraAuthenticationContext
 void execute(Runnable command)
          Executes the code with No user in context via JiraAuthenticationContext
 

Method Detail

execute

void execute(Runnable command)
Executes the code with No user in context via JiraAuthenticationContext

Specified by:
execute in interface Executor
Parameters:
command - the code to run

execute

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


Copyright © 2002-2014 Atlassian. All Rights Reserved.