Package java.util.concurrent

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


    }).when(member).submitSubprocedure(sub);
    Mockito.doAnswer(new Answer<Void>() {
      @Override
      public Void answer(InvocationOnMock invocation) throws Throwable {
        controller.sendMemberCompleted(sub);
        committed.countDown();
        return null;
      }
    }).when(member).receivedReachedGlobalBarrier(operationName);

    // start running the listener
View Full Code Here


      @Override
      public Void answer(InvocationOnMock invocation) throws Throwable {
        // pass on the error to the master
        invocation.callRealMethod();
        // then count down the got error latch
        coordinatorReceivedErrorLatch.countDown();
        return null;
      }
    }).when(coordinatorTask).receive(Mockito.any(ForeignException.class));

    // ----------------------------
View Full Code Here

            (
                new BackgroundCallback()
                {
                    public void processResult(CuratorFramework client, CuratorEvent event) throws Exception
                    {
                        latch.countDown();
                    }
                }
            ).forPath("/");
            Assert.assertTrue(timing.awaitLatch(latch));
        }
View Full Code Here

                @Override
                public void stateChanged(CuratorFramework client, ConnectionState newState)
                {
                    if ( newState == ConnectionState.LOST )
                    {
                        lostLatch.countDown();
                    }
                }
            };
            client.getConnectionStateListenable().addListener(listener);
View Full Code Here

                        @Override
                        public void stateChanged(CuratorFramework client, ConnectionState newState)
                        {
                            if ( newState == ConnectionState.LOST )
                            {
                                latch.countDown();
                            }
                        }
                    }
                );
View Full Code Here

    client.ensureTableFamilyExists(
            tableName.getBytes(Charsets.UTF_8), columnFamily).addCallbacks(
            new Callback<Object, Object>() {
              @Override
              public Object call(Object arg) throws Exception {
                latch.countDown();
                return null;
              }
            },
            new Callback<Object, Object>() {
              @Override
View Full Code Here

            },
            new Callback<Object, Object>() {
              @Override
              public Object call(Object arg) throws Exception {
                fail.set(true);
                latch.countDown();
                return null;
              }
            });

    try {
View Full Code Here

            }
          } catch (Exception e) {
            logger.error("Error doing takes", e);
            errors.add(e);
          } finally {
            consumerStopLatch.countDown();
          }
        }
      };
      t.setDaemon(true);
      t.start();
View Full Code Here

            Watcher tempWatcher = new Watcher()
            {
                @Override
                public void process(WatchedEvent event)
                {
                    latch.countDown();
                }
            };
           
            state.addParentWatcher(tempWatcher);
            long        startTimeMs = System.currentTimeMillis();
View Full Code Here

        final CountDownLatch latch = new CountDownLatch(1);
        Thread t = new Thread() {
          @Override
          public void run() {
            try {
              latch.countDown();
              metaSet.set(ct.waitForMeta(100000) !=  null);
            } catch (Exception e) {
              throw new RuntimeException(e);
            }
          }
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.