public final class ContextManagers extends Object
take snapshots of all contexts from
known ContextManager implementations.
Such a snapshot can be passed to a background task to allow the context to be
reactivated in that background thread, until it gets
closed again (preferably in a try-with-resources construct).
| Modifier and Type | Method and Description |
|---|---|
static ContextSnapshot |
createContextSnapshot()
This method is able to create a 'snapshot' from the current
active context from all known ContextManager
implementations. |
public static ContextSnapshot createContextSnapshot()
active context from all known ContextManager
implementations.
This snapshot is returned as a single object that can be temporarily
reactivated. Don't forget to close the reactivated
context once you're done, preferably in a try-with-resources construct.
Note about propagation accross physical node boundaries: ContextSnapshot instances can be serialized to and reactivated on another node under strict conditions:
context values must be serializable.ContextManager implementations that contain
active contexts must be registered on the target node as well
(but need not be serializable themselves).Copyright © 2016–2017 Talsma ICT. All rights reserved.