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

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


            }
            finally
            {
               System.out.println("writer thread exits");
               readerCanRead.release();
               writerDone.release();
            }
         }
      }, "WRITER");
      writerThread.start();
View Full Code Here


            }
            finally
            {
               System.out.println("writer thread exits");
               readerCanRead.release();
               writerDone.release();
            }
         }
      }, "WRITER");
      writerThread.start();
     
View Full Code Here

                starters[i].start();
            }

            // now have the lot start simultaneously
            TestingUtil.sleepThread(500);
            latch.release();

            // allow a generous sleep time
            TestingUtil.blockUntilViewsReceived(caches, 180000);
            TestingUtil.sleepThread(1000 * numCaches);

 
View Full Code Here

         {
            try
            {
               cache.getTransactionManager().begin();
               cache.get(fqn, "k"); // read
               readerFinishedLatch.release();
               readerLatch.acquire(); // wait
               cache.getTransactionManager().commit();
            }
            catch (Exception e)
            {
View Full Code Here

            try
            {
               cache.getTransactionManager().begin();
               cache.put(Fqn.ROOT, "x", "y"); // a dummy put to ensure that validation occurs
               cache.get(fqn, "k"); // read
               readerFinishedLatch.release();
               readerLatch.acquire(); // wait
               cache.getTransactionManager().commit();
            }
            catch (Exception e)
            {
View Full Code Here

      Thread two = new ConcurrentCreator("two");

      one.start();
      two.start();

      latch.release();

      one.join();
      two.join();

      assertTrue("Should not have caught any exceptions!!", exceptions.isEmpty());
View Full Code Here

            new Thread() {
                public void run() {
                    try {
                        inDemand.whenEqual(value, new Runnable() {
                            public void run() {
                                change.release();
                            }
                        });
                    } catch (InterruptedException e) {
                    }                   
                }
View Full Code Here

        final Latch accepted = new Latch();
        asynchChannelServer.setAcceptListener(new AcceptListener() {
            public void onAccept(Channel channel) {
                serverAsynchChannel = SynchToAsynchChannelAdapter.adapt(channel);
                channel.dispose();
                accepted.release();
            }
            public void onAcceptError(IOException error) {
                error.printStackTrace();
            }
        });
View Full Code Here

                        }
                        log.debug("Checkpoint done.");
                    } finally {
                        for (Iterator iter = listners.iterator(); iter.hasNext();) {
                            Latch latch = (Latch) iter.next();
                            latch.release();
                        }
                    }
                }
            });
View Full Code Here

                                System.out.println("Peer disconnected.");
                                dispose();
                            }
                            c += p.remaining();
                        }
                        done.release();
                    } catch (IOException e) {
                        e.printStackTrace();
                    }
                }
            });
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.