Skip to content

Commit c8d2fec

Browse files
author
Matt Jacobs
committed
Move onThreadStart execution hook after check that wrapping thread timed out
1 parent f0c4c90 commit c8d2fec

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

hystrix-core/src/main/java/com/netflix/hystrix/AbstractCommand.java

+2-2
Original file line numberDiff line numberDiff line change
@@ -512,15 +512,15 @@ private Observable<R> getRunObservableDecoratedForMetricsAndErrorHandling(final
512512

513513
@Override
514514
public void call(Subscriber<? super R> s) {
515-
executionHook.onThreadStart(_self);
516-
executionHook.onRunStart(_self);
517515
if (isCommandTimedOut.get() == TimedOutStatus.TIMED_OUT) {
518516
// the command timed out in the wrapping thread so we will return immediately
519517
// and not increment any of the counters below or other such logic
520518
s.onError(new RuntimeException("timed out before executing run()"));
521519
} else {
522520
// not timed out so execute
523521
try {
522+
executionHook.onThreadStart(_self);
523+
executionHook.onRunStart(_self);
524524
threadPool.markThreadExecution();
525525
// store the command that is being run
526526
endCurrentThreadExecutingCommand.set(Hystrix.startCurrentThreadExecutingCommand(getCommandKey()));

0 commit comments

Comments
 (0)