Package nl.talsmasoftware.context

Main package defining the core context-propagation concepts in this library

Context

A context contains a value.
There can be one active context per thread. A context remains active until it is closed or another context is activated in that thread.

An AbstractThreadLocalContext base class is provided that supports nested contexts and provides predictable behaviour for out-of-order closing.

ContextManager

Manages the active context. Can initialize a new context and provides access to the active context.

ContextSnapshot

A snapshot contains the current value from all known context managers.
These values can be reactivated in another thread.
Reactivated snapshots must be closed to avoid leaking context.

All context aware utility classes in this library are tested to make sure they reactivate and close snapshots in a safe way.

ContextManagers

Utility class that detects available context managers and lets you take a snapshot of all active contexts at once.

Author:
Sjoerd Talsma