@PublicApi public interface JiraThreadLocalUtil
ThreadLocalvariables that can otherwise interfere with the smooth running of JIRA by leaking resources or allowing stale cached information to survive between requests.
Services that are registered as a
do not need to use this component, because this cleanup is performed
automatically as part of the service's execution lifecycle. This should also generally
be true of scheduler jobs, such as those executed through SAL's
or the new
SchedulerService, but this was not implemented correctly in JIRA
v6.3.x, so scheduled jobs should also use this component just to be safe.
Additionally, any plugin that creates its own threads for background processing must
use this component to guard its work. Prior to JIRA v6.0, the only way to do this was
to access the
public void run()
// do runnable code here
|Modifier and Type||Interface and Description|
This interface is used as a callback mechanism in the case where "runnable code" has completed and the
|Modifier and Type||Method and Description|
This convenience method is equivalent to
This should be called in a
This should be called before any "runnable code" is called.
ThreadLocalenvironment for the runnable code to execute in.
void postCall(@Nonnull org.apache.log4j.Logger log)
log- as for
void postCall(@Nonnull org.apache.log4j.Logger log, @Nullable JiraThreadLocalUtil.WarningCallback warningCallback)
finallyblock to clear up
ThreadLocals once the runnable stuff has been done.
log- the log to write error messages to in case of any problems
warningCallback- the callback to invoke in case where problems are detected after the runnable code is done running and its not cleaned up properly. This may be
null, in which case those problems are logged as errors.
Copyright © 2002-2021 Atlassian. All Rights Reserved.