log.trace(this + " synchronized failover browser " + browserDelegate);
}
}
ConnectionState connState = (ConnectionState)getParent();
ResourceManager rm = connState.getResourceManager();
// We need to failover from one session ID to another in the resource manager
rm.handleFailover(connState.getServerID(), oldSessionID, newState.sessionID);
List ackInfos = Collections.EMPTY_LIST;
if (!isTransacted() || (isXA() && getCurrentTxId() == null))
{
// TODO - the check "(isXA() && getCurrentTxId() == null)" shouldn't be necessary any more
// since xa sessions no longer fall back to non transacted
// Non transacted session or an XA session with no transaction set (it falls back
// to AUTO_ACKNOWLEDGE)
log.trace(this + " is not transacted (or XA with no transaction set), " +
"retrieving deliveries from session state");
// We remove any unacked non-persistent messages - this is because we don't want to ack
// them since the server won't know about them and will get confused
if (acknowledgeMode == Session.CLIENT_ACKNOWLEDGE)
{
for(Iterator i = getClientAckList().iterator(); i.hasNext(); )
{
DeliveryInfo info = (DeliveryInfo)i.next();
if (!info.getMessageProxy().getMessage().isReliable())
{
i.remove();
log.trace("removed non persistent delivery " + info);
}
}
ackInfos = getClientAckList();
}
else
{
DeliveryInfo autoAck = getAutoAckInfo();
if (autoAck != null)
{
if (!autoAck.getMessageProxy().getMessage().isReliable())
{
// unreliable, discard
setAutoAckInfo(null);
}
else
{
// reliable
ackInfos = new ArrayList();
ackInfos.add(autoAck);
}
}
}
log.trace(this + " retrieved " + ackInfos.size() + " deliveries");
}
else
{
// Transacted session - we need to get the acks from the resource manager. BTW we have
// kept the old resource manager.
ackInfos = rm.getDeliveriesForSession(getSessionID());
}
List recoveryInfos = new ArrayList();
if (!ackInfos.isEmpty())
{