Package EDU.oswego.cs.dl.util.concurrent

Examples of EDU.oswego.cs.dl.util.concurrent.Latch.acquire()


      }, "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;
View Full Code Here


         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
     
View Full Code Here

      }

      Thread reader = new Reader();

      reader.start();
      readerFinishedLatch.acquire();
      cache.remove(fqn.getParent());
      assertFalse(cache.exists(fqn.getParent()));     
      readerLatch.release();
      reader.join();
View Full Code Here

      }

      Thread reader = new Reader();

      reader.start();
      readerFinishedLatch.acquire();
      cache.remove(fqn.getParent());
      assertFalse(cache.exists(fqn.getParent()));
      readerLatch.release();
      reader.join();
View Full Code Here

         {
            try
            {
               cache.getTransactionManager().begin();
               cache.put("/parent/child" + name, "key", "value");
               latch.acquire();
               cache.getTransactionManager().commit();
            }
            catch (Exception e)
            {
               e.printStackTrace();
View Full Code Here

    public void doExecute(WorkerContext work, Executor executor)
            throws WorkException, InterruptedException {
        Latch latch = work.provideEndLatch();
        executor.execute(work);
        latch.acquire();
    }
}
View Full Code Here

    public void doExecute(WorkerContext work, Executor executor)
            throws WorkException, InterruptedException {
        Latch latch = work.provideStartLatch();
        executor.execute(work);
        latch.acquire();
    }
}
View Full Code Here

                    }
                }
            });

            if( sync ) {
                latch.acquire();
            }
        }
        catch (InterruptedException e) {
            log.warn("Request to start checkpoint failed: " + e, e);
        }
View Full Code Here

            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);
            }
View Full Code Here

                }
            });

            synchChannel.write(packet.duplicate());
            synchChannel.flush();
            done.acquire();
           
        }

        public void dispose() {
            shutdownLatch.release();
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.