From 30c94adbeda0d22683342f75a11755866c80c81e Mon Sep 17 00:00:00 2001 From: Matt Jacobs Date: Mon, 13 Jun 2016 11:28:38 -0700 Subject: [PATCH] Removing bad tests of thread-interruption on HystrixObservableCommand --- .../concurrency/HystrixContextScheduler.java | 1 + .../hystrix/HystrixObservableCommandTest.java | 28 ++----------------- 2 files changed, 3 insertions(+), 26 deletions(-) diff --git a/hystrix-core/src/main/java/com/netflix/hystrix/strategy/concurrency/HystrixContextScheduler.java b/hystrix-core/src/main/java/com/netflix/hystrix/strategy/concurrency/HystrixContextScheduler.java index 8f137fc2c..f4151b6dc 100644 --- a/hystrix-core/src/main/java/com/netflix/hystrix/strategy/concurrency/HystrixContextScheduler.java +++ b/hystrix-core/src/main/java/com/netflix/hystrix/strategy/concurrency/HystrixContextScheduler.java @@ -195,6 +195,7 @@ private FutureCompleterWithConfigurableInterrupt(Future f, Func0 sho @Override public void unsubscribe() { + System.out.println(System.currentTimeMillis() + " : " + Thread.currentThread().getName() + " Unsubscribe happening, value of thunk : " + shouldInterruptThread.call()); if (shouldInterruptThread.call()) { f.cancel(true); } else { diff --git a/hystrix-core/src/test/java/com/netflix/hystrix/HystrixObservableCommandTest.java b/hystrix-core/src/test/java/com/netflix/hystrix/HystrixObservableCommandTest.java index b48d15808..8b550c376 100644 --- a/hystrix-core/src/test/java/com/netflix/hystrix/HystrixObservableCommandTest.java +++ b/hystrix-core/src/test/java/com/netflix/hystrix/HystrixObservableCommandTest.java @@ -2002,31 +2002,7 @@ public void testInterruptToObservableOnTimeout() throws InterruptedException { assertTrue(cmd.hasBeenInterrupted()); } - @Test - public void testDoNotInterruptObserveOnTimeoutIfPropertySaysNotTo() throws InterruptedException { - // given - InterruptibleCommand cmd = new InterruptibleCommand(new TestCircuitBreaker(), false); - - // when - cmd.observe().subscribe(); - - // then - Thread.sleep(500); - assertFalse(cmd.hasBeenInterrupted()); - } - - @Test - public void testDoNotInterruptToObservableOnTimeoutIfPropertySaysNotTo() throws InterruptedException { - // given - InterruptibleCommand cmd = new InterruptibleCommand(new TestCircuitBreaker(), false); - - // when - cmd.toObservable().subscribe(); - // then - Thread.sleep(500); - assertFalse(cmd.hasBeenInterrupted()); - } @Override protected void assertHooksOnSuccess(Func0> ctor, Action1> assertion) { @@ -5553,7 +5529,7 @@ public void call(Subscriber s) { s.onCompleted(); } - }).subscribeOn(Schedulers.computation()); + }).subscribeOn(Schedulers.io()); } @Override @@ -5586,7 +5562,7 @@ protected Observable construct() { @Override public Observable call() { try { - Thread.sleep(2000); + Thread.sleep(1000); } catch (InterruptedException e) { System.out.println("Interrupted!");