Netflix/Hystrix — pull request #190 by benjchristensen (2013-10-01 20:55:31+00:00)
Title: BugFix: ConcurrencyStrategy.wrapCallable was not being used on callbacks

The Rx Scheduler now correctly has state transferred to it with ConcurrencyStrategy.wrapCallable.

Note that if the Rx sequence ever migrates to another thread (such as using observeOn) it is up to the user to deal with this as Hystrix loses control of the flow at that point.

This change does ensure though that the initial threads the callbacks are performed on has the expected thread context.

The design of this code is not very elegant and uses a workaround similar to posting variables on a stack before a method uses them. I have used this approach because I do not want to add a 'wrapFunc2' method to the ConcurrencyStrategy as the use of Func2 is just an implementation detail internally and the users of the library should not have to replicate the effort for both Callable and Func2. Thus the internal code is a little odd but the public API is untouched.