连接和连接池统计信息
WebSphere® Application Server 支持使用 PMI API 来监视数据访问应用程序的性能。
在此版本的 WebSphere Application
Server 中,两个现有的连接管理器(JDBC 和 J2C)中支持的性能监视基础结构 (PMI) 方法调用受支持。这些调用包括:
- ManagedConnectionsCreated
- ManagedConnectionsAllocated
- ManagedConnectionFreed
- ManagedConnectionDestroyed
- BeginWaitForConnection
- EndWaitForConnection
- ConnectionFaults
- 池中 ManagedConnection 的平均数
- 连接池使用最大数量的 ManagedConnection 的时间百分比
- 等待 ManagedConnection 的线程的平均数
- 正在使用的池的平均百分比
- 花费在等待请求上的平均时间
- 正在使用的 ManagedConnection 数
- 连接句柄数
- FreePoolSize
- UseTime
“Java™ 规范请求”(JSR) 77 要求通过受管 bean (Mbean) 来访问统计数据,以使访问更加容易。连接管理器传递为该池创建的 Mbean 的 ObjectName。如果是 Java 消息服务 (JMS),那么传递 null。使用的接口为:
PmiFactory.createJ2CPerf(
String pmiName, // a unique Identifier for JCA /JDBC. This is the
// ConnectionFactory name.
ObjectName providerName,// the ObjectName of the J2CResourceAdapter
// or JDBCProvider Mbean
ObjectName factoryName // the ObjectName of the J2CConnectionFactory
// or DataSourceMbean.
)
下面的统一建模语言 (UML) 图显示了 JSR 77 要求报告统计信息的方式:
图 1. 

JCAConnectionPoolStats 和 JDBCConnectionPoolStats 对象没有直接的实现 Mbean;通过调用 PMI 收集统计信息。J2C 资源适配器和 JDBC 提供程序分别包含 ConnectionFactory 或 DataSource ObjectName 的列表。PMI 使用 ObjectName 按 PMI 模块列表查找适当的连接池。
JCA 1.5 规范允许来自 matchManagedConnection() 方法的异常,这表明资源适配器请求不要合用连接。在此情况下,分别从连接池的统计信息提供该连接的统计信息。