code.onehippo.org is currently readonly. We are migrating to code.bloomreach.com, please continue working there on Monday 14/12. See: https://docs.bloomreach.com/display/engineering/GitLab

Commit 81d479e3 authored by Ard Schrijvers's avatar Ard Schrijvers

REPO-1886 Make sure thread really stopped before continuing

parent d65d2f67
......@@ -215,8 +215,9 @@ public class MemoryLockManagerTest {
countDownLatch2.countDown();
LockResource lockResource = null;
try {
final LockResource lockResource = futureLock.get();
lockResource = futureLock.get();
assertEquals("123", memoryLockManager.getLocks().iterator().next().getLockKey());
assertEquals(lockResource.getHolder().getName(), memoryLockManager.getLocks().iterator().next().getLockThread());
......@@ -227,6 +228,9 @@ public class MemoryLockManagerTest {
executorService.shutdown();
// The lockThread did not unlock but since the thread is not live any more, the lock
// should again be eligible for other threads
while (lockResource.getHolder().isAlive()) {
Thread.sleep(10);
}
try (Log4jInterceptor interceptor = Log4jInterceptor.onWarn().trap(MemoryLockManager.class).build()) {
assertEquals(0, memoryLockManager.getLocks().size());
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment