コード例 #1
0
      public void makeSnapshots(Collection<InetAddress> endpoints) {
        try {
          snapshotLatch = new CountDownLatch(endpoints.size());
          IAsyncCallback callback =
              new IAsyncCallback() {
                @Override
                public boolean isLatencyForSnitch() {
                  return false;
                }

                @Override
                public void response(Message msg) {
                  RepairJob.this.snapshotLatch.countDown();
                }
              };
          for (InetAddress endpoint : endpoints)
            MessagingService.instance()
                .sendRR(
                    new SnapshotCommand(tablename, cfname, sessionName, false), endpoint, callback);
          snapshotLatch.await();
          snapshotLatch = null;
        } catch (InterruptedException e) {
          throw new RuntimeException(e);
        }
      }
コード例 #2
0
 public void terminate() {
   if (snapshotLatch != null) {
     while (snapshotLatch.getCount() > 0) snapshotLatch.countDown();
   }
 }