Skip to content

Commit

Permalink
Merge pull request #531 from mattrjacobs/timeout-in-calling-thread
Browse files Browse the repository at this point in the history
Move onThreadStart execution hook after check that wrapping thread timed out
  • Loading branch information
mattrjacobs committed Jan 20, 2015
2 parents 85e058c + c8d2fec commit 27fcc4a
Showing 1 changed file with 2 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -512,15 +512,15 @@ private Observable<R> getRunObservableDecoratedForMetricsAndErrorHandling(final

@Override
public void call(Subscriber<? super R> s) {
executionHook.onThreadStart(_self);
executionHook.onRunStart(_self);
if (isCommandTimedOut.get() == TimedOutStatus.TIMED_OUT) {
// the command timed out in the wrapping thread so we will return immediately
// and not increment any of the counters below or other such logic
s.onError(new RuntimeException("timed out before executing run()"));
} else {
// not timed out so execute
try {
executionHook.onThreadStart(_self);
executionHook.onRunStart(_self);
threadPool.markThreadExecution();
// store the command that is being run
endCurrentThreadExecutingCommand.set(Hystrix.startCurrentThreadExecutingCommand(getCommandKey()));
Expand Down

0 comments on commit 27fcc4a

Please sign in to comment.