Examples of countDown()


Examples of java.util.concurrent.CountDownLatch.countDown()

    final AsyncResult<org.deftserver.web.http.client.HttpResponse> cb =
      new AsyncResult<org.deftserver.web.http.client.HttpResponse>() {

      public void onSuccess(org.deftserver.web.http.client.HttpResponse response) { }

      public void onFailure(Throwable e) { if (e instanceof ConnectException) latch.countDown(); }
    };
    // make sure that the http.fetch(..) is invoked from the ioloop thread
    IOLoop.INSTANCE.addCallback(new AsyncCallback() { public void onCallback() { http.fetch(url, cb); }});
    latch.await(5, TimeUnit.SECONDS);
    assertEquals(0, latch.getCount());
View Full Code Here

Examples of java.util.concurrent.CountDownLatch.countDown()

         };

         workers[i].start();
      }

      latch.countDown();

      for (Thread t : workers)
         t.join();

      for (Exception e : exceptions)
View Full Code Here

Examples of java.util.concurrent.CountDownLatch.countDown()

      ViewChangeListener viewChangeListener = new ViewChangeListener(cache2);
      stopCache1(false);
      cache2.getInvocationContext().getOptionOverrides().setCacheModeLocal(true);
      cache2.getInvocationContext().getOptionOverrides().setSuppressPersistence(true);
      cache2.put(fqn("/e/i"), "i-key", "i-value");
      startPushLatch.countDown();
      viewChangeListener.waitForViewChange(60, TimeUnit.SECONDS);

      waitForPushStateCompletion(scl2.getPushStateFuture());

      assertTrue(cl2.exists(fqn("/a")));
View Full Code Here

Examples of java.util.concurrent.CountDownLatch.countDown()

      ssdc.setPushStateWhenCoordinatorTimeout(1000);
      final MockSingletonStoreCacheLoader mscl = new MockSingletonStoreCacheLoader(pushStateCanFinish, null, ssdc);

      Future f = Executors.newSingleThreadExecutor().submit(createActiveStatusChanger(mscl));
      pushStateCanFinish.await(2000, TimeUnit.MILLISECONDS);
      pushStateCanFinish.countDown();

      try
      {
         f.get();
         fail("Should have timed out");
View Full Code Here

Examples of java.util.concurrent.CountDownLatch.countDown()

            t[j] = new Worker(latch, NUM_FQNS_PER_RUN * i,
                  NUM_FQNS_PER_RUN, modificationsPerTx);
            t[j].start();
         }
         // fire the workers to start processing
         latch.countDown();
         // wait for all workers to complete
         for (Worker worker : t)
         {
            worker.join();
         }
View Full Code Here

Examples of java.util.concurrent.CountDownLatch.countDown()

            }
         }
      };
      reader3.start();

      latch.countDown();
      reader1.join();
      reader2.join();
      reader3.join();
      evictor.join();
      writer.join();
View Full Code Here

Examples of java.util.concurrent.CountDownLatch.countDown()

         };
         threads[i].start();
      }

      // start the threads
      latch.countDown();

      // wait for threads to join
      for (Thread t : threads) t.join();

      // now test results
View Full Code Here

Examples of java.util.concurrent.CountDownLatch.countDown()

               writerFailed = true;
            }
            finally
            {
               readerCanRead.countDown();
               writerDone.countDown();
            }
         }
      }, "WRITER");
      writerThread.start();
View Full Code Here

Examples of java.util.concurrent.CountDownLatch.countDown()

            }
            finally
            {
               secondCanWrite.countDown();
               secondCanRead.countDown();
               firstDone.countDown();
            }
         }
      }, "FIRST");
      firstThread.start();
View Full Code Here

Examples of java.util.concurrent.CountDownLatch.countDown()

         }
      };
      writer2.start();


      latch.countDown();
      reader1.join();
      reader2.join();
      remover1.join();
      remover2.join();
      writer1.join();
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.