本文整理了Java中javax.management.Query.match
方法的一些代码示例,展示了Query.match
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Query.match
方法的具体详情如下:
包路径:javax.management.Query
类名称:Query
方法名:match
暂无
代码示例来源:origin: vakinge/oneplatform
private static int getServerPort(){
int port = 0;
try {
MBeanServer beanServer = ManagementFactory.getPlatformMBeanServer();
Set<ObjectName> objectNames = beanServer.queryNames(new ObjectName("*:type=Connector,*"),
Query.match(Query.attr("protocol"), Query.value("HTTP/1.1")));
port = Integer.valueOf(objectNames.iterator().next().getKeyProperty("port"));
}catch (Exception e){
if(StringUtils.isNotBlank(System.getProperty("jetty.port"))){
port = Integer.parseInt(System.getProperty("jetty.port"));
}
}
return port;
}
}
代码示例来源:origin: org.restcomm/restcomm-connect.commons
@Override
public HttpConnectorList findConnectors() throws MalformedObjectNameException, NullPointerException, UnknownHostException, AttributeNotFoundException,
InstanceNotFoundException, MBeanException, ReflectionException {
LOG.info("Searching Tomcat HTTP connectors.");
HttpConnectorList httpConnectorList = null;
MBeanServer mbs = ManagementFactory.getPlatformMBeanServer();
Set<ObjectName> tomcatObjs = mbs.queryNames(new ObjectName("*:type=Connector,*"), Query.match(Query.attr("protocol"), Query.value("HTTP/1.1")));
ArrayList<HttpConnector> endPoints = new ArrayList<HttpConnector>();
if (tomcatObjs != null && tomcatObjs.size() > 0) {
for (ObjectName obj : tomcatObjs) {
String scheme = mbs.getAttribute(obj, "scheme").toString().replaceAll("\"", "");
String port = obj.getKeyProperty("port").replaceAll("\"", "");
String address = obj.getKeyProperty("address").replaceAll("\"", "");
if (LOG.isInfoEnabled()) {
LOG.info("Tomcat Http Connector: " + scheme + "://" + address + ":" + port);
}
HttpConnector httpConnector = new HttpConnector(scheme, address, Integer.parseInt(port), scheme.equalsIgnoreCase("https"));
endPoints.add(httpConnector);
}
}
if (endPoints.isEmpty()) {
LOG.warn("Coundn't discover any Http Interfaces");
}
httpConnectorList = new HttpConnectorList(endPoints);
return httpConnectorList;
}
}
代码示例来源:origin: locationtech/geowave
private static String getHTTPEndPoint() throws Exception {
final MBeanServer mbs = ManagementFactory.getPlatformMBeanServer();
final QueryExp subQuery1 = Query.match(Query.attr("protocol"), Query.value("HTTP/1.1"));
final QueryExp subQuery2 = Query.anySubString(Query.attr("protocol"), Query.value("Http11"));
final QueryExp query = Query.or(subQuery1, subQuery2);
代码示例来源:origin: org.objectweb.jonas/jonas-ejb-2.1
QueryExp match = Query.match(Query.attr("jndiName"),
Query.value(jndiName));
Set objectNames = mbeanServer.queryNames(J2eeObjectName.getJDBCDataSources(J2eeObjectName.ALL, null),
代码示例来源:origin: org.objectweb.jonas/jonas-ejb-2.1
QueryExp match = Query.match(Query.attr("jndiName"), Query.value(jndiName));
QueryExp query = Query.and(match, new DataSourcePropertiesQueryExp());
Set objectNames = mbeanServer.queryNames(J2eeObjectName.getResourceAdapters(J2eeObjectName.ALL, null), query);
代码示例来源:origin: org.ow2.jonas/jonas-domain
QueryExp query = Query.match(Query.attr("resourceAdapterClassname"), Query
.value("org.objectweb.joram.client.connector.JoramAdapter"));
Iterator it = getConnection().queryNames(on, query).iterator();
代码示例来源:origin: org.objectweb.jonas/jonas-ejb-2.1
QueryExp match = Query.match(Query.attr("Name"),
Query.value(jndiName));
Set objectNames = mbeanServer.queryNames(J2eeObjectName.JavaMailResources(J2eeObjectName.ALL, null, type),
代码示例来源:origin: apache/helix
/**
* Queries for all MBeans from the MBean Server and only looks at the relevant MBean and gets its metric numbers.
*
*/
private void updateMetrics() {
try {
QueryExp exp = Query.match(Query.attr("SensorName"), Query.value("*" + CLUSTER_NAME + "*"));
Set<ObjectInstance> mbeans =
new HashSet<>(ManagementFactory.getPlatformMBeanServer().queryMBeans(new ObjectName("ClusterStatus:*"), exp));
for (ObjectInstance instance : mbeans) {
ObjectName beanName = instance.getObjectName();
if (beanName.toString().equals("ClusterStatus:cluster=" + CLUSTER_NAME)) {
MBeanInfo info = _server.getMBeanInfo(beanName);
MBeanAttributeInfo[] infos = info.getAttributes();
for (MBeanAttributeInfo infoItem : infos) {
Object val = _server.getAttribute(beanName, infoItem.getName());
_beanValueMap.put(infoItem.getName(), val);
}
}
}
} catch (Exception e) {
// update failed
}
}
}
代码示例来源:origin: apache/helix
Query.match(Query.attr("SensorName"), Query.value("*" + _clusterNamePrefix + "*"));
final Set<ObjectInstance> mbeans = new HashSet<>(ManagementFactory.getPlatformMBeanServer()
.queryMBeans(new ObjectName("ClusterStatus:*"), exp1));
Query.not(Query.match(Query.attr("SensorName"), Query.value("MessageQueueStatus.*"))),
exp1);
内容来源于网络,如有侵权,请联系作者删除!