【问题标题】:Spring Integration TCP Performance MonitorSpring 集成 TCP 性能监视器
【发布时间】:2017-12-19 13:30:02
【问题描述】:

我现在基于https://github.com/spring-projects/spring-integration-samples/tree/master/basic/tcp-client-server编码

我想知道这个好的源示​​例的监控信息。

例如, 我想知道 连接了多少客户端? 正在使用多少个线程?

有没有人可以重温我的问题。

【问题讨论】:

    标签: spring performance spring-integration


    【解决方案1】:

    你可以在AbstractConnectionFactory上使用这个:

    /**
     * Returns a list of (currently) open {@link TcpConnection} connection ids; allows,
     * for example, broadcast operations to all open connections.
     * @return the list of connection ids.
     */
    public List<String> getOpenConnectionIds() {
        return Collections.unmodifiableList(this.removeClosedConnectionsAndReturnOpenConnectionIds());
    }
    

    您可以从外部配置的ThreadPoolTaskExecutor 获取线程统计信息并通过以下方式注入AbstractConnectionFactory

    /**
     * @param taskExecutor the taskExecutor to set
     */
    public void setTaskExecutor(Executor taskExecutor) {
        this.taskExecutor = taskExecutor;
    }
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2016-09-23
      • 2017-04-21
      • 1970-01-01
      • 2015-04-26
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多