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); } }
public void terminate() { if (snapshotLatch != null) { while (snapshotLatch.getCount() > 0) snapshotLatch.countDown(); } }