我能夠獲得父連接器
MBeanServer mbs = ManagementFactory.getPlatformMBeanServer();
QueryExp qe = Query.match(Query.attr("port"), Query.value("443"));
ObjectName on = new ObjectName("*:type=Connector,*");
Set<ObjectName> objectNames = mbs.queryNames(on, qe);
我不想讀取 server.xml 以防它不同步。如何獲得 SSLHostConfig ?
uj5u.com熱心網友回復:
該ConnectorMBean未包含在TLS的配置資訊。您需要findSslHostConfigs在 的 bean 上呼叫該方法type=ThreadPool。ThreadPool實際上是用詞不當,因為這個 MBean 是由每個ProtocolHandler.
final MBeanServer mbs = ManagementFactory.getPlatformMBeanServer();
final QueryExp qe = Query.eq(Query.attr("port"), Query.value(443));
final ObjectName on = new ObjectName("*:type=ThreadPool,*");
final Set<ObjectName> protocols = mbs.queryNames(on, qe);
for (final ObjectName protocol : protocols) {
SSLHostConfig[] configs = (SSLHostConfig[]) mbs.invoke(protocol, "findSslHostConfigs", null, null);
// do something with the SSLHostConfig
}
或者,SSLHostConfigs 也可用作 MBean:它們具有屬性type=SSLHostConfig.
轉載請註明出處,本文鏈接:https://www.uj5u.com/gongcheng/316727.html
上一篇:docker容器自動創建和洗掉
