Interface ContextManager.Builder
- Enclosing interface:
- ContextManager
public static interface ContextManager.Builder
Use this class to configure instances of
ContextManager
.-
Method Summary
Modifier and TypeMethodDescriptionLoad all discoverableContextManagerExtension
instances via theServiceLoader
mechanism on the current thread-contextClassLoader
(unless overridden byforClassLoader(ClassLoader)
).Load all discoverableThreadContextProvider
instances via theServiceLoader
mechanism on the current thread-contextClassLoader
(unless overridden byforClassLoader(ClassLoader)
).build()
Creates a newContextManager
with the specified configuration.forClassLoader
(ClassLoader classLoader) Use the givenClassLoader
foraddDiscoveredThreadContextProviders()
instead of the current thread-contextClassLoader
.withContextManagerExtensions
(ContextManagerExtension... extensions) Use the specifiedContextManagerExtension
instances.withThreadContextProviders
(ThreadContextProvider... providers) Use the specifiedThreadContextProvider
instances.
-
Method Details
-
withThreadContextProviders
Use the specifiedThreadContextProvider
instances.- Parameters:
providers
- theThreadContextProvider
instances to use.- Returns:
- this builder
-
addDiscoveredContextManagerExtensions
ContextManager.Builder addDiscoveredContextManagerExtensions()Load all discoverableContextManagerExtension
instances via theServiceLoader
mechanism on the current thread-contextClassLoader
(unless overridden byforClassLoader(ClassLoader)
).- Returns:
- this builder
-
withContextManagerExtensions
Use the specifiedContextManagerExtension
instances.- Parameters:
extensions
- theContextManagerExtension
instances to use.- Returns:
- this builder
-
addDiscoveredThreadContextProviders
ContextManager.Builder addDiscoveredThreadContextProviders()Load all discoverableThreadContextProvider
instances via theServiceLoader
mechanism on the current thread-contextClassLoader
(unless overridden byforClassLoader(ClassLoader)
).- Returns:
- this builder
-
forClassLoader
Use the givenClassLoader
foraddDiscoveredThreadContextProviders()
instead of the current thread-contextClassLoader
.- Parameters:
classLoader
- theClassLoader
to use foraddDiscoveredThreadContextProviders()
- Returns:
- this builder
-
build
ContextManager build()Creates a new
ContextManager
with the specified configuration.Creating a
ContextManager
will load and invoke all relatedContextManagerExtension
as described in its documentation.- Returns:
- a new
ContextManager
with the specified configuration.
-