Package nl.talsmasoftware.context.threadlocal

Package for ThreadLocal specific classes.

AbstractThreadLocalContext

Base class for all our own context implementations.
It features:

  • Nesting; the previously active context is remembered when activating a new one, so it can be restored after the new context ends.
  • Predictable behaviour when used in a wrong way. Out-of-order closing can happen and will result in 'skipping' an already closed context as the currently active context. Closing from a different thread than where the context was created is wrong, however the AbstractThreadLocalContext will deal with it.