}
SortedSet s = null;
try { // no other store access should occur in this block
HAMonitorService haMonitor = Globals.getHAMonitorService();
boolean takingoverCheck = (takeoverMsgs == null &&
Globals.getHAEnabled() && haMonitor != null &&
haMonitor.checkTakingoverDestination(this));
s = new TreeSet(new RefCompare());
while (msgs.hasMoreElements()) {
Packet p = (Packet)msgs.nextElement();
PacketReference pr =PacketReference.createReference(p, uid, null);
if (takeoverMsgs != null && takeoverMsgs.contains(pr)) {
pr = null;
continue;
}
if (takingoverCheck && haMonitor.checkTakingoverMessage(p)) {
pr = null;
continue;
}
if (neverExpire)
pr.overrideExpireTime(0);