package com.juick.xmpp.s2s; import java.sql.SQLException; import java.util.Iterator; /** * * @author ugnich */ public class Shutdown extends Thread { @Override public void run() { System.out.println("SHUTTING DOWN"); synchronized (XMPPComponent.outConnections) { for (Iterator i = XMPPComponent.outConnections.iterator(); i.hasNext();) { ConnectionOut c = i.next(); c.closeConnection(); i.remove(); } } synchronized (XMPPComponent.inConnections) { for (Iterator i = XMPPComponent.inConnections.iterator(); i.hasNext();) { ConnectionIn c = i.next(); c.closeConnection(); i.remove(); } } XMPPComponent.connRouter.closeConnection(); synchronized (XMPPComponent.sqlSync) { if (XMPPComponent.sql != null) { try { XMPPComponent.sql.close(); XMPPComponent.sql = null; } catch (SQLException e) { System.err.println("SQL ERROR: " + e); } } } } }