public class

JiraVCacheRequestContextSupplier

extends Object
implements Supplier<T>
java.lang.Object
   ↳ com.atlassian.jira.cache.JiraVCacheRequestContextSupplier

Class Overview

Lenient request context supplier that may create request context for a thread if it hasn't been created. Normally in Cloud Vertigo context is initialised at the beginning of the request with a tenant that comes in request, therefore it is not allowed to call components that are tenant aware without request context. However, Server instance is always tenanted and sometimes components that use vcache are called from threads that do not have context initialised (e.g. in constructor during container initialisation); Since this behaviour is allowed in Jira Server 7.x we will just log it as a warning and create NoopRequestContext that will always compute value or return empty value.

Summary

Public Constructors
JiraVCacheRequestContextSupplier(boolean warnNoContext)
Constructs JiraVCacheRequestContextSupplier.
Public Methods
void clearThread()
Clears the thread's RequestContext.
@Nonnull RequestContext get()
void initThread(String partitionId)
Initialises the thread's RequestContext.
boolean isInitilised()
[Expand]
Inherited Methods
From class java.lang.Object
From interface java.util.function.Supplier

Public Constructors

public JiraVCacheRequestContextSupplier (boolean warnNoContext)

Constructs JiraVCacheRequestContextSupplier.

Parameters
warnNoContext if set to true, every time get() will be called on uninitialised thread request context it will be logged as warning.

Public Methods

public void clearThread ()

Clears the thread's RequestContext.

@Nonnull public RequestContext get ()

public void initThread (String partitionId)

Initialises the thread's RequestContext.

Parameters
partitionId the identifier for the partition. Will be validated using requireValidPartitionIdentifier(String).

public boolean isInitilised ()