Cleaning context with interceptors

Hi,

I’m implementing an interceptor to propagate the authenticated user through a workflow. The authenticated user data is stored in a ThreadLocal, and due to constraints in external code and widespread usage, this approach can’t be changed.

Could you clarify which methods in the interceptor are called immediately before and after a workflow or activity execution? Specifically, I need to know where to properly clear the ThreadLocal to avoid any potential memory leaks.

Thank you!