This is an automated email from the ASF dual-hosted git repository.
zhouxj pushed a commit to branch develop
in repository https://gitbox.apache.org/repos/asf/geode.git
The following commit(s) were added to refs/heads/develop by this push:
new 9073f6e GEODE-6321: The test is expecting shutdown took more than 4
seconds, (#3665)
9073f6e is described below
commit 9073f6ef91ff85ccbb7d7d7da324981d7a9c190b
Author: Xiaojian Zhou <[email protected]>
AuthorDate: Tue Jun 4 17:07:11 2019 -0700
GEODE-6321: The test is expecting shutdown took more than 4 seconds, (#3665)
but mixed delay and sleep cannot guarentee to run for 4 seconds.
---
.../ScheduledThreadPoolExecutorWithKeepAliveJUnitTest.java | 14 ++++++--------
1 file changed, 6 insertions(+), 8 deletions(-)
diff --git
a/geode-core/src/integrationTest/java/org/apache/geode/internal/ScheduledThreadPoolExecutorWithKeepAliveJUnitTest.java
b/geode-core/src/integrationTest/java/org/apache/geode/internal/ScheduledThreadPoolExecutorWithKeepAliveJUnitTest.java
index d52ee93..d716cc5 100644
---
a/geode-core/src/integrationTest/java/org/apache/geode/internal/ScheduledThreadPoolExecutorWithKeepAliveJUnitTest.java
+++
b/geode-core/src/integrationTest/java/org/apache/geode/internal/ScheduledThreadPoolExecutorWithKeepAliveJUnitTest.java
@@ -212,18 +212,16 @@ public class
ScheduledThreadPoolExecutorWithKeepAliveJUnitTest {
ex.schedule(new Runnable() {
@Override
public void run() {
- try {
- Thread.sleep(2000);
- } catch (InterruptedException e) {
- fail("interrupted");
- }
+ // The testShutdown2 will test only with sleep, no deley
+ // let testShutdown to test only with delay
+ System.out.println("Finished scheduled task");
}
- }, 2, TimeUnit.SECONDS);
- ex.shutdown();
+ }, 4, TimeUnit.SECONDS);
long start = System.nanoTime();
+ ex.shutdown();
assertTrue(ex.awaitTermination(10, TimeUnit.SECONDS));
long elapsed = System.nanoTime() - start;
- assertTrue("Shutdown did not wait to task to complete. Only waited "
+ assertTrue("Shutdown did not wait for task to complete. Only waited "
+ TimeUnit.NANOSECONDS.toMillis(elapsed), TimeUnit.SECONDS.toNanos(4)
< elapsed + SLOP);
}