Why does this happen I mean that Thread.interrupt causes the ThreadLocal variables lost the value ? It should be running in the same thread. Also it does not mention in the Java API docs [1].
I do agree that the compensate method could have this issue since it has been invoking in the different thread. But for the Zhang Lei's proposal for the timeout solution, I don't think this could happen or maybe I misunderstand something else. Regards, Zheng Feng [1] https://docs.oracle.com/javase/7/docs/api/java/lang/Thread.html#interrupt() Willem Jiang <willem.ji...@gmail.com> 于2019年4月26日周五 下午6:41写道: > Yeah, that's exactly what want to say. > > Willem Jiang > > Twitter: willemjiang > Weibo: 姜宁willem > > On Fri, Apr 26, 2019 at 4:14 PM Zhang Lei <zhang_...@boco.com.cn> wrote: > > > > Hi, Willem Jiang > > > > You mean that Thread.interrupt will cause the variables in the thread to > be lost, so we need to provide a way for the user to restore the thread > variables? > > > > Lei Zhang > > > > > 在 2019年4月26日,上午8:36,Willem Jiang <willem.ji...@gmail.com> 写道: > > > > > > We could introduce a Context object to let the user copy the thread > > > local variable across the thread. > > > The context can be inject into the method which is annotated with > > > Compasiable. We may need to inject the Context object into the remote > > > service caller. > > >