Hystrix is a latency and fault tolerance library designed to isolate points of access to remote systems, services and 3rd party libraries, stop cascading failure and enable resilience in complex distributed systems where failure is inevitable.
Hi. I'm using HystrixRequestVariableDefault for a variable that should be copied and shared between threads in the same request, and some times I get unexpectedly 'null' from calling get() on the variable. I found this weird since I initialize the HystrixRequestVariableDefault in the beginning of each request just after I do HystrixRequestContext.initializeContext(). Since this problem only occurs on some of the requests, and especially if I'm doing multiple requests at the same time, I would think that the problem is due to some data are not copied between threads. I am using my own implementation of HystrixConcurrencyStrategy where I override "wrapCallable" like this:
@Override
public <K> Callable<K> wrapCallable(Callable<K> c) {
HystrixRequestContext requestContext = HystrixRequestContext.getContextForCurrentThread();
CallContextData foo = CallContext.getData();
return () -> {
HystrixRequestContext.setContextOnCurrentThread(requestContext);
CallContext.setData(foo);
return c.call();
};
}
CallContext contains a HystrixRequestVariableDefault<CallContextData> which is where I get the nullpointer when I'm calling get() on that other places in the code. Any ideas on what I'm doing wrong?
java.util.concurrent.RejectedExecutionException: Task java.util.concurrent.FutureTask@7e3cc76f rejected from java.util.concurrent.ThreadPoolExecutor@398f6768[Running, pool size = 10, active threads = 10, queued tasks = 0, completed tasks = 32151]
The only way how to get rid of it is to increase max ThreadPool size?
Single
into a completable future. Single
to c.twitter.util.Future