From 760ee03bd13e9f642aa29baca70b106581cb5f06 Mon Sep 17 00:00:00 2001 From: Mark Swatosh Date: Thu, 2 Nov 2023 21:29:12 -0500 Subject: [PATCH] Adding contextualProcessor to ContextService --- .../enterprise/concurrent/ContextService.java | 26 ++++++++++++++++--- 1 file changed, 23 insertions(+), 3 deletions(-) diff --git a/api/src/main/java/jakarta/enterprise/concurrent/ContextService.java b/api/src/main/java/jakarta/enterprise/concurrent/ContextService.java index 18a3bfa2..3f3ac1b6 100644 --- a/api/src/main/java/jakarta/enterprise/concurrent/ContextService.java +++ b/api/src/main/java/jakarta/enterprise/concurrent/ContextService.java @@ -221,20 +221,40 @@ public interface ContextService { *

Wraps a {@link java.util.concurrent.Flow.Subscriber} with context captured from the thread that invokes * contextualSubscriber. Context is captured at the time contextualSubscriber is invoked.

* - *

When one of the methods of the {@link java.util.concurrent.Flow.Subscriber} interface (onSubscribe, onNext, - * onError, or onComplete) is invoked on the proxy instance, + *

When one of the methods of the {@link java.util.concurrent.Flow.Subscriber} interface (onSubscribe, + * onNext, onError, or onComplete) is invoked on the proxy instance, * context is first established on the thread that will run the method, * then the method of the provided Flow.Subscriber is invoked. * Finally, the previous context is restored on the thread, and the result of the * Flow.Subscriber is returned to the invoker.

* - * @param the subscriber's item type + * @param the subscribed item type * @param subscriber instance to contextualize * @return contextualized proxy instance that wraps execution of the onSubscribe, onNext, * onError, and onComplete methods * @since 3.1 */ public Flow.Subscriber contextualSubscriber(Flow.Subscriber subscriber); + + /** + *

Wraps a {@link java.util.concurrent.Flow.Processor} with context captured from the thread that invokes + * contextualProcessor. Context is captured at the time contextualProcessor is invoked.

+ * + *

When one of the methods of the {@link java.util.concurrent.Flow.Subscriber} interface (onSubscribe, + * onNext, onError, or onComplete) from which {@link java.util.concurrent.Flow.Processor} + * extends is invoked on the proxy instance, context is first established on the thread that will run the method, + * then the method of the provided Flow.Processor is invoked. + * Finally, the previous context is restored on the thread, and the result of the + * Flow.Processor is returned to the invoker.

+ * + * @param the subscribed item type + * @param the published item type + * @param processor instance to contextualize + * @return contextualized proxy instance that wraps execution of the onSubscribe, onNext, + * onError, and onComplete methods + * @since 3.1 + */ + public Flow.Processor contextualProcessor(Flow.Processor processor); /** * Creates a new contextual object proxy for the input object instance.