List sces = new ArrayList();
for(Iterator i = endpoints.entrySet().iterator(); i.hasNext(); )
{
Map.Entry entry = (Map.Entry)i.next();
ConnectionEndpoint sce = (ConnectionEndpoint)entry.getValue();
sces.add(sce);
}
// Now close the end points - this will result in a callback into unregisterConnection
// to remove the data from the jmsClients and sessions maps.
// Note we do this outside the loop to prevent ConcurrentModificationException
for(Iterator i = sces.iterator(); i.hasNext(); )
{
ConnectionEndpoint sce = (ConnectionEndpoint)i.next();
try
{
sce.closing();
sce.close();
log.debug("cleared up state for connection " + sce);
}
catch (JMSException e)
{
log.error("Failed to close connection", e);