213214215216217218219220221222223
} }, "sender thread"); senderThread.start(); senderLatch.acquire(); receiverLatch.acquire(); if (testFailed) { fail("Test failed by the sender thread. Watch for exception in logs");
292293294295296297298299300301302
Thread.sleep(3000); receiverThread.interrupt(); // wait for the reading thread to conclude latch.acquire(); log.trace("Expected message:" + expectedMessage); assertNull(expectedMessage); }
710711712713714715716717718719720
} } }, "consumer thread 2").start(); latch.acquire(); latch2.acquire(); assertEquals(5, received.size()); for(Iterator i = received.iterator(); i.hasNext(); ) { Message m = (Message)i.next();
535455565758596061
*/ public void doExecute(WorkerContext work) throws WorkException, InterruptedException { Latch latch = work.provideStartLatch(); execute(work); latch.acquire(); } }
495051525354555657
*/ public void doExecute(WorkerContext work) throws WorkException, InterruptedException { Latch latch = work.provideEndLatch(); execute(work); latch.acquire(); } }
3334353637383940
public void doExecute(WorkerContext work, Executor executor) throws WorkException, InterruptedException { Latch latch = work.provideEndLatch(); executor.execute(work); latch.acquire(); } }
public void doExecute(WorkerContext work, Executor executor) throws WorkException, InterruptedException { Latch latch = work.provideStartLatch(); executor.execute(work); latch.acquire(); } }
142143144145146147148149150151152
System.out.println("reader thread exits"); readerDone.release(); } // wait for the writer to finish writerDone.acquire(); assertNull("Node was removed", cache.get(FQN)); // If any assertion failed, throw on the AssertionFailedError
187188189190191192193194195196197
}, "SECOND"); secondThread.start(); // wait for both threads to finish secondDone.acquire(); firstDone.acquire(); // If any assertion failed, throw on the AssertionFailedError if (readerError != null) { throw readerError;
133134135136137138139140141142143