public static int removeStaleReplicas(String reconcilingInstance,
SessionStoreInterface storeInterface) {
Set<String> replicasToBePurged = new HashSet<String>();
BaseCache replicaCache = storeInterface.getReplicaCache();
Iterator<ReplicationState> replicatedSessions = replicaCache.values();
List lbEnabledList = getLbEnabledList();
while (replicatedSessions.hasNext()) {
ReplicationState replica = replicatedSessions.next();
if (canRemoveReplica(replica, reconcilingInstance, lbEnabledList)) {
replicasToBePurged.add((String) replica.getId());