Open ghostganz opened 7 years ago
More of the same problem: HystrixObservableCommand.Setter
has protected fields threadPoolKey
and threadPoolPropertiesDefaults
, but there's no way to change them.
Is that a bug? Or is there any other reason? I want to use the Observable in THREAD mode, but I can't change the thread pool config。
I can't think of any reason you would use a thread pool with HystrixObservableCommand
. There's an outstanding issue to deprecate and remove this API (#1200), but that hasn't been done yet.
I found solution in https://github.com/Netflix/Hystrix/issues/805#issuecomment-109371037, thanks a lot.
We have, for historical reasons, things that use Observable although they aren't completely asynchronous, so we need threads to have those things running well.
In an ideal world that wouldn't be needed, but ...
Using HystrixCommand annotation on a method returning Observable, the "threadPoolProperties" are ignored.
https://github.com/Netflix/Hystrix/blob/master/hystrix-contrib/hystrix-javanica/src/main/java/com/netflix/hystrix/contrib/javanica/command/GenericSetterBuilder.java
It's because the build() method (for non-Observables) copies those settings, but they are ignored in the buildObservableCommandSetter(). There's a TODO there hinting at the problem.
Most users won't notice this, since the isolation strategy doesn't default to THREAD for observables.