@Test public void testChooseSinks() { List<ServerName> serverNames = Lists.newArrayList(); for (int i = 0; i < 20; i++) { serverNames.add(mock(ServerName.class)); } when(replicationPeers.getRegionServersOfConnectedPeer(PEER_CLUSTER_ID)) .thenReturn(serverNames); sinkManager.chooseSinks(); assertEquals(2, sinkManager.getSinks().size()); }
void chooseSinks() { List<ServerName> slaveAddresses = replicationPeers.getRegionServersOfConnectedPeer(peerClusterId); Collections.shuffle(slaveAddresses, random); int numSinks = (int) Math.ceil(slaveAddresses.size() * ratio); sinks = slaveAddresses.subList(0, numSinks); lastUpdateToPeers = System.currentTimeMillis(); badReportCounts.clear(); }
ReplicationSinkManager { void chooseSinks() { List<ServerName> slaveAddresses = replicationPeers.getRegionServersOfConnectedPeer(peerClusterId); Collections.shuffle(slaveAddresses, random); int numSinks = (int) Math.ceil(slaveAddresses.size() * ratio); sinks = slaveAddresses.subList(0, numSinks); lastUpdateToPeers = System.currentTimeMillis(); badReportCounts.clear(); } }
ReplicationSinkManager { void chooseSinks() { List<ServerName> slaveAddresses = replicationPeers.getRegionServersOfConnectedPeer(peerClusterId); Collections.shuffle(slaveAddresses, random); int numSinks = (int) Math.ceil(slaveAddresses.size() * ratio); sinks = slaveAddresses.subList(0, numSinks); lastUpdateToPeers = System.currentTimeMillis(); badReportCounts.clear(); } ReplicationSinkManager(HConnection conn, String peerClusterId,
      ReplicationPeers replicationPeers, Configuration conf); }
ReplicationSinkManager { void chooseSinks() { List<ServerName> slaveAddresses = replicationPeers.getRegionServersOfConnectedPeer(peerClusterId); Collections.shuffle(slaveAddresses, random); int numSinks = (int) Math.ceil(slaveAddresses.size() * ratio); sinks = slaveAddresses.subList(0, numSinks); lastUpdateToPeers = System.currentTimeMillis(); badReportCounts.clear(); } ReplicationSinkManager(HConnection conn, String peerClusterId,
      ReplicationPeers replicationPeers, Configuration conf); SinkPeer getReplicationSink(); void reportBadSink(SinkPeer sinkPeer); }
ReplicationSinkManager { void chooseSinks() { List<ServerName> slaveAddresses = replicationPeers.getRegionServersOfConnectedPeer(peerClusterId); Collections.shuffle(slaveAddresses, random); int numSinks = (int) Math.ceil(slaveAddresses.size() * ratio); sinks = slaveAddresses.subList(0, numSinks); lastUpdateToPeers = System.currentTimeMillis(); badReportCounts.clear(); } ReplicationSinkManager(HConnection conn, String peerClusterId,
      ReplicationPeers replicationPeers, Configuration conf); SinkPeer getReplicationSink(); void reportBadSink(SinkPeer sinkPeer);  }