diff --git a/api/src/main/java/org/eclipse/microprofile/concurrent/ManagedExecutorBuilder.java b/api/src/main/java/org/eclipse/microprofile/concurrent/ManagedExecutorBuilder.java index 8cb421a..64118b4 100644 --- a/api/src/main/java/org/eclipse/microprofile/concurrent/ManagedExecutorBuilder.java +++ b/api/src/main/java/org/eclipse/microprofile/concurrent/ManagedExecutorBuilder.java @@ -61,8 +61,12 @@ public interface ManagedExecutorBuilder { *

This set replaces the set that was previously specified on the * builder instance.

* - *

The default set of thread context types is those required by the - * EE Concurrency spec, plus CDI.

+ *

The default set of thread context types is + * {@link ThreadContext#DEFAULTS}, which includes all available + * thread context types that support capture and propagation to other + * threads, except for {@link ThreadContext#TRANSACTION} context, which + * is instead cleared (suspended) from the thread that runs the action or + * task.

* *

Constants for specifying some of the core context types are provided * on {@link ThreadContext}. Other thread context types must be defined diff --git a/api/src/main/java/org/eclipse/microprofile/concurrent/ManagedExecutorConfig.java b/api/src/main/java/org/eclipse/microprofile/concurrent/ManagedExecutorConfig.java index 75ae3e2..a9e522d 100644 --- a/api/src/main/java/org/eclipse/microprofile/concurrent/ManagedExecutorConfig.java +++ b/api/src/main/java/org/eclipse/microprofile/concurrent/ManagedExecutorConfig.java @@ -50,8 +50,12 @@ * that creates a dependent stage (or that submits a task) and which to * propagate to the thread where the action or task executes.

* - *

The default set of thread context types is those required by the - * EE Concurrency spec, plus CDI.

+ *

The default set of thread context types is + * {@link ThreadContext#DEFAULTS}, which includes all available + * thread context types that support capture and propagation to other + * threads, except for {@link ThreadContext#TRANSACTION} context, which + * is instead cleared (suspended) from the thread that runs the action or + * task.

* *

Constants for specifying some of the core context types are provided * on {@link ThreadContext}. Other thread context types must be defined @@ -65,7 +69,7 @@ * are cleared from the thread of execution for the duration of the * action or task.

*/ - String[] propagated() default { ThreadContext.APPLICATION, ThreadContext.CDI, ThreadContext.SECURITY }; + String[] propagated() default { ThreadContext.DEFAULTS }; /** *

Establishes an upper bound on the number of async completion stage diff --git a/api/src/main/java/org/eclipse/microprofile/concurrent/ThreadContext.java b/api/src/main/java/org/eclipse/microprofile/concurrent/ThreadContext.java index 234af56..2b20832 100644 --- a/api/src/main/java/org/eclipse/microprofile/concurrent/ThreadContext.java +++ b/api/src/main/java/org/eclipse/microprofile/concurrent/ThreadContext.java @@ -48,8 +48,12 @@ */ public interface ThreadContext { /** - * Identifier for all available thread context types that support capture - * and propagation to other threads. + *

Identifier for all available thread context types that support + * capture and propagation to other threads.

+ * + *

When using this constant, be aware that bringing in a new + * context provider or updating levels of an existing context provider + * might change the set of available thread context types.

* * @see ManagedExecutorConfig#propagated * @see ThreadContextConfig#value @@ -80,6 +84,25 @@ public interface ThreadContext { */ static final String CDI = "CDI"; + /** + *

Identifier for the default set of thread context types, which is + * defined as all available thread context types that support capture and + * propagation to other threads except for {@link #TRANSACTION} context, + * which is instead cleared (suspended) from the thread that runs the + * action or task. This enables the action or task to choose whether, and + * if so, how, it participates in transactional work and is consistent + * with the generally established practice that transactions do not + * span threads.

+ * + *

When using this constant, be aware that bringing in a new + * context provider or updating levels of an existing context provider + * might change the set of available thread context types.

+ * + * @see ManagedExecutorConfig#propagated + * @see ThreadContextConfig + */ + static final String DEFAULTS = "Defaults"; + /** * Identifier for security context. Security context controls the credentials * that are associated with the thread. An empty/default security context diff --git a/api/src/main/java/org/eclipse/microprofile/concurrent/ThreadContextBuilder.java b/api/src/main/java/org/eclipse/microprofile/concurrent/ThreadContextBuilder.java index 2a9f0c6..260c4c9 100644 --- a/api/src/main/java/org/eclipse/microprofile/concurrent/ThreadContextBuilder.java +++ b/api/src/main/java/org/eclipse/microprofile/concurrent/ThreadContextBuilder.java @@ -73,8 +73,12 @@ public static ThreadContextBuilder instance() { *

This set replaces the 'propagated' set that was previously specified * on the builder instance.

* - *

The default set of thread context types is those required by the - * EE Concurrency spec, plus CDI.

+ *

The default set of thread context types is + * {@link ThreadContext#DEFAULTS}, which includes all available + * thread context types that support capture and propagation to other + * threads, except for {@link ThreadContext#TRANSACTION} context, which + * is instead cleared (suspended) from the thread that runs the action or + * task.

* *

Constants for specifying some of the core context types are provided * on {@link ThreadContext}. Other thread context types must be defined diff --git a/api/src/main/java/org/eclipse/microprofile/concurrent/ThreadContextConfig.java b/api/src/main/java/org/eclipse/microprofile/concurrent/ThreadContextConfig.java index 62f54c2..08dad61 100644 --- a/api/src/main/java/org/eclipse/microprofile/concurrent/ThreadContextConfig.java +++ b/api/src/main/java/org/eclipse/microprofile/concurrent/ThreadContextConfig.java @@ -50,8 +50,12 @@ * that contextualizes an action or task. This context is later * re-established on the thread(s) where the action or task executes.

* - *

The default set of thread context types is those required by the - * EE Concurrency spec, plus CDI.

+ *

The default set of thread context types is + * {@link ThreadContext#DEFAULTS}, which includes all available + * thread context types that support capture and propagation to other + * threads, except for {@link ThreadContext#TRANSACTION} context, which + * is instead cleared (suspended) from the thread that runs the action or + * task.

* *

Constants for specifying some of the core context types are provided * on {@link ThreadContext}. Other thread context types must be defined @@ -70,7 +74,7 @@ * context type is included in this set as well as in the {@link #unchanged} * set.

*/ - String[] value() default { ThreadContext.APPLICATION, ThreadContext.CDI, ThreadContext.SECURITY }; + String[] value() default { ThreadContext.DEFAULTS }; /** *

Defines a set of thread context types that are essentially ignored,