Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make it possible to learn execution isolation strategy for the current command in HystrixConcurrencyStrategy #1564

Closed
dmak opened this issue May 4, 2017 · 2 comments

Comments

@dmak
Copy link

dmak commented May 4, 2017

I suggest to pass HystrixCommandProperties or ExecutionIsolationStrategy to HystrixConcurrencyStrategy#wrapCallable(Callable callable). For example, if ExecutionIsolationStrategy is SEMAPHORE then in my case the given callable can be returned as is, without being wrapped:

HystrixPlugins.getInstance().registerConcurrencyStrategy(new HystrixConcurrencyStrategy() {
    @Override
    public <T> Callable<T> wrapCallable(Callable<T> callable, ExecutionIsolationStrategy strategy) {
        if (strategy == ExecutionIsolationStrategy.SEMAPHORE) {
            return callable;
        }
        return new MyCallable<T>(callable);
    }
});
@mattrjacobs
Copy link
Contributor

Something similar came up in /#1548#1570, in which Hystrix was eagerly calling wrapCallable. After that change, it will now invoke wrapCallable only when:

  • putting the Hystrix-wrapped work onto a Hystrix thread (command is thread-isolated)
  • executing the fallback on a HystrixTimer thread
  • executing a HystrixCollapser-produced command on a HystrixTimer thread

So I don't believe that wrapCallable ever gets invoked on the user-provided work when the command is semaphore-isolated.

@dmak
Copy link
Author

dmak commented May 8, 2017

I agree. After doublechecking I confirm that wrapCallable is called only from pool thread.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants