@Override public void accept(SocketChannel sc) { String cid = "" + port_props.get("local-hostname") + "@" + port_props.get("remote-hostname"); if (log.isLoggable(Level.FINEST)) { log.log( Level.FINEST, "Accept called for service: {0}, port_props: {1}", new Object[] {cid, port_props}); } IO serv = getXMPPIOServiceInstance(); serv.setBufferLimit(net_buffer_limit); ((XMPPDomBuilderHandler) serv.getSessionData().get(DOM_HANDLER)) .setElementsLimit(elements_number_limit); serv.setIOServiceListener(ConnectionManager.this); serv.setSessionData(port_props); try { serv.accept(sc); if (getSocketType() == SocketType.ssl) { serv.startSSL(false, false, false); } // end of if (socket == SocketType.ssl) serviceStarted(serv); SocketThread.addSocketService(serv); } catch (Exception e) { if (getConnectionType() == ConnectionType.connect) { // Accept side for component service is not ready yet? // Let's wait for a few secs and try again. if (log.isLoggable(Level.FINEST)) { log.log( Level.FINEST, "Problem reconnecting the service: {0}, port_props: {1}, exception: {2}", new Object[] {serv, port_props, e}); } updateConnectionDetails(port_props); boolean reconnect = false; Integer reconnects = (Integer) port_props.get(MAX_RECONNECTS_PROP_KEY); if (reconnects != null) { int recon = reconnects.intValue(); if (recon != 0) { port_props.put(MAX_RECONNECTS_PROP_KEY, (--recon)); reconnect = true; } // end of if (recon != 0) } if (reconnect) { reconnectService(port_props, connectionDelay); } else { reconnectionFailed(port_props); } } else { // Ignore } // } catch (Exception e) { // if (log.isLoggable(Level.FINEST)) { // log.log(Level.FINEST, "Can not accept connection cid: " + cid, e); // } // log.log(Level.WARNING, "Can not accept connection.", e); // serv.stop(); } // end of try-catch }