Skip to content

Instantly share code, notes, and snippets.

@rsumbaly
Created October 8, 2010 20:26
Show Gist options
  • Save rsumbaly/617469 to your computer and use it in GitHub Desktop.
Save rsumbaly/617469 to your computer and use it in GitHub Desktop.
nodes = new ArrayList<Node>();
LinkedList<Integer> zoneProximityList = this.clientZone.getProximityList();
if(pipeline.getOperation() != Operation.PUT) {
// GET, GET_VERSIONS, DELETE
// Add a node from every zone
for(int index = 0; index < pipelineData.getZonesRequired(); index++) {
List<Node> zoneNodes = zoneIdToNode.get(zoneProximityList.get(index));
if(zoneNodes != null && zoneNodes.size() > 0) {
nodes.add(zoneNodes.remove(0));
}
}
}
// Add the rest, starting with client zone...
List<Node> clientZoneNodes = zoneIdToNode.get(clientZone.getId());
if(clientZoneNodes != null && clientZoneNodes.size() > 0)
nodes.addAll(clientZoneNodes);
// ...followed by other zones sorted by proximity list
for(int index = 0; index < zoneProximityList.size(); index++) {
List<Node> zoneNodes = zoneIdToNode.get(zoneProximityList.get(index));
if(zoneNodes != null && zoneNodes.size() > 0) {
nodes.addAll(zoneNodes);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment