Top Description Inners Methods
org.eclipse.microprofile.context.spi

public Interface ContextManager

Imports
java.util.concurrent.CompletableFuture, .CompletionStage, .ExecutorService, org.eclipse.microprofile.context.ManagedExecutor, .ThreadContext

ContextManager instances can be used to create newManagedExecutorBuilder() or newThreadContextBuilder(). Each ContextManager instance has its own set of ThreadContextProvider as defined during building with ContextManager.Builder#build() or ContextManagerProvider#getContextManager().
See Also
ContextManagerProvider#getContextManager(), ContextManager.Builder

Nested and Inner Type Summary

Modifier and TypeClass and Description
public static interface
ContextManager.Builder

Use this class to configure instances of ContextManager.

Method Summary

Modifier and TypeMethod and Description
public ManagedExecutor.Builder

Returns:

a new ManagedExecutor.Builder instance.
newManagedExecutorBuilder
()

Creates a new ManagedExecutor.Builder instance.

public ThreadContext.Builder

Returns:

a new ThreadContext.Builder instance.
newThreadContextBuilder
()

Creates a new ThreadContext.Builder instance.

Method Detail

newManagedExecutorBuilderback to summary
public ManagedExecutor.Builder newManagedExecutorBuilder()

Creates a new ManagedExecutor.Builder instance.

Returns:ManagedExecutor.Builder

a new ManagedExecutor.Builder instance.

newThreadContextBuilderback to summary
public ThreadContext.Builder newThreadContextBuilder()

Creates a new ThreadContext.Builder instance.

Returns:ThreadContext.Builder

a new ThreadContext.Builder instance.

org.eclipse.microprofile.context.spi back to summary

public Interface ContextManager.Builder


Use this class to configure instances of ContextManager.

Method Summary

Modifier and TypeMethod and Description
public ContextManager.Builder

Returns:

this builder
addDiscoveredContextManagerExtensions
()

Load all discoverable ContextManagerExtension instances via the java.util.ServiceLoader mechanism on the current thread-context ClassLoader (unless overridden by forClassLoader(ClassLoader)).

public ContextManager.Builder

Returns:

this builder
addDiscoveredThreadContextProviders
()

Load all discoverable ThreadContextProvider instances via the java.util.ServiceLoader mechanism on the current thread-context ClassLoader (unless overridden by forClassLoader(ClassLoader)).

public ContextManager

Returns:

a new ContextManager with the specified configuration.
build
()

Creates a new ContextManager with the specified configuration.

public ContextManager.Builder

Returns:

this builder
forClassLoader
(ClassLoader classLoader)

Use the given ClassLoader for addDiscoveredThreadContextProviders() instead of the current thread-context ClassLoader.

public ContextManager.Builder

Returns:

this builder
withContextManagerExtensions
(ContextManagerExtension...
the ContextManagerExtension instances to use.
extensions
)

Use the specified ContextManagerExtension instances.

public ContextManager.Builder

Returns:

this builder
withDefaultExecutorService
(ExecutorService
the ExecutorService to use for async tasks when no executor is specified.
executorService
)

Use the given ExecutorService to execute async tasks for contextualised CompletableFuture and CompletionStage when no executor is specified.

public ContextManager.Builder

Returns:

this builder
withThreadContextProviders
(ThreadContextProvider...
the ThreadContextProvider instances to use.
providers
)

Use the specified ThreadContextProvider instances.

Method Detail

addDiscoveredContextManagerExtensionsback to summary
public ContextManager.Builder addDiscoveredContextManagerExtensions()

Load all discoverable ContextManagerExtension instances via the java.util.ServiceLoader mechanism on the current thread-context ClassLoader (unless overridden by forClassLoader(ClassLoader)).

Returns:ContextManager.Builder

this builder

addDiscoveredThreadContextProvidersback to summary
public ContextManager.Builder addDiscoveredThreadContextProviders()

Load all discoverable ThreadContextProvider instances via the java.util.ServiceLoader mechanism on the current thread-context ClassLoader (unless overridden by forClassLoader(ClassLoader)).

Returns:ContextManager.Builder

this builder

buildback to summary
public ContextManager build()

Creates a new ContextManager with the specified configuration.

Creating a ContextManager will load and invoke all related ContextManagerExtension as described in its documentation.

Returns:ContextManager

a new ContextManager with the specified configuration.

forClassLoaderback to summary
public ContextManager.Builder forClassLoader(ClassLoader classLoader)

Use the given ClassLoader for addDiscoveredThreadContextProviders() instead of the current thread-context ClassLoader.

Parameters
classLoader:ClassLoader

the ClassLoader to use for addDiscoveredThreadContextProviders()

Returns:ContextManager.Builder

this builder

withContextManagerExtensionsback to summary
public ContextManager.Builder withContextManagerExtensions(ContextManagerExtension... extensions)

Use the specified ContextManagerExtension instances.

Parameters
extensions:ContextManagerExtension[]

the ContextManagerExtension instances to use.

Returns:ContextManager.Builder

this builder

withDefaultExecutorServiceback to summary
public ContextManager.Builder withDefaultExecutorService(ExecutorService executorService)

Use the given ExecutorService to execute async tasks for contextualised CompletableFuture and CompletionStage when no executor is specified.

Parameters
executorService:ExecutorService

the ExecutorService to use for async tasks when no executor is specified.

Returns:ContextManager.Builder

this builder

withThreadContextProvidersback to summary
public ContextManager.Builder withThreadContextProviders(ThreadContextProvider... providers)

Use the specified ThreadContextProvider instances.

Parameters
providers:ThreadContextProvider[]

the ThreadContextProvider instances to use.

Returns:ContextManager.Builder

this builder