I am currently working on event/activity logging system, which I’m implementing as an aspect using method interceptors. At the moment, the system/framework assumes that each method is one activity but I want to extend this so that an activity can span multiple method invocations. In order to do this, the first approach that come to mind is by providing some context to all the related method calls. However, I only know a way to do this if all method invocations are within the context of a single thread (like Log4J’s MDC/NDC). Is there any way to provide context for multiple threads (probably without the code being aware of multithreading)?
I am currently working on event/activity logging system, which I’m implementing as an aspect
Share
I stumbled upon InheritableThreadLocal, which I think could work for my code. This is assuming that all related threads are spawned from some parent/root thread (which I think is a safe assumption).