diff --git a/src/main/java/com/baidu/hugegraph/threadpool/PausableScheduledThreadPool.java b/src/main/java/com/baidu/hugegraph/threadpool/PausableScheduledThreadPool.java index 86d54bcf..f3d88905 100644 --- a/src/main/java/com/baidu/hugegraph/threadpool/PausableScheduledThreadPool.java +++ b/src/main/java/com/baidu/hugegraph/threadpool/PausableScheduledThreadPool.java @@ -34,10 +34,6 @@ public class PausableScheduledThreadPool extends ScheduledThreadPoolExecutor { private volatile boolean paused = false; - public PausableScheduledThreadPool(int corePoolSize) { - super(corePoolSize); - } - public PausableScheduledThreadPool(int corePoolSize, ThreadFactory factory) { super(corePoolSize, factory); diff --git a/src/test/java/com/baidu/hugegraph/unit/threadpool/PausableScheduledThreadPoolTest.java b/src/test/java/com/baidu/hugegraph/unit/threadpool/PausableScheduledThreadPoolTest.java index c3c9d9dc..cebdd549 100644 --- a/src/test/java/com/baidu/hugegraph/unit/threadpool/PausableScheduledThreadPoolTest.java +++ b/src/test/java/com/baidu/hugegraph/unit/threadpool/PausableScheduledThreadPoolTest.java @@ -33,7 +33,7 @@ public class PausableScheduledThreadPoolTest { @Test public void testscheduleWithFixedDelay() throws InterruptedException { PausableScheduledThreadPool executor = - ExecutorUtil.newPausableScheduledThreadPool(2, "test"); + ExecutorUtil.newPausableScheduledThreadPool("test"); AtomicInteger counter = new AtomicInteger(0); executor.scheduleWithFixedDelay(() -> { System.out.println("counter: " + counter.incrementAndGet()); @@ -52,6 +52,9 @@ public void testscheduleWithFixedDelay() throws InterruptedException { Thread.sleep(2000); Assert.assertEquals(3, counter.get()); + // pause again + executor.pauseSchedule(); + executor.shutdown(); executor.awaitTermination(3, TimeUnit.SECONDS); } @@ -77,6 +80,9 @@ public void testscheduleWithFixedRate() throws InterruptedException { Thread.sleep(2000); Assert.assertEquals(4, counter.get()); + // pause again + executor.pauseSchedule(); + executor.shutdownNow(); executor.awaitTermination(3, TimeUnit.SECONDS); }