Top Description Methods
org.eclipse.microprofile.context.spi

public Interface ThreadContextSnapshot

Annotations
@FunctionalInterface

An immutable snapshot of a particular type of thread context.

The captured context represented by this snapshot can be applied to any number of threads, including concurrently.

Any state that is associated with context applied to a thread should be kept, not within the snapshot, but within the distinct ThreadContextController instance it creates each time it is applied to a thread.

Method Summary

Modifier and TypeMethod and Description
public ThreadContextController

Returns:

controller instance representing a single application of this thread context snapshot to a thread.
begin
()

Applies the captured thread context snapshot to the current thread and returns a distinct ThreadContextController instance.

Method Detail

beginback to summary
public ThreadContextController begin()

Applies the captured thread context snapshot to the current thread and returns a distinct ThreadContextController instance. The ThreadContextController instance tracks the context's life cycle, including any state that is associated with it or that is necessary for restoring the previous context.

For each invocation of this method, the invoker (typically a ManagedExecutor or ThreadContext instance) must invoke the endContext method on the corresponding ThreadContextController instance exactly once, such that the previous context is restored on the thread. If the invoker sequentially begins multiple ThreadContextController instances on a thread, it must invoke the corresponding endContext methods in reverse order.

Returns:ThreadContextController

controller instance representing a single application of this thread context snapshot to a thread.