void callConnectionClosedListener() { for (ConnectionListener listener : connectionListeners) { try { listener.connectionClosed(); } catch (Exception e) { // Catch and print any exception so we can recover // from a faulty listener and finish the shutdown process LOGGER.log(Level.SEVERE, "Error in listener while closing connection", e); } } }
void callConnectionClosedListener() { for (ConnectionListener listener : connectionListeners) { try { listener.connectionClosed(); } catch (Exception e) { // Catch and print any exception so we can recover // from a faulty listener and finish the shutdown process LOGGER.log(Level.SEVERE, "Error in listener while closing connection", e); } } }
/** * Shuts the packet reader down. */ public void shutdown() { // Notify connection listeners of the connection closing if done hasn't already been set. if (!done) { ArrayList listenersCopy; synchronized (connectionListeners) { // Make a copy since it's possible that a listener will be removed from the list listenersCopy = new ArrayList(connectionListeners); for (Iterator i=listenersCopy.iterator(); i.hasNext(); ) { ConnectionListener listener = (ConnectionListener)i.next(); listener.connectionClosed(); } } } done = true; // Make sure that the listenerThread is awake to shutdown properly synchronized (listenerThread) { listenerThread.notify(); } }
/** * Shuts the packet reader down. */ public void shutdown() { // Notify connection listeners of the connection closing if done hasn't already been set. if (!done) { for (ConnectionListener listener : connection.getConnectionListeners()) { try { listener.connectionClosed(); } catch (Exception e) { // Catch and print any exception so we can recover // from a faulty listener and finish the shutdown process e.printStackTrace(); } } } done = true; // Shut down the listener executor. listenerExecutor.shutdown(); }
/** * Shuts the packet reader down. */ public void shutdown() { // Notify connection listeners of the connection closing if done hasn't already been set. if (!done) { for (ConnectionListener listener : connection.getConnectionListeners()) { try { listener.connectionClosed(); } catch (Exception e) { // Cath and print any exception so we can recover // from a faulty listener and finish the shutdown process e.printStackTrace(); } } } done = true; // Shut down the listener executor. listenerExecutor.shutdown(); }
/** * Shuts the packet reader down. */ public void shutdown() { // Notify connection listeners of the connection closing if done hasn't already been set. if (!done) { for (ConnectionListener listener : connection.getConnectionListeners()) { try { listener.connectionClosed(); } catch (Exception e) { // Cath and print any exception so we can recover // from a faulty listener and finish the shutdown process e.printStackTrace(); } } } done = true; // Shut down the listener executor. listenerExecutor.shutdown(); }
public void disconnect(Presence unavailablePresence) { if (!connected) { return; } shutdown(unavailablePresence); // Cleanup if (roster != null) { roster.cleanup(); roster = null; } sendListeners.clear(); recvListeners.clear(); collectors.clear(); interceptors.clear(); // Reset the connection flags wasAuthenticated = false; isFirstInitialization = true; // Notify connection listeners of the connection closing if done hasn't already been set. for (ConnectionListener listener : getConnectionListeners()) { try { listener.connectionClosed(); } catch (Exception e) { // Catch and print any exception so we can recover // from a faulty listener and finish the shutdown process e.printStackTrace(); } } }