@Nullable private ScheduledFuture<?> initLoggingTask(long initialDelay) { if (this.sockJsTaskScheduler != null && this.loggingPeriod > 0 && logger.isInfoEnabled()) { return this.sockJsTaskScheduler.scheduleAtFixedRate(() -> logger.info(WebSocketMessageBrokerStats.this.toString()), initialDelay, this.loggingPeriod, TimeUnit.MILLISECONDS); } return null; }
@Test public void webSocketMessageBrokerStats() { ApplicationContext config = createConfig(TestChannelConfig.class, TestConfigurer.class); String name = "webSocketMessageBrokerStats"; WebSocketMessageBrokerStats stats = config.getBean(name, WebSocketMessageBrokerStats.class); String actual = stats.toString(); String expected = "WebSocketSession\\[0 current WS\\(0\\)-HttpStream\\(0\\)-HttpPoll\\(0\\), " + "0 total, 0 closed abnormally \\(0 connect failure, 0 send limit, 0 transport error\\)\\], " + "stompSubProtocol\\[processed CONNECT\\(0\\)-CONNECTED\\(0\\)-DISCONNECT\\(0\\)\\], " + "stompBrokerRelay\\[null\\], " + "inboundChannel\\[pool size = \\d, active threads = \\d, queued tasks = \\d, completed tasks = \\d\\], " + "outboundChannel\\[pool size = \\d, active threads = \\d, queued tasks = \\d, completed tasks = \\d\\], " + "sockJsScheduler\\[pool size = \\d, active threads = \\d, queued tasks = \\d, completed tasks = \\d\\]"; assertTrue("\nExpected: " + expected.replace("\\", "") + "\n Actual: " + actual, actual.matches(expected)); }
String actual = stats.toString(); String expected = "WebSocketSession\\[0 current WS\\(0\\)-HttpStream\\(0\\)-HttpPoll\\(0\\), " + "0 total, 0 closed abnormally \\(0 connect failure, 0 send limit, 0 transport error\\)\\], " +
@Nullable private ScheduledFuture<?> initLoggingTask(long initialDelay) { if (this.sockJsTaskScheduler != null && this.loggingPeriod > 0 && logger.isInfoEnabled()) { return this.sockJsTaskScheduler.scheduleAtFixedRate(() -> logger.info(WebSocketMessageBrokerStats.this.toString()), initialDelay, this.loggingPeriod, TimeUnit.MILLISECONDS); } return null; }
@Nullable private ScheduledFuture<?> initLoggingTask(long initialDelay) { if (this.sockJsTaskScheduler != null && this.loggingPeriod > 0 && logger.isInfoEnabled()) { return this.sockJsTaskScheduler.scheduleAtFixedRate(() -> logger.info(WebSocketMessageBrokerStats.this.toString()), initialDelay, this.loggingPeriod, TimeUnit.MILLISECONDS); } return null; }