Class InternalWorkScope
java.lang.Object
io.hypersistence.optimizer.core.event.InternalWorkScope
The
InternalWorkScope marks the current thread while the Optimizer does database work on its
own behalf, like persisting the events through the host application's SessionFactory.
Since that SessionFactory is decorated by the runtime scanner, this work would otherwise
trigger runtime events about the Optimizer itself (e.g., a StatementlessConnectionEvent for
every flush, as the events are written with plain JDBC), and persisting those events would trigger new
ones, over and over. The AbstractEventSender drops the events sent within this scope.
The scope is reentrant, and every enter() call must be paired with an exit() call
in a finally block.
- Since:
- 2.14.0
- Author:
- Vlad Mihalcea
-
Method Summary
-
Method Details
-
enter
public static void enter()Enter the internal work scope on the current thread. -
exit
public static void exit()Exit the internal work scope on the current thread. -
isActive
public static boolean isActive()Check whether the current thread is doing internal Optimizer work.- Returns:
trueif the current thread is within the internal work scope
-