java.lang.Object
it.tidalwave.util.spi.ContextSnapshot
A facility that takes a snapshot of the contexts that are current at creation time and make them available later.
- Author:
- Fabrizio Giudici
-
Constructor Summary
ConstructorsConstructorDescriptionContextSnapshot
(Object owner) Creates a new instance and samples the currently available contexts. -
Method Summary
Modifier and TypeMethodDescriptionReturns the previously sampled contexts.<V,
T extends Throwable>
VrunWithContexts
(Task<V, T> task) Runs aTask
associated with the sampled contexts.toString()
-
Constructor Details
-
ContextSnapshot
Creates a new instance and samples the currently available contexts.- Parameters:
owner
- the owner
-
-
Method Details
-
getContexts
Returns the previously sampled contexts.- Returns:
- the contexts
-
runWithContexts
Runs aTask
associated with the sampled contexts.- Type Parameters:
V
- the type of the result valueT
- the type of the exception- Parameters:
task
- the task- Returns:
- the value produced by the task
- Throws:
T
- the exception(s) thrown by the task
-
toString
-