Class ContextServiceDefinitionServlet

java.lang.Object
jakarta.servlet.GenericServlet
jakarta.servlet.http.HttpServlet
ee.jakarta.tck.concurrent.framework.TestServlet
ee.jakarta.tck.concurrent.spec.ContextService.contextPropagate.ContextServiceDefinitionServlet
All Implemented Interfaces:
jakarta.servlet.Servlet, jakarta.servlet.ServletConfig, Serializable

@WebServlet("/ContextServiceDefinitionServlet") public class ContextServiceDefinitionServlet extends TestServlet
See Also:
  • Constructor Details

    • ContextServiceDefinitionServlet

      public ContextServiceDefinitionServlet()
  • Method Details

    • destroy

      public void destroy()
      Specified by:
      destroy in interface jakarta.servlet.Servlet
      Overrides:
      destroy in class jakarta.servlet.GenericServlet
    • before

      public void before() throws jakarta.servlet.ServletException
      Description copied from class: TestServlet
      Override to mimic JUnit's @Before annotation.
      Overrides:
      before in class TestServlet
      Throws:
      jakarta.servlet.ServletException
    • testContextServiceDefinitionAllAttributes

      public void testContextServiceDefinitionAllAttributes() throws Throwable
      A ContextServiceDefinition with all attributes configured propagates/clears/ignores context types as configured. ContextA, which is tested here, propagates Application context and IntContext, clears StringContext, and leaves Transaction context unchanged.
      Throws:
      Throwable
    • testContextServiceDefinitionDefaults

      public void testContextServiceDefinitionDefaults() throws Throwable
      A ContextServiceDefinition with minimal attributes configured clears transaction context and propagates other types.
      Throws:
      Throwable
    • testContextServiceDefinitionWithThirdPartyContext

      public void testContextServiceDefinitionWithThirdPartyContext() throws Throwable
      A ContextServiceDefinition can specify a third-party context type to be propagated/cleared/ignored. This test uses 2 ContextServiceDefinitions: ContextA with IntContext propagated and StringContext cleared. ContextB with IntContext unchanged and StringContext propagated (per ALL_REMAINING).
      Throws:
      Throwable
    • testContextualConsumer

      public void testContextualConsumer() throws Throwable
      A ContextService contextualizes a Consumer, which can be supplied as a dependent stage action to an unmanaged CompletableFuture. The dependent stage action runs with the thread context of the thread that contextualizes the Consumer, per the configuration of the ContextServiceDefinition.
      Throws:
      Throwable
    • testContextualFunction

      public void testContextualFunction() throws Throwable
      A ContextService contextualizes a Function, which can be supplied as a dependent stage action to an unmanaged CompletableFuture. The dependent stage action runs with the thread context of the thread that contextualizes the Function, per the configuration of the ContextServiceDefinition.
      Throws:
      Throwable
    • testContextualSupplier

      public void testContextualSupplier() throws Throwable
      A ContextService contextualizes a Supplier, which can be supplied as a dependent stage action to an unmanaged CompletableFuture. The dependent stage action runs with the thread context of the thread that contextualizes the Supplier, per the configuration of the ContextServiceDefinition.
      Throws:
      Throwable
    • testContextualFlowSubscriber

      public void testContextualFlowSubscriber() throws Throwable
      A ContextService contextualizes a Flow.Subscriber, which is subscribed to an unmanaged Flow.Producer. The Flow.Subscriber methods are run with the thread context of the thread which contextualizes the Flow.Subscriber per the configuration of the ContextServiceDefinition. publisher.subscribe triggers onSubscribe publisher.offer triggers onNext publisher.close (implicit from AutoClosable) triggers onComplete publisher.closeExceptionally triggers onError
      Throws:
      Throwable
    • testContextualFlowProcessor

      public void testContextualFlowProcessor() throws Throwable
      A ContextService contextualizes a Flow.Processor, which is subscribed to an unmanaged Flow.Producer. The Flow.Subscriber methods are run with the thread context of the thread which contextualizes the Flow.Processor per the configuration of the ContextServiceDefinition. processor.subscribe triggers subscribe publisher.subscribe triggers onSubscribe publisher.offer triggers onNext publisher.close (implicit from AutoClosable) triggers onComplete publisher.closeExceptionally triggers onError
      Throws:
      Throwable
    • testCopyWithContextCapture

      public void testCopyWithContextCapture() throws Throwable
      ContextService can create a contextualized copy of an unmanaged CompletableFuture.
      Throws:
      Throwable