194195196197198199200201202203204
}, "WRITER"); writerThread.start(); // wait for both threads to finish readerDone.acquire(); writerDone.acquire(); // If any assertion failed, throw on the AssertionFailedError if (readerError != null) { throw readerError;
294295296297298299300301302303304
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
148149150151152153154155156157158
} Thread reader = new Reader(); reader.start(); readerFinishedLatch.acquire(); cache.remove(fqn.getParent()); assertFalse(cache.exists(fqn.getParent())); readerLatch.release(); reader.join();
191192193194195196197198199200201
222223224225226227228229230231232
{ try { cache.getTransactionManager().begin(); cache.put("/parent/child" + name, "key", "value"); latch.acquire(); cache.getTransactionManager().commit(); } catch (Exception e) { e.printStackTrace();
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(); } }
389390391392393394395396397398399
} } }); if( sync ) { latch.acquire(); } } catch (InterruptedException e) { log.warn("Request to start checkpoint failed: " + e, e); }
146147148149150151152153154155156
if( timeout == NO_WAIT_TIMEOUT ) { dispatcher.add(FLUSH_COMMAND); } else if( timeout == WAIT_FOREVER_TIMEOUT ) { Latch l = new Latch(); dispatcher.add(l); l.acquire(); } else { Latch l = new Latch(); dispatcher.add(l); l.attempt(timeout); }
240241242243244245246247248249250
} }); synchChannel.write(packet.duplicate()); synchChannel.flush(); done.acquire(); } public void dispose() { shutdownLatch.release();