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 Details

    • Builder

      public Builder()
  • Method Details

    • withThreadContextProviders

      public SmallRyeContextManager.Builder withThreadContextProviders(org.eclipse.microprofile.context.spi.ThreadContextProvider... providers)
      Specified by:
      withThreadContextProviders in interface org.eclipse.microprofile.context.spi.ContextManager.Builder
    • addDiscoveredThreadContextProviders

      public SmallRyeContextManager.Builder addDiscoveredThreadContextProviders()
      Specified by:
      addDiscoveredThreadContextProviders in interface org.eclipse.microprofile.context.spi.ContextManager.Builder
    • withContextManagerExtensions

      public SmallRyeContextManager.Builder withContextManagerExtensions(org.eclipse.microprofile.context.spi.ContextManagerExtension... propagators)
      Specified by:
      withContextManagerExtensions in interface org.eclipse.microprofile.context.spi.ContextManager.Builder
    • addDiscoveredContextManagerExtensions

      public SmallRyeContextManager.Builder addDiscoveredContextManagerExtensions()
      Specified by:
      addDiscoveredContextManagerExtensions in interface org.eclipse.microprofile.context.spi.ContextManager.Builder
    • forClassLoader

      public SmallRyeContextManager.Builder forClassLoader(ClassLoader classLoader)
      Specified by:
      forClassLoader in interface org.eclipse.microprofile.context.spi.ContextManager.Builder
    • withDefaultValues

      public SmallRyeContextManager.Builder withDefaultValues(DefaultValues defaultValues)
    • build

      public SmallRyeContextManager build()
      Specified by:
      build in interface org.eclipse.microprofile.context.spi.ContextManager.Builder
    • registerOnProvider

      public SmallRyeContextManager.Builder registerOnProvider()
      Registers the built instance to the current SmallRyeContextManagerProvider before any extensions are loaded. This is useful because the extensions might require the built SmallRyeContextManager to be registered on the current class loader in order to use it, so this prevents building two.
      Returns:
      this builder
    • withDefaultExecutorService

      public SmallRyeContextManager.Builder withDefaultExecutorService(ExecutorService executorService)
      Make all created SmallRyeManagedExecutor forward to the given executor service by default instead of creating new executor services to back them. This can be overridden with SmallRyeManagedExecutor.Builder.withExecutorService(ExecutorService) and SmallRyeManagedExecutor.Builder.withNewExecutorService(). Also serves as the default executor to use by all CompletionStage and CompletableFuture wrapped by ThreadContext.
      Specified by:
      withDefaultExecutorService in interface org.eclipse.microprofile.context.spi.ContextManager.Builder
      Parameters:
      executorService - the executor service to delegate to. If null, all created ManagedExecutor will create new backing executor services, and all *Async methods of the CompletionStage and CompletableFuture wrapped by ThreadContext will throw due to a lack of executor.
      Returns:
      this builder.
    • enableFastThreadContextProviders

      public SmallRyeContextManager.Builder enableFastThreadContextProviders(boolean enable)
      Enable or disable FastThreadContextProviders optimisations. Defaults to enabled.
      Parameters:
      enable - set to false to disable FastThreadContextProviders.
      Returns:
      this builder.