org.eclipse.microprofile.context.spi

## Interface ContextManager.Builder

Enclosing interface:
  ContextManager

    public static interface ContextManager.Builder

Use this class to configure instances of `ContextManager`.

### Method Summary

All Methods Instance Methods Abstract Methods
`ContextManager.Builder` `addDiscoveredContextManagerExtensions()` Load all discoverable `ContextManagerExtension` instances via the `ServiceLoader` mechanism on the current thread-context `ClassLoader` (unless overridden by `forClassLoader(ClassLoader)`).
`ContextManager.Builder` `addDiscoveredThreadContextProviders()` Load all discoverable `ThreadContextProvider` instances via the `ServiceLoader` mechanism on the current thread-context `ClassLoader` (unless overridden by `forClassLoader(ClassLoader)`).
`ContextManager` `build()` Creates a new `ContextManager` with the specified configuration.
`ContextManager.Builder` `forClassLoader(ClassLoader classLoader)` Use the given `ClassLoader` for `addDiscoveredThreadContextProviders()` instead of the current thread-context `ClassLoader`.
`ContextManager.Builder` `withContextManagerExtensions(ContextManagerExtension... extensions)` Use the specified `ContextManagerExtension` instances.
`ContextManager.Builder` `withDefaultExecutorService(ExecutorService executorService)` Use the given `ExecutorService` to execute async tasks for contextualised `CompletableFuture` and `CompletionStage` when no executor is specified.
`ContextManager.Builder` `withThreadContextProviders(ThreadContextProvider... providers)` Use the specified `ThreadContextProvider` instances.

### Method Detail

#### withThreadContextProviders

    ContextManager.Builder withThreadContextProviders(ThreadContextProvider... providers)

Use the specified `ThreadContextProvider` instances.

Parameters:
  `providers` - the `ThreadContextProvider` instances to use.
Returns:
  this builder

#### addDiscoveredContextManagerExtensions

    ContextManager.Builder addDiscoveredContextManagerExtensions()

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

Returns:
  this builder

#### withContextManagerExtensions

    ContextManager.Builder withContextManagerExtensions(ContextManagerExtension... extensions)

Use the specified `ContextManagerExtension` instances.

Parameters:
  `extensions` - the `ContextManagerExtension` instances to use.
Returns:
  this builder

#### addDiscoveredThreadContextProviders

    ContextManager.Builder addDiscoveredThreadContextProviders()

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

Returns:
  this builder

#### forClassLoader

    ContextManager.Builder forClassLoader(ClassLoader classLoader)

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

Parameters:
  `classLoader` - the `ClassLoader` to use for `addDiscoveredThreadContextProviders()`
Returns:
  this builder

#### withDefaultExecutorService

    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` - the `ExecutorService` to use for async tasks when no executor is specified.
Returns:
  this builder

#### build

    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:
  a new `ContextManager` with the specified configuration.