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