From 638466af51647c72b4540fe343f219036837dfbb Mon Sep 17 00:00:00 2001 From: liningrui Date: Mon, 1 Feb 2021 16:15:25 +0800 Subject: [PATCH] tiny improve --- .../PausableScheduledThreadPoolTest.java | 20 +++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) 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 cebdd549..53d29844 100644 --- a/src/test/java/com/baidu/hugegraph/unit/threadpool/PausableScheduledThreadPoolTest.java +++ b/src/test/java/com/baidu/hugegraph/unit/threadpool/PausableScheduledThreadPoolTest.java @@ -37,26 +37,26 @@ public void testscheduleWithFixedDelay() throws InterruptedException { AtomicInteger counter = new AtomicInteger(0); executor.scheduleWithFixedDelay(() -> { System.out.println("counter: " + counter.incrementAndGet()); - }, 2, 2, TimeUnit.SECONDS); + }, 2L, 2L, TimeUnit.SECONDS); - Thread.sleep(4500); + Thread.sleep(4500L); Assert.assertEquals(2, counter.get()); // pause executor.pauseSchedule(); - Thread.sleep(2000); + Thread.sleep(2000L); Assert.assertEquals(2, counter.get()); // resume executor.resumeSchedule(); - Thread.sleep(2000); + Thread.sleep(2000L); Assert.assertEquals(3, counter.get()); // pause again executor.pauseSchedule(); executor.shutdown(); - executor.awaitTermination(3, TimeUnit.SECONDS); + executor.awaitTermination(3L, TimeUnit.SECONDS); } @Test @@ -66,24 +66,24 @@ public void testscheduleWithFixedRate() throws InterruptedException { AtomicInteger counter = new AtomicInteger(0); executor.scheduleAtFixedRate(() -> { System.out.println("counter: " + counter.incrementAndGet()); - }, 2, 2, TimeUnit.SECONDS); - Thread.sleep(4500); + }, 2L, 2L, TimeUnit.SECONDS); + Thread.sleep(4500L); Assert.assertEquals(2, counter.get()); // pause executor.pauseSchedule(); - Thread.sleep(2000); + Thread.sleep(2000L); Assert.assertEquals(2, counter.get()); // resume executor.resumeSchedule(); - Thread.sleep(2000); + Thread.sleep(2000L); Assert.assertEquals(4, counter.get()); // pause again executor.pauseSchedule(); executor.shutdownNow(); - executor.awaitTermination(3, TimeUnit.SECONDS); + executor.awaitTermination(3L, TimeUnit.SECONDS); } }