Class ApplicationContextHoldersKt
-
- All Implemented Interfaces:
public final class ApplicationContextHoldersKt
-
-
Method Summary
Modifier and Type Method Description final static ApplicationContextgetThreadLocalContext(String name)Get a ThreadLocal context for given name. final static ApplicationContextgetThreadLocalContext(String name, Set<Key<?>> permittedKeys)Same as getThreadLocalContext but with permittedKeys. final static UnitsetThreadLocalContext(ApplicationContext applicationContext)Set any externally created ThreadLocal context into the context holder strategy. final static ApplicationContextclearThreadLocalContext(String name)Clear ThreadLocal context for given name and return back the context final static BooleanexistsThreadLocalContext(String name, Set<Key<?>> permittedKeys)Check if ThreadLocal context with given name and permittedKeys exists final static CoroutineScopeinitCoroutineScopeForApplicationContext(CoroutineScope coroutineScope)Initialize a new CoroutineScope which can hold ApplicationContext for all coroutines that use this scope final static ApplicationContextgetGlobalContext(String name)Get a Global context for given name. final static ApplicationContextgetGlobalContext(String name, Set<Key<?>> permittedKeys)Same as getGlobalContext but with permittedKeys. final static UnitsetGlobalContext(ApplicationContext applicationContext)Set any externally created Global context into the context holder strategy. final static ApplicationContextclearGlobalContext(String name)Clear Global context for given name and return back the context final static BooleanexistsGlobalContext(String name, Set<Key<?>> permittedKeys)Check if Global context with given name and permittedKeys exists -
-
Method Detail
-
getThreadLocalContext
final static ApplicationContext getThreadLocalContext(String name)
Get a ThreadLocal context for given name. If not available then create one, set in holder and return back.
-
getThreadLocalContext
final static ApplicationContext getThreadLocalContext(String name, Set<Key<?>> permittedKeys)
Same as getThreadLocalContext but with permittedKeys. If context already exist with different set of keys then this method should throw InvalidKeyException
-
setThreadLocalContext
final static Unit setThreadLocalContext(ApplicationContext applicationContext)
Set any externally created ThreadLocal context into the context holder strategy. If any context with this name already exist then this method should throw InvalidContextException
-
clearThreadLocalContext
final static ApplicationContext clearThreadLocalContext(String name)
Clear ThreadLocal context for given name and return back the context
-
existsThreadLocalContext
final static Boolean existsThreadLocalContext(String name, Set<Key<?>> permittedKeys)
Check if ThreadLocal context with given name and permittedKeys exists
-
initCoroutineScopeForApplicationContext
final static CoroutineScope initCoroutineScopeForApplicationContext(CoroutineScope coroutineScope)
Initialize a new CoroutineScope which can hold ApplicationContext for all coroutines that use this scope
- Parameters:
coroutineScope- if any existing coroutineScope passed then a new coroutineScope is created from that param and init for holding ApplicationContext
-
getGlobalContext
final static ApplicationContext getGlobalContext(String name)
Get a Global context for given name. If not available then create one, set in holder and return back.
-
getGlobalContext
final static ApplicationContext getGlobalContext(String name, Set<Key<?>> permittedKeys)
Same as getGlobalContext but with permittedKeys. If context already exist with different set of keys then this method should throw InvalidKeyException
-
setGlobalContext
final static Unit setGlobalContext(ApplicationContext applicationContext)
Set any externally created Global context into the context holder strategy. If any context with this name already exist then this method should throw InvalidContextException
-
clearGlobalContext
final static ApplicationContext clearGlobalContext(String name)
Clear Global context for given name and return back the context
-
existsGlobalContext
final static Boolean existsGlobalContext(String name, Set<Key<?>> permittedKeys)
Check if Global context with given name and permittedKeys exists
-
-
-
-