本文整理了Java中javax.management.JMX.newMXBeanProxy()
方法的一些代码示例,展示了JMX.newMXBeanProxy()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。JMX.newMXBeanProxy()
方法的具体详情如下:
包路径:javax.management.JMX
类名称:JMX
方法名:newMXBeanProxy
暂无
代码示例来源:origin: aragozin/jvm-tools
public static ThreadMXBean connectThreadMXBean(MBeanServerConnection mserver) {
ThreadMXBean bean;
try {
bean = JMX.newMXBeanProxy(mserver, THREADING_MBEAN, ThreadMXBeanEx.class);
} catch(Exception e) {
bean = JMX.newMXBeanProxy(mserver, THREADING_MBEAN, ThreadMXBean.class);
}
return bean;
}
}
代码示例来源:origin: aragozin/jvm-tools
public ThreadStackSampler(MBeanServerConnection mserver) {
this.threading = JMX.newMXBeanProxy(mserver, THREADING_MBEAN, ThreadMXBean.class);
}
代码示例来源:origin: apache/geode
public AccessControlMXBean getAccessControlMBean() throws Exception {
return JMX.newMXBeanProxy(con, new ObjectName("GemFire:service=AccessControl,type=Distributed"),
AccessControlMXBean.class);
}
代码示例来源:origin: vipshop/vjtools
public synchronized ThreadMXBean getThreadMXBean() throws IOException {
if (hasPlatformMXBeans && threadMBean == null) {
threadMBean = JMX.newMXBeanProxy(server, createBeanName(ManagementFactory.THREAD_MXBEAN_NAME),
ThreadMXBean.class);
}
return threadMBean;
}
代码示例来源:origin: apache/geode
/**
* Retrieve a new proxy MXBean
*
* @return A new proxy MXBean of the same type with which the class was constructed
*/
public <T> T getProxyMXBean(Class<T> proxyClass, String beanQueryName)
throws MalformedObjectNameException, IOException {
return JMX.newMXBeanProxy(con, getObjectName(proxyClass, beanQueryName), proxyClass);
}
代码示例来源:origin: aragozin/jvm-tools
public static Collection<String> allCollectedPools(MBeanServerConnection conn) throws IOException {
Set<String> pools = new LinkedHashSet<String>();
for(ObjectName gcn: conn.queryNames(COLLECTORS_PATTERN, null)) {
GarbageCollectorMXBean gc = JMX.newMXBeanProxy(conn, gcn, GarbageCollectorMXBean.class);
for(String pool: gc.getMemoryPoolNames()) {
pools.add(pool);
}
}
return pools;
}
代码示例来源:origin: Red5/red5-server
/**
* Returns the LoaderMBean.
*
* @return LoaderMBean
*/
@SuppressWarnings("cast")
public LoaderMXBean getLoader() {
MBeanServer mbs = ManagementFactory.getPlatformMBeanServer();
// proxy class
LoaderMXBean proxy = null;
ObjectName oName;
try {
oName = new ObjectName("org.red5.server:type=TomcatLoader");
if (mbs.isRegistered(oName)) {
proxy = JMX.newMXBeanProxy(mbs, oName, LoaderMXBean.class, true);
log.debug("Loader was found");
} else {
log.warn("Loader not found");
}
} catch (Exception e) {
log.error("Exception getting loader", e);
}
return proxy;
}
代码示例来源:origin: aragozin/jvm-tools
public MemoryPoolPoller(MBeanServerConnection mserver, MemoryPoolEventConsumer consumer) {
this.consumer = consumer;
try {
ObjectName name = new ObjectName("java.lang:type=MemoryPool,name=*");
for(ObjectName on: mserver.queryNames(name, null)) {
MemoryPoolMXBean mpool = JMX.newMXBeanProxy(mserver, on, MemoryPoolMXBean.class);
MemPoolTracker tracker = init(mpool);
trackers.put(tracker.poolName, tracker);
}
} catch (Exception e) {
throw new RuntimeException(e);
}
}
代码示例来源:origin: aragozin/jvm-tools
public GcEventPoller(MBeanServerConnection mserver, GarbageCollectionEventConsumer eventSink) {
this.mserver = mserver;
this.eventSink = eventSink;
RuntimeMXBean runtime = JMX.newMXBeanProxy(mserver, RUNTIME_MXBEAN, RuntimeMXBean.class);
jvmStartTime = runtime.getStartTime();
initTrackers();
}
代码示例来源:origin: aragozin/jvm-tools
public static Map<PoolType, Collection<String>> classifyMemoryPools(MBeanServerConnection conn) throws IOException {
RuntimeMXBean rtmx = JMX.newMXBeanProxy(conn, RUNTIME_MXBEAN, RuntimeMXBean.class);
boolean jrockit = rtmx.getVmName().toUpperCase().contains("JROCKIT");
Map<PoolType, Collection<String>> map = new HashMap<GcKnowledgeBase.PoolType, Collection<String>>();
for(ObjectName gcn: conn.queryNames(COLLECTORS_PATTERN, null)) {
GarbageCollectorMXBean gc = JMX.newMXBeanProxy(conn, gcn, GarbageCollectorMXBean.class);
String gcName = jrockit ? "JRockit" : gc.getName();
for(String pool: gc.getMemoryPoolNames()) {
PoolType type = classify(gcName, pool);
if (type != null) {
add(map, type, pool);
}
}
}
return map;
}
代码示例来源:origin: apache/geode
@Override
public <T> T getMBeanProxy(final ObjectName objectName, final Class<T> mbeanInterface) {
if (DistributedSystemMXBean.class.equals(mbeanInterface)
&& ManagementConstants.OBJECTNAME__DISTRIBUTEDSYSTEM_MXBEAN.equals(objectName.toString())) {
return mbeanInterface.cast(getDistributedSystemMXBean());
} else if (JMX.isMXBeanInterface(mbeanInterface)) {
return JMX.newMXBeanProxy(getMBeanServerConnection(), objectName, mbeanInterface);
} else {
return JMX.newMBeanProxy(getMBeanServerConnection(), objectName, mbeanInterface);
}
}
代码示例来源:origin: Red5/red5-server
/**
* Adds a connection.
*
* @param conn
* connection
*/
public void setConnection(RTMPConnection conn) {
log.trace("Adding connection: {}", conn);
int id = conn.getId();
if (id == -1) {
log.debug("Connection has unsupported id, using session id hash");
id = conn.getSessionId().hashCode();
}
log.debug("Connection id: {} session id hash: {}", conn.getId(), conn.getSessionId().hashCode());
if (debug) {
log.info("Connection count (map): {}", connMap.size());
try {
RTMPMinaTransportMXBean proxy = JMX.newMXBeanProxy(ManagementFactory.getPlatformMBeanServer(), new ObjectName("org.red5.server:type=RTMPMinaTransport"), RTMPMinaTransportMXBean.class, true);
if (proxy != null) {
log.info("{}", proxy.getStatistics());
}
} catch (Exception e) {
log.warn("Error on jmx lookup", e);
}
}
}
代码示例来源:origin: aragozin/jvm-tools
public GcAdapter(MBeanServerConnection mserver, ObjectName gcname, GarbageCollectionSampler sampler) throws IOException, MalformedObjectNameException {
this.sampler = sampler;
gc = JMX.newMXBeanProxy(mserver, gcname, GarbageCollectorMXBean.class);
name = gc.getName();
RuntimeMXBean runtime = JMX.newMXBeanProxy(mserver, new ObjectName(ManagementFactory.RUNTIME_MXBEAN_NAME), RuntimeMXBean.class);
processStartMs = runtime.getStartTime();
collectedPools = Arrays.asList(gc.getMemoryPoolNames());
allCollectedPools = new ArrayList<String>(GcKnowledgeBase.allCollectedPools(mserver));
Map<GcKnowledgeBase.PoolType, Collection<String>> types = GcKnowledgeBase.classifyMemoryPools(mserver);
edenPools = getMemPools(types, PoolType.EDEN);
survivourPools = getMemPools(types, PoolType.SURVIVOR);
oldPools = getMemPools(types, PoolType.TENURED);
permPools = getMemPools(types, PoolType.PERMANENT);
youngPools = new ArrayList<String>();
youngPools.addAll(edenPools);
youngPools.addAll(survivourPools);
isYoung = collectedPools.containsAll(oldPools);
isConcurent = "ConcurrentMarkSweep".equals(name);
}
代码示例来源:origin: apache/geode
this.mbsc = connector.getMBeanServerConnection();
this.connector.addConnectionNotificationListener(new JMXConnectionListener(this), null, null);
this.distributedSystemMXBeanProxy = JMX.newMXBeanProxy(mbsc,
MBeanJMXAdapter.getDistributedSystemName(), DistributedSystemMXBean.class);
} else {
this.memberMXBeanProxy =
JMX.newMXBeanProxy(mbsc, managerMemberObjectName, MemberMXBean.class);
this.fileUploadMBeanProxy = JMX.newMBeanProxy(mbsc,
new ObjectName(ManagementConstants.OBJECTNAME__FILEUPLOADER_MBEAN),
代码示例来源:origin: psi-probe/psi-probe
@Override
public DataSourceInfo getInfo(final Object resource) throws Exception {
DataSourceInfo dataSourceInfo = null;
if (canMap(resource)) {
HikariDataSource source = (HikariDataSource) resource;
MBeanServer mbeanServer = ManagementFactory.getPlatformMBeanServer();
ObjectName poolName =
new ObjectName("com.zaxxer.hikari:type=Pool (" + source.getPoolName() + ")");
HikariPoolMXBean poolProxy =
JMX.newMXBeanProxy(mbeanServer, poolName, HikariPoolMXBean.class);
dataSourceInfo = new DataSourceInfo();
dataSourceInfo.setBusyConnections(poolProxy.getActiveConnections());
dataSourceInfo.setEstablishedConnections(poolProxy.getTotalConnections());
dataSourceInfo.setMaxConnections(source.getMaximumPoolSize());
dataSourceInfo.setJdbcUrl(source.getJdbcUrl());
dataSourceInfo.setUsername(source.getUsername());
dataSourceInfo.setResettable(false);
dataSourceInfo.setType("hikari");
}
return dataSourceInfo;
}
代码示例来源:origin: psi-probe/psi-probe
@Override
public DataSourceInfo getInfo(final Object resource) throws Exception {
DataSourceInfo dataSourceInfo = null;
if (canMap(resource)) {
ViburDBCPDataSource source = (ViburDBCPDataSource) resource;
MBeanServer mbeanServer = ManagementFactory.getPlatformMBeanServer();
ObjectName poolName = new ObjectName(source.getJmxName());
ViburMonitoringMBean poolProxy =
JMX.newMXBeanProxy(mbeanServer, poolName, ViburMonitoringMBean.class);
dataSourceInfo = new DataSourceInfo();
dataSourceInfo.setBusyConnections(poolProxy.getPoolTaken());
dataSourceInfo.setEstablishedConnections(
poolProxy.getPoolRemainingCreated() + poolProxy.getPoolTaken());
dataSourceInfo.setMaxConnections(source.getPoolMaxSize());
dataSourceInfo.setJdbcUrl(source.getJdbcUrl());
dataSourceInfo.setUsername(source.getUsername());
dataSourceInfo.setResettable(false);
dataSourceInfo.setType("vibur");
}
return dataSourceInfo;
}
代码示例来源:origin: org.drools/drools-compiler
KieContainerMonitorMXBean c1Monitor = JMX.newMXBeanProxy(
mbserver,
DroolsManagementAgent.createObjectNameBy("myID"),
代码示例来源:origin: org.drools/drools-compiler
KieContainerMonitorMXBean c1Monitor = JMX.newMXBeanProxy(
mbserver,
DroolsManagementAgent.createObjectNameBy("myID"),
StatelessKieSession statelessKieSession = kc.newStatelessKieSession("org.kie.monitoring.kbase1.ksession2");
KieSessionMonitoringMXBean statefulKieSessionMonitor = JMX.newMXBeanProxy(
mbserver,
DroolsManagementAgent.createObjectNameBy("myID", "org.kie.monitoring.kbase1", KieSessionType.STATEFUL, "org.kie.monitoring.kbase1.ksession1"),
KieSessionMonitoringMXBean.class);
StatelessKieSessionMonitoringMXBean statelessKieSessionMonitor = JMX.newMXBeanProxy(
mbserver,
DroolsManagementAgent.createObjectNameBy("myID", "org.kie.monitoring.kbase1", KieSessionType.STATEFUL, "org.kie.monitoring.kbase1.ksession1"),
KieContainerMonitorMXBean c2Monitor = JMX.newMXBeanProxy(
mbserver,
DroolsManagementAgent.createObjectNameBy("myID2"),
KieSession statefulKieSession2 = kc2.newKieSession("org.kie.monitoring.kbase1.ksession1");
StatelessKieSession statelessKieSession2 = kc2.newStatelessKieSession("org.kie.monitoring.kbase1.ksession2");
KieSessionMonitoringMXBean statefulKieSessionMonitor2 = JMX.newMXBeanProxy(
mbserver,
DroolsManagementAgent.createObjectNameBy("myID2", "org.kie.monitoring.kbase1", KieSessionType.STATEFUL, "org.kie.monitoring.kbase1.ksession1"),
KieSessionMonitoringMXBean.class);
StatelessKieSessionMonitoringMXBean statelessKieSessionMonitor2 = JMX.newMXBeanProxy(
mbserver,
DroolsManagementAgent.createObjectNameBy("myID2", "org.kie.monitoring.kbase1", KieSessionType.STATEFUL, "org.kie.monitoring.kbase1.ksession1"),
代码示例来源:origin: org.drools/drools-compiler
KieContainerMonitorMXBean c1Monitor = JMX.newMXBeanProxy(
mbserver,
DroolsManagementAgent.createObjectNameBy(kc1ID),
assertEquals(releaseId1.getVersion(), c1Monitor.getResolvedReleaseId().getVersion());
KieContainerMonitorMXBean c2Monitor = JMX.newMXBeanProxy(
mbserver,
DroolsManagementAgent.createObjectNameBy("Matteo"),
代码示例来源:origin: org.drools/drools-compiler
KieSessionMonitoringMXBean aggrMonitor = JMX.newMXBeanProxy(
mbserver,
DroolsManagementAgent.createObjectNameBy(containerId, KBASE1, KieSessionType.STATEFUL, KSESSION1),
StatelessKieSessionMonitoringMXBean aggrMonitor2 = JMX.newMXBeanProxy(
mbserver,
DroolsManagementAgent.createObjectNameBy(containerId, KBASE2, KieSessionType.STATELESS, KSESSION2),
内容来源于网络,如有侵权,请联系作者删除!