From d0ae71f62cd29950cf3002cbaa521e6c1821a3fb Mon Sep 17 00:00:00 2001 From: Xiaoyan Lin Date: Fri, 27 May 2016 23:20:24 -0700 Subject: [PATCH] Fix compiler errors for 9b22097f7e7c878bd18c95d548ad36b5c9ae9e5c Motivation: Branch 4.0 is broken as 9b22097f7e7c878bd18c95d548ad36b5c9ae9e5c uses 4.1 APIs in tests. Modifications: Fix the tests by using 4.0 APIs. Result: Branch 4.0 is back to green. --- .../util/concurrent/DefaultPromiseTest.java | 23 +++++-------------- 1 file changed, 6 insertions(+), 17 deletions(-) diff --git a/common/src/test/java/io/netty/util/concurrent/DefaultPromiseTest.java b/common/src/test/java/io/netty/util/concurrent/DefaultPromiseTest.java index 29ca951db8..888944954e 100644 --- a/common/src/test/java/io/netty/util/concurrent/DefaultPromiseTest.java +++ b/common/src/test/java/io/netty/util/concurrent/DefaultPromiseTest.java @@ -25,7 +25,6 @@ import java.util.concurrent.BlockingQueue; import java.util.concurrent.CancellationException; import java.util.concurrent.CountDownLatch; import java.util.concurrent.ExecutionException; -import java.util.concurrent.ExecutorService; import java.util.concurrent.Executors; import java.util.concurrent.LinkedBlockingQueue; import java.util.concurrent.TimeUnit; @@ -79,16 +78,11 @@ public class DefaultPromiseTest { @Test public void testNoStackOverflowErrorWithDefaultEventExecutorA() throws Exception { - ExecutorService executorService = Executors.newSingleThreadExecutor(); + EventExecutor executor = new DefaultEventExecutor(null, new DefaultThreadFactory("test")); try { - EventExecutor executor = new DefaultEventExecutor(executorService); - try { - testStackOverFlowErrorChainedFuturesA(Math.min(stackOverflowDepth << 1, Integer.MAX_VALUE), executor); - } finally { - executor.shutdownGracefully(0, 0, TimeUnit.MILLISECONDS); - } + testStackOverFlowErrorChainedFuturesA(Math.min(stackOverflowDepth << 1, Integer.MAX_VALUE), executor); } finally { - executorService.shutdown(); + executor.shutdownGracefully(0, 0, TimeUnit.MILLISECONDS); } } @@ -100,16 +94,11 @@ public class DefaultPromiseTest { @Test public void testNoStackOverflowErrorWithDefaultEventExecutorB() throws Exception { - ExecutorService executorService = Executors.newSingleThreadExecutor(); + EventExecutor executor = new DefaultEventExecutor(null, new DefaultThreadFactory("test")); try { - EventExecutor executor = new DefaultEventExecutor(executorService); - try { - testStackOverFlowErrorChainedFuturesB(Math.min(stackOverflowDepth << 1, Integer.MAX_VALUE), executor); - } finally { - executor.shutdownGracefully(0, 0, TimeUnit.MILLISECONDS); - } + testStackOverFlowErrorChainedFuturesB(Math.min(stackOverflowDepth << 1, Integer.MAX_VALUE), executor); } finally { - executorService.shutdown(); + executor.shutdownGracefully(0, 0, TimeUnit.MILLISECONDS); } }