@Test public void testMultipleClients() throws Exception { ExecutorService exec = Executors.newFixedThreadPool(NUM_THREADS); try { ExecutorCompletionService<Boolean> ecs = new ExecutorCompletionService<Boolean>(exec); for (int i = 0; i < NUM_THREADS; ++i) ecs.submit(new IdLockTestThread("client_" + i)); for (int i = 0; i < NUM_THREADS; ++i) { Future<Boolean> result = ecs.take(); assertTrue(result.get()); } idLock.assertMapEmpty(); } finally { exec.shutdown(); exec.awaitTermination(5000, TimeUnit.MILLISECONDS); } }
void assertMapEmpty() { assert map.size() == 0; }
IdLock { void assertMapEmpty() { assert map.size() == 0; } }
IdLock { void assertMapEmpty() { assert map.size() == 0; }  }
IdLock { void assertMapEmpty() { assert map.size() == 0; }  Entry getLockEntry(long id); void releaseLockEntry(Entry entry); }
IdLock { void assertMapEmpty() { assert map.size() == 0; }  Entry getLockEntry(long id); void releaseLockEntry(Entry entry);  }