@Override public void onNewRemoteConnection(Server server, Association association) { logger.debug("Received notfification of a new remote connection!"); try { // notify network guard that new remote connection is done! getParent().onNewRemoteConnection(server, association); } catch (Exception e) { try { // ammendonca: changed. is it right ? // socketChannel.close(); association.stopAnonymousAssociation(); } catch (Exception ex) { logger.error("Error closing channel: " + ex.getMessage()); } } } }
protected void stop() throws Exception { FastList<String> tempAssociations = associations; for (FastList.Node<String> n = tempAssociations.head(), end = tempAssociations.tail(); (n = n.getNext()) != end;) { String assocName = n.getValue(); Association associationTemp = this.management.getAssociation(assocName); if (associationTemp.isStarted()) { throw new Exception(String.format("Stop all the associations first. Association=%s is still started", associationTemp.getName())); } } synchronized (this.anonymAssociations) { // stopping all anonymous associations for (Association ass : this.anonymAssociations) { ass.stopAnonymousAssociation(); } this.anonymAssociations.clear(); } this.started = false; if (logger.isInfoEnabled()) { logger.info(String.format("Stoped Server=%s", this.name)); } // Stop underlying channel and wait till its done if (this.getIpChannel() != null) { try { this.getIpChannel().close().sync(); } catch (Exception e) { logger.warn(String.format("Error while stopping the Server=%s", this.name), e); } } }
protected void stop() throws Exception { FastList<String> tempAssociations = associations; for (FastList.Node<String> n = tempAssociations.head(), end = tempAssociations.tail(); (n = n.getNext()) != end;) { String assocName = n.getValue(); Association associationTemp = this.management.getAssociation(assocName); if (associationTemp.isStarted()) { throw new Exception(String.format("Stop all the associations first. Association=%s is still started", associationTemp.getName())); } } synchronized (this.anonymAssociations) { // stopping all anonymous associations for (Association ass : this.anonymAssociations) { ass.stopAnonymousAssociation(); } this.anonymAssociations.clear(); } if (this.getIpChannel() != null) { try { this.getIpChannel().close(); } catch (Exception e) { logger.warn(String.format("Error while stopping the Server=%s", this.name), e); } } this.started = false; if (logger.isInfoEnabled()) { logger.info(String.format("Stoped Server=%s", this.name)); } }