public class EventContextManager extends Object implements Service
Client code (such as persisters, dialects etc.) may use this service to propagate state amongst each other, as long
as they are within the same event cycle. States are identified by class objects which are used as key when accessing
the contextual map. If a given state type is accessed for the first time during an event cycle, its associated
EventStateLifecycle will be invoked to obtain a new instance of that state type.
Accessing the context when not being within the scope of a supported event cycle is illegal.
The service state is managed by listeners such as EventContextManagingAutoFlushEventListener which make sure
that the context is destroyed upon event cycle completion.
| Constructor and Description |
|---|
EventContextManager() |
| Modifier and Type | Method and Description |
|---|---|
<T> T |
get(Class<T> stateType)
Returns the state object of the given type.
|
boolean |
isActive()
Whether the event context currently is active (i.e.
|
static boolean |
isEventContextRequired(Map<Object,Object> settings,
SessionFactoryServiceRegistry serviceRegistry)
Whether any components will make use of the event context or not.
|
public static boolean isEventContextRequired(Map<Object,Object> settings, SessionFactoryServiceRegistry serviceRegistry)
public <T> T get(Class<T> stateType)
Note: Must only be called when being within a supported event cycle.
public boolean isActive()
Copyright © 2010-2017 Red Hat, Inc., Emmanuel Bernard and various contributors. All Rights Reserved.