java.lang.Object
io.inverno.mod.base.Scope<T>
io.inverno.mod.base.concurrent.ReactorScope<T>
- Type Parameters:
T
- the type of the scoped instances
A reactor scope is used to provide bean instances bound to the current reactor thread.
This implementation is backed by a FastThreadLocal
.
- Since:
- 1.2
- Author:
- Jeremy Kuhn
-
Constructor Summary
-
Method Summary
-
Constructor Details
-
ReactorScope
public ReactorScope()Creates a thread scope.
-
-
Method Details
-
hookOnGet
Optional hook executed when an instance is retrieved.
- Parameters:
instance
- the instance
-
get
Returns the instance bound to the current reactor thread.
If no instance is bound to the key, a new instance is created and kept in the scope.
- Returns:
- the instance
- Throws:
IllegalStateException
- when the method is invoked outside the reactor
-
remove
public final void remove()Removes the instance currently bound to the current thread.
- Throws:
IllegalStateException
- when the method is invoked outside the reactor
-