From c8d2fece3ee193513fb5d4315831dd56db9561ed Mon Sep 17 00:00:00 2001 From: Matt Jacobs Date: Tue, 20 Jan 2015 12:00:59 -0800 Subject: [PATCH] Move onThreadStart execution hook after check that wrapping thread timed out --- .../src/main/java/com/netflix/hystrix/AbstractCommand.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/hystrix-core/src/main/java/com/netflix/hystrix/AbstractCommand.java b/hystrix-core/src/main/java/com/netflix/hystrix/AbstractCommand.java index 9f0600962..427b9d01b 100644 --- a/hystrix-core/src/main/java/com/netflix/hystrix/AbstractCommand.java +++ b/hystrix-core/src/main/java/com/netflix/hystrix/AbstractCommand.java @@ -512,8 +512,6 @@ private Observable getRunObservableDecoratedForMetricsAndErrorHandling(final @Override public void call(Subscriber 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 @@ -521,6 +519,8 @@ public void call(Subscriber s) { } 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()));