<commit_before>[![Build Status][ci-img]][ci]
[![Coverage Status][coveralls-img]][coveralls]
[![Maven Version][maven-img]][maven]
[![Javadoc][javadoc-img]][javadoc]

# Context propagation library

Propagate a snapshot of one or more `ThreadLocal` values into another thread.

Tools help automate propagation by capturing snapshots 
and ensuring proper closing of reactivated context snapshots:
- [`ContextAwareExecutorService`][ContextAwareExecutorService] that wraps any existing `ExecutorService`
- [`ContextAwareCompletableFuture`][ContextAwareCompletableFuture] that 
  propagates context snapshots into each successive `CompletionStage`.

## Terminology

### Context

A context contains a value. There is one _active_ context _per thread_.  
An `AbstractThreadLocalContext` base class is provided that allows nested contexts <commit_msg>Improve introduction paragraph<commit_after>[![Build Status][ci-img]][ci]
[![Coverage Status][coveralls-img]][coveralls]
[![Maven Version][maven-img]][maven]
[![Javadoc][javadoc-img]][javadoc]

# Context propagation library

Propagate a snapshot of one or more `ThreadLocal` values into another thread.

This library enables automatic propagation of several well-known ThreadLocal contexts 
by capturing a snapshot, reactivating it in another thread and ensuring proper 
cleanup after execution finishes:

- [`ContextAwareExecutorService`][ContextAwareExecutorService] 
  wrapping any existing `ExecutorService`.
- [`ContextAwareCompletableFuture`][ContextAwareCompletableFuture] 
  propagating context snapshots into each successive `CompletionStage`.

## Terminology

### Context

A context contains a value. There is one _active_ context _per thread_.  
An `AbstractThreadLocalContext` base class is provided that allows nested contexts 
{'fraction_non_alphanumeric': 0.08702975856260528, 'fraction_numerical': 0.0, 'mean_word_length': 6.92, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '160714', 'n_tokens_mistral': 494, 'n_tokens_neox': 462, 'n_words': 163}