Created
October 8, 2010 20:26
-
-
Save rsumbaly/617469 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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