Hello!

While working on asynchronous retry support in spring-retry, we encountered a scenario, where some thread-fixed context should be propagated from a scheduler thread (that calls executor.execute(...)) to the worker thread (that actually executes the runnable).

We found the same pattern implemented in org.springframework.security.concurrent package of spring-security for SecurityContext: https://github.com/spring-projects/spring-security/tree/master/core/src/main/java/org/springframework/security/concurrent

The idea of the issue is to generalize this mechanics: extract common part to spring-core and use it for SecurityContext in spring-security, and for RetryContext in spring-retry.

Here is a prototype of an implementation: https://github.com/ashamukov/spring-security/pull/1 What do you think?

Thanks

cc: @rwinch

Comment From: bclozel

Sorry it took us so long to reply to this issue. I think that in the meantime, this has been implemented by the context-propagation project. We are already using this in Spring Framework and various Spring projects. I'm closing this issue as superseded.

Thanks!