@Override public Thread newThread(Runnable runnable) { Thread thread = new Thread(runnable); String name = sessionConfig.getName(); thread.setName("EnquireLink-" + name); return thread; } });
@Override public Thread newThread(Runnable runnable) { Thread thread = new Thread(runnable); String name = sessionConfig.getName(); thread.setName("Reconnection-" + name); return thread; } });
@Override public String getName() { return this.configuration.getName(); }
@Override public String getName() { return this.configuration.getName(); }
@Override public String getName() { return this.configuration.getName(); }
@Override public String getName() { return this.configuration.getName(); }
@Override public void close() { if (this.defaultSmppSession != null) { try { defaultSmppSession.close(); } catch (Exception e) { logger.error(String.format("Failed to close smpp session for %s.", defaultSmppSession.getConfiguration().getName())); } } }
@Override public void close(long arg0) { if (this.defaultSmppSession != null) { try { defaultSmppSession.close(arg0); } catch (Exception e) { logger.error(String.format("Failed to close smpp session for %s.", defaultSmppSession.getConfiguration().getName())); } } }
@Override public void close(long arg0) { if (this.defaultSmppSession != null) { try { defaultSmppSession.close(arg0); } catch (Exception e) { logger.error(String.format("Failed to close smpp session for %s.", defaultSmppSession.getConfiguration().getName())); } } }
@Override public void unbind(long arg0) { if (this.defaultSmppSession != null) { try { defaultSmppSession.unbind(arg0); } catch (Exception e) { logger.error(String.format("Failed to unbind smpp session for %s.", defaultSmppSession.getConfiguration().getName())); } } }
@Override public void close() { if (this.defaultSmppSession != null) { try { defaultSmppSession.close(); } catch (Exception e) { logger.error(String.format("Failed to close smpp session for %s.", defaultSmppSession.getConfiguration().getName())); } } }
@Override public void unbind(long arg0) { if (this.defaultSmppSession != null) { try { defaultSmppSession.unbind(arg0); } catch (Exception e) { logger.error(String.format("Failed to unbind smpp session for %s.", defaultSmppSession.getConfiguration().getName())); } } }
@Override public SmppSession bind(SmppSessionConfiguration config, SmppSessionHandler sessionHandler) throws SmppTimeoutException, SmppChannelException, SmppBindException, UnrecoverablePduException, InterruptedException { DefaultSmppSession session = null; try { // connect to the remote system and create the session logger.debug("Connecting to remote system " + config.getName() + " host " + config.getHost() + ":" + config.getPort()); session = doOpen(config, sessionHandler); // try to bind to the remote system (may throw an exception) logger.debug("Binding to remote system " + config.getName()); doBind(session, config, sessionHandler); logger.debug("Successfully bound to " + config.getName()); } finally { // close the session if we weren't able to bind correctly if (session != null && !session.isBound()) { // make sure that the resources are always cleaned up try { logger.debug("Closing session - not able to bind to " + config.getName()); session.close(); } catch (Exception e) { logger.debug("Exception while trying to close connection to " + config.getName(), e); } } } return session; }
protected void stopSmppClientSession(Esme esme) { DefaultSmppSession smppSession = esme.getSmppSession(); if (smppSession != null) { if (smppSession.isBound()) { try { smppSession.unbind(5000); } catch (Exception e) { logger.error(String.format("Failed to unbind smpp client session for %s.", smppSession.getConfiguration().getName())); } } try { smppSession.close(); } catch (Exception e) { logger.error(String.format("Failed to close smpp client session for %s.", smppSession.getConfiguration().getName())); } // firing of onPduRequestTimeout() for sent messages for which we do not have responses Window<Integer, PduRequest, PduResponse> wind = smppSession.getSendWindow(); Map<Integer, WindowFuture<Integer, PduRequest, PduResponse>> futures = wind.createSortedSnapshot(); for (WindowFuture<Integer, PduRequest, PduResponse> future : futures.values()) { this.logger.warn("Firing of onPduRequestTimeout from SmppClientManagement.stopSmppClientSession() - 1: " + future.getRequest().toString()); smppSession.expired(future); } smppSession.destroy(); } }
protected void stopSmppClientSession(Esme esme) { DefaultSmppSession smppSession = esme.getSmppSession(); if (smppSession != null) { if (smppSession.isBound()) { try { smppSession.unbind(5000); } catch (Exception e) { logger.error(String.format("Failed to unbind smpp client session for %s.", smppSession.getConfiguration().getName())); } } try { smppSession.close(); } catch (Exception e) { logger.error(String.format("Failed to close smpp client session for %s.", smppSession.getConfiguration().getName())); } // firing of onPduRequestTimeout() for sent messages for which we do not have responses Window<Integer, PduRequest, PduResponse> wind = smppSession.getSendWindow(); Map<Integer, WindowFuture<Integer, PduRequest, PduResponse>> futures = wind.createSortedSnapshot(); for (WindowFuture<Integer, PduRequest, PduResponse> future : futures.values()) { this.logger.warn("Firing of onPduRequestTimeout from SmppClientManagement.stopSmppClientSession() - 1: " + future.getRequest().toString()); smppSession.expired(future); } smppSession.destroy(); } }
} catch (Exception e) { logger.error(String.format("Failed to close smpp session for %s.", smppSession.getConfiguration().getName()));
} catch (Exception e) { logger.error(String.format("Failed to close smpp session for %s.", smppSession.getConfiguration().getName()));
public void sessionDestroyed(SmppSession session) { synchronized (this) { if (logger.isInfoEnabled()) { logger.info(String.format("Session destroyed: %s", session.getConfiguration().getSystemId())); } // print out final stats if (session.hasCounters()) { logger.info(String.format("final session rx-submitSM: %s", session.getCounters().getRxSubmitSM())); } // remove esmeServer out of enquire list String esmeName = session.getConfiguration().getName(); Esme esmeServer = this.esmeManagement.getEsmeByName(esmeName); esmeServer.setServerBound(false); esmeServer.resetEnquireLinkFail(); this.smppServerOpsThread.removeEnquireList(esmeName); DefaultSmppSession defaultSession = (DefaultSmppSession) session; // firing of onPduRequestTimeout() for sent messages for which we do not have responses Window<Integer, PduRequest, PduResponse> wind = defaultSession.getSendWindow(); Map<Integer, WindowFuture<Integer, PduRequest, PduResponse>> futures = wind.createSortedSnapshot(); for (WindowFuture<Integer, PduRequest, PduResponse> future : futures.values()) { this.logger.warn("Firing of onPduRequestTimeout from DefaultSmppServerHandler.sessionDestroyed(): " + future.getRequest().toString()); defaultSession.expired(future); } // make sure it's really shutdown session.destroy(); } }
} catch (Exception e) { logger.error(String.format("Failed to close smpp server session for %s.", smppSession.getConfiguration().getName()));