Package pl.morgwai.base.guice.scopes
Class ContextTracker<CtxT extends TrackableContext<CtxT>>
- java.lang.Object
-
- pl.morgwai.base.guice.scopes.ContextTracker<CtxT>
-
public class ContextTracker<CtxT extends TrackableContext<CtxT>> extends Object
Allows to track which thread is running within which context.
-
-
Constructor Summary
Constructors Constructor Description ContextTracker()
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static List<TrackableContext<?>>
getActiveContexts(List<ContextTracker<?>> trackers)
Retrieves all active contexts fromtrackers
.CtxT
getCurrentContext()
Returns context of the current thread.
-
-
-
Method Detail
-
getCurrentContext
public CtxT getCurrentContext()
Returns context of the current thread.- See Also:
getActiveContexts(List)
-
getActiveContexts
public static List<TrackableContext<?>> getActiveContexts(List<ContextTracker<?>> trackers)
Retrieves all active contexts fromtrackers
. The returned list can be then used as an argument toTrackableContext.executeWithinAll(List, Runnable)
to transfer the contexts when switching to another thread.Deriving libs should bind
List<ContextTracker<?>>
to an instance containing all possible trackers for use as an argument for this method.
-
-