我现在根据https://github.com/spring-projects/spring-integration-samples/tree/master/basic/tcp-client-server
进行编码我想知道这个好的源代码示例的监控信息。
例如, 我想知道 有多少客户连接? 正在使用多少个线程?
是否有人可以重播我的问题。
答案 0 :(得分:0)
您可以在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;
}