public class MapBasedRequestCacheContext extends Object implements RequestCacheContext
Constructor and Description |
---|
MapBasedRequestCacheContext(java.util.function.Supplier<Map<Object,Object>> mapSupplier,
Runnable cleaningCallback) |
Modifier and Type | Method and Description |
---|---|
void |
clearAll()
Clears all local storage for this thread.
|
void |
clearLocalMap(RequestCache<?,?> requestCache)
Clears a specific request cache's local storage for this thread.
|
void |
close()
Should be called to indicate the attempt to stop the context.
|
Map<Object,Object> |
getLocalMap(RequestCache<?,?> requestCache)
Returns the request-scoped storage for the given request cache.
|
Map<Object,Object> |
getLocalMapIfExists(RequestCache<?,?> requestCache)
Returns the request-scoped storage for the given request cache, if it exists.
|
void |
markValueLoading()
Mark the success of adding the value to map returned by
RequestCacheContext.getLocalMap(RequestCache)
or RequestCacheContext.getLocalMapIfExists(RequestCache) |
void |
open()
Should be called to indicate the start of the context.
|
public MapBasedRequestCacheContext(java.util.function.Supplier<Map<Object,Object>> mapSupplier, Runnable cleaningCallback)
mapSupplier
- supplier for map returned by getLocalMap(RequestCache)
and getLocalMapIfExists(RequestCache)
cleaningCallback
- callback executed during close()
@Nonnull public Map<Object,Object> getLocalMap(RequestCache<?,?> requestCache)
RequestCacheContext
getLocalMap
in interface RequestCacheContext
requestCache
- the cache for which to locate@Nullable public Map<Object,Object> getLocalMapIfExists(RequestCache<?,?> requestCache)
RequestCacheContext
getLocalMapIfExists
in interface RequestCacheContext
requestCache
- the cache for which to locatenull
.public void clearAll()
RequestCacheContext
clearAll
in interface RequestCacheContext
public void clearLocalMap(RequestCache<?,?> requestCache)
RequestCacheContext
clearLocalMap
in interface RequestCacheContext
requestCache
- the cache for which to clear the current thread's local storagepublic void open()
RequestCacheContext
RequestCacheContext.close()
open
in interface RequestCacheContext
public void close()
RequestCacheContext
RequestCacheContext.open()
close
in interface RequestCacheContext
public void markValueLoading()
RequestCacheContext
RequestCacheContext.getLocalMap(RequestCache)
or RequestCacheContext.getLocalMapIfExists(RequestCache)
markValueLoading
in interface RequestCacheContext
Copyright © 2002-2019 Atlassian. All Rights Reserved.