@Override public void destroy() { this.bindTimer.cancel(); stop(); this.serverBootstrap.releaseExternalResources(); this.serverBootstrap = null; this.writeTimeoutTimer.stop(); unregisterMBean(); logger.info("{} destroyed on SMPP port [{}]", configuration.getName(), configuration.getPort()); }
@Override public int getSessionDestroyed() { return this.getCounters().getSessionDestroyed(); } }
public void printMetrics() { logger.info("Server {} counters: {}", smppServer.getConfiguration().getJmxDomain(), smppServer.getCounters()); }
public UnboundSmppSession(String channelName, Channel channel, DefaultSmppServer server) { this.channelName = channelName; this.channel = channel; this.server = server; // schedule the timer to close the channel after X milliseconds this.bindTimeoutTask = new BindTimeoutTask(); this.server.getBindTimer().schedule(bindTimeoutTask, this.server.getConfiguration().getBindTimeout()); }
public void stop() throws Exception { // stop SmppServerOpsThread logger.info("Stopping SmppServerOpsThread..."); this.smppServerOpsThread.setStarted(false); logger.info("SmppServerOpsThread stopped"); logger.info("Stopping SMPP server..."); this.defaultSmppServer.stop(); // this.executor.shutdownNow(); this.monitorExecutor.shutdownNow(); this.executor.awaitTermination(10, TimeUnit.SECONDS); this.executor.shutdown(); // this.monitorExecutor.shutdown(); logger.info("SMPP server stopped"); logger.info(String.format("Server counters: %s", this.defaultSmppServer.getCounters())); this.store(); }
this.server.getCounters().incrementChannelConnectsAndGet(); String threadName = server.getConfiguration().getName() + ".UnboundSession." + channelName; Thread.currentThread().setName(server.getConfiguration().getName()); logger.info("New channel from [{}]", channelName); Thread.currentThread().setName(currentThreadName); if (server.getConfiguration().isUseSsl()) { SslConfiguration sslConfig = server.getConfiguration().getSslConfiguration(); if (sslConfig == null) throw new IllegalStateException("sslConfiguration must be set"); SslContextFactory factory = new SslContextFactory(sslConfig); channel.getPipeline().addLast(SmppChannelConstants.PIPELINE_SESSION_PDU_DECODER_NAME, new SmppSessionPduDecoder(server.getTranscoder()));
Long sessionId = server.nextSessionId(); this.server.bindRequested(sessionId, sessionConfiguration, bindRequest); } catch (SmppProcessingException e) { logger.warn("Bind request rejected or failed for connection [{}] with error [{}]", channelName, e.getMessage()); BaseBindResp bindResponse = server.createBindResponse(bindRequest, e.getErrorCode()); this.sendResponsePdu(bindResponse); BaseBindResp preparedBindResponse = server.createBindResponse(bindRequest, SmppConstants.STATUS_OK); server.createSession(sessionId, channel, sessionConfiguration, preparedBindResponse); } catch (SmppProcessingException e) { logger.warn("Bind request was approved, but createSession failed for connection [{}] with error [{}]", channelName, e.getMessage()); BaseBindResp bindResponse = server.createBindResponse(bindRequest, e.getErrorCode()); this.sendResponsePdu(bindResponse);
this.defaultSmppServer = new DefaultSmppServer(configuration, new DefaultSmppServerHandler(esmeManagement, this.smppServerOpsThread, this.smppSessionHandlerInterface), executor, monitorExecutor); logger.info("Starting SMPP server..."); this.defaultSmppServer.start(); logger.info("SMPP server started");
byte interfaceVersion = this.autoNegotiateInterfaceVersion(config.getInterfaceVersion()); incrementSessionSizeCounters(session); this.serverHandler.sessionCreated(sessionId, session, preparedBindResponse);
public void doStop() { if (this.session0 != null) { this.session0.unbind(5000); this.session0.destroy(); this.session0 = null; } if (this.defaultSmppServer != null) { this.defaultSmppServer.stop(); this.defaultSmppServer.destroy(); this.defaultSmppServer = null; } if (clientBootstrap != null) { try { clientBootstrap.destroy(); executor.shutdownNow(); monitorExecutor.shutdownNow(); } catch (Exception e) { } clientBootstrap = null; executor = null; monitorExecutor = null; } enableStart(true); setDefaultCloseOperation(JDialog.DISPOSE_ON_CLOSE); this.addMessage("Session has been stopped", ""); }
public void stop() { smppServer.stop(); }
sessionConfiguration.setPassword(bindRequest.getPassword()); sessionConfiguration.setSystemType(bindRequest.getSystemType()); sessionConfiguration.setBindTimeout(server.getConfiguration().getBindTimeout()); sessionConfiguration.setAddressRange(bindRequest.getAddressRange()); sessionConfiguration.setHost(ChannelUtil.getChannelRemoteHost(channel)); sessionConfiguration.setWindowSize(server.getConfiguration().getDefaultWindowSize()); sessionConfiguration.setWindowWaitTimeout(server.getConfiguration().getDefaultWindowWaitTimeout()); sessionConfiguration.setWindowMonitorInterval(server.getConfiguration().getDefaultWindowMonitorInterval()); sessionConfiguration.setRequestExpiryTimeout(server.getConfiguration().getDefaultRequestExpiryTimeout()); sessionConfiguration.setCountersEnabled(server.getConfiguration().isDefaultSessionCountersEnabled());
protected void destroySession(Long sessionId, DefaultSmppSession session) { // session destroyed, now pass it upstream counters.incrementSessionDestroyedAndGet(); decrementSessionSizeCounters(session); serverHandler.sessionDestroyed(sessionId, session); // unregister this session as an mbean if (configuration.isJmxEnabled()) { session.unregisterMBean(configuration.getJmxDomain() + ":type=" + configuration.getName() + "Sessions,name=" + sessionId); } }
public void start() throws SmppChannelException { smppServer.start(); }
public SmscServer(SmscGlobalConfiguration config, SmppServerConfiguration serverConfig, SmscServerThreadPoolFactory threadPoolFactory) { smppServer = new DefaultSmppServer( serverConfig, new SmscSmppServerHandler(config), threadPoolFactory.createMainExecutor(), threadPoolFactory.createMonitorExecutor()); }
this.server.getCounters().incrementChannelConnectsAndGet(); String threadName = server.getConfiguration().getName() + ".UnboundSession." + channelName; Thread.currentThread().setName(server.getConfiguration().getName()); logger.info("New channel from [{}]", channelName); Thread.currentThread().setName(currentThreadName); if (server.getConfiguration().isUseSsl()) { SslConfiguration sslConfig = server.getConfiguration().getSslConfiguration(); if (sslConfig == null) throw new IllegalStateException("sslConfiguration must be set"); SslContextFactory factory = new SslContextFactory(sslConfig); channel.getPipeline().addLast(SmppChannelConstants.PIPELINE_SESSION_PDU_DECODER_NAME, new SmppSessionPduDecoder(server.getTranscoder()));
Long sessionId = server.nextSessionId(); this.server.bindRequested(sessionId, sessionConfiguration, bindRequest); } catch (SmppProcessingException e) { logger.warn("Bind request rejected or failed for connection [{}] with error [{}]", channelName, e.getMessage()); BaseBindResp bindResponse = server.createBindResponse(bindRequest, e.getErrorCode()); this.sendResponsePdu(bindResponse); BaseBindResp preparedBindResponse = server.createBindResponse(bindRequest, SmppConstants.STATUS_OK); server.createSession(sessionId, channel, sessionConfiguration, preparedBindResponse); } catch (SmppProcessingException e) { logger.warn("Bind request was approved, but createSession failed for connection [{}] with error [{}]", channelName, e.getMessage()); BaseBindResp bindResponse = server.createBindResponse(bindRequest, e.getErrorCode()); this.sendResponsePdu(bindResponse);
public void stop() throws Exception { // stop SmppServerOpsThread logger.info("Stopping SmppServerOpsThread..."); this.smppServerOpsThread.setStarted(false); logger.info("SmppServerOpsThread stopped"); logger.info("Stopping SMPP server..."); this.defaultSmppServer.stop(); // this.executor.shutdownNow(); this.monitorExecutor.shutdownNow(); this.executor.awaitTermination(10, TimeUnit.SECONDS); this.executor.shutdown(); // this.monitorExecutor.shutdown(); logger.info("SMPP server stopped"); logger.info(String.format("Server counters: %s", this.defaultSmppServer.getCounters())); this.store(); }
public UnboundSmppSession(String channelName, Channel channel, DefaultSmppServer server) { this.channelName = channelName; this.channel = channel; this.server = server; // schedule the timer to close the channel after X milliseconds this.bindTimeoutTask = new BindTimeoutTask(); this.server.getBindTimer().schedule(bindTimeoutTask, this.server.getConfiguration().getBindTimeout()); }
this.defaultSmppServer = new DefaultSmppServer(configuration, new DefaultSmppServerHandler(esmeManagement, this.smppServerOpsThread, this.smppSessionHandlerInterface), executor, monitorExecutor); logger.info("Starting SMPP server..."); this.defaultSmppServer.start(); logger.info("SMPP server started");