Package io.smallrye.context
Class SmallRyeContextManager.Builder
java.lang.Object
io.smallrye.context.SmallRyeContextManager.Builder
- All Implemented Interfaces:
org.eclipse.microprofile.context.spi.ContextManager.Builder
- Enclosing class:
SmallRyeContextManager
public static class SmallRyeContextManager.Builder
extends Object
implements org.eclipse.microprofile.context.spi.ContextManager.Builder
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionbuild()enableFastThreadContextProviders(boolean enable) Enable or disable FastThreadContextProviders optimisations.forClassLoader(ClassLoader classLoader) Registers the built instance to the currentSmallRyeContextManagerProviderbefore any extensions are loaded.withContextManagerExtensions(org.eclipse.microprofile.context.spi.ContextManagerExtension... propagators) withDefaultExecutorService(ExecutorService executorService) Make all createdSmallRyeManagedExecutorforward to the given executor service by default instead of creating new executor services to back them.withDefaultValues(DefaultValues defaultValues) withThreadContextProviders(org.eclipse.microprofile.context.spi.ThreadContextProvider... providers)
-
Constructor Details
-
Builder
public Builder()
-
-
Method Details
-
withThreadContextProviders
public SmallRyeContextManager.Builder withThreadContextProviders(org.eclipse.microprofile.context.spi.ThreadContextProvider... providers) - Specified by:
withThreadContextProvidersin interfaceorg.eclipse.microprofile.context.spi.ContextManager.Builder
-
addDiscoveredThreadContextProviders
- Specified by:
addDiscoveredThreadContextProvidersin interfaceorg.eclipse.microprofile.context.spi.ContextManager.Builder
-
withContextManagerExtensions
public SmallRyeContextManager.Builder withContextManagerExtensions(org.eclipse.microprofile.context.spi.ContextManagerExtension... propagators) - Specified by:
withContextManagerExtensionsin interfaceorg.eclipse.microprofile.context.spi.ContextManager.Builder
-
addDiscoveredContextManagerExtensions
- Specified by:
addDiscoveredContextManagerExtensionsin interfaceorg.eclipse.microprofile.context.spi.ContextManager.Builder
-
forClassLoader
- Specified by:
forClassLoaderin interfaceorg.eclipse.microprofile.context.spi.ContextManager.Builder
-
withDefaultValues
-
build
- Specified by:
buildin interfaceorg.eclipse.microprofile.context.spi.ContextManager.Builder
-
registerOnProvider
Registers the built instance to the currentSmallRyeContextManagerProviderbefore any extensions are loaded. This is useful because the extensions might require the builtSmallRyeContextManagerto be registered on the current class loader in order to use it, so this prevents building two.- Returns:
- this builder
-
withDefaultExecutorService
Make all createdSmallRyeManagedExecutorforward to the given executor service by default instead of creating new executor services to back them. This can be overridden withSmallRyeManagedExecutor.Builder.withExecutorService(ExecutorService)andSmallRyeManagedExecutor.Builder.withNewExecutorService(). Also serves as the default executor to use by allCompletionStageandCompletableFuturewrapped byThreadContext.- Specified by:
withDefaultExecutorServicein interfaceorg.eclipse.microprofile.context.spi.ContextManager.Builder- Parameters:
executorService- the executor service to delegate to. Ifnull, all createdManagedExecutorwill create new backing executor services, and all*Asyncmethods of theCompletionStageandCompletableFuturewrapped byThreadContextwill throw due to a lack of executor.- Returns:
- this builder.
-
enableFastThreadContextProviders
Enable or disable FastThreadContextProviders optimisations. Defaults to enabled.- Parameters:
enable- set to false to disable FastThreadContextProviders.- Returns:
- this builder.
-