public static class MatsFactory.ContextLocal
extends java.lang.Object
MatsInitiator.MatsInitiate
initiate context and MatsStage
process context - currently getAttribute(Class, String...)
, which can provide you with the
transactionally demarcated SQL Connection if the Mats implementation provides such.Constructor and Description |
---|
ContextLocal() |
Modifier and Type | Method and Description |
---|---|
static <T> java.util.Optional<T> |
getAttribute(java.lang.Class<T> type,
java.lang.String... name)
Provides a ThreadLocal-accessible variant of the
ProcessContext.getAttribute(..) and MatsInitiate.getAttribute(..) methods: If the executing thread is within a
Mats initiation , or is currently processing a
MatsStage , the return value will be the same as if the relevant getAttribute(..) method
was invoked. |
public static <T> java.util.Optional<T> getAttribute(java.lang.Class<T> type, java.lang.String... name)
ProcessContext.getAttribute(..)
and MatsInitiate.getAttribute(..)
methods: If the executing thread is within a
Mats initiation
, or is currently processing a
MatsStage
, the return value will be the same as if the relevant getAttribute(..)
method
was invoked. Otherwise, if the current thread is not processing a stage or performing an initiation,
Optional.empty()
is returned.
If the Mats implementation has a transactional SQL Connection, it shall be available by
ContextLocal.getAttribute(Connection.class)
when in the relevant contexts (init or stage).T
- The type of the attribute.type
- The expected type of the attributename
- The (optional) (hierarchical) name(s) of the attribute.Optional.empty()
is
always returned.MatsEndpoint.ProcessContext.getAttribute(Class, String...)
,
MatsInitiator.MatsInitiate.getAttribute(Class, String...)
,
MatsFactory.getDefaultInitiator()