Skip to content

Commit

Permalink
refactoring
Browse files Browse the repository at this point in the history
  • Loading branch information
vinothchandar committed Nov 21, 2011
1 parent f5bf7c5 commit cef05ca
Showing 1 changed file with 17 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -69,15 +69,12 @@ public InsufficientOperationalNodesException(String message,
List<Node> preferenceList,
List<Node> failedList,
Collection<? extends Throwable> failures) {
this(message.toString()
+ " Original replication set :"
+ stripNodeIds(replicationSet)
this(message.toString() + " Original replication set :" + stripNodeIds(replicationSet)
+ " Known failed nodes before operation :"
+ stripNodeIds(replicationSet.removeAll(preferenceList) ? replicationSet
: replicationSet)
+ stripNodeIds(difference(replicationSet, preferenceList))
+ " Estimated live nodes in preference list :" + stripNodeIds(preferenceList)
+ " New failed nodes during operation :"
+ stripNodeIds(failedList.removeAll(replicationSet) ? failedList : failedList),
+ stripNodeIds(difference(failedList, replicationSet)),
failures.size() > 0 ? failures.iterator().next() : null);
if(logger.isDebugEnabled()) {
logger.debug(this.getMessage());
Expand All @@ -102,4 +99,18 @@ private static List<Integer> stripNodeIds(List<Node> nodeList) {
}
return nodeidList;
}

/**
* Computes A-B
*
* @param listA
* @param listB
* @return
*/
private static List<Node> difference(List<Node> listA, List<Node> listB) {
listA.removeAll(listB);
System.out.println(">>>>>>List A" + listA);
System.out.println(">>>>>>List B" + listB);
return listA;
}
}

0 comments on commit cef05ca

Please sign in to comment.