java类javax.management.JMX的实例源码

ServiceCollector.java 文件源码 项目:csap-core 阅读 20 收藏 0 点赞 0 评论 0
private SimonManagerMXBean getSimonProxyBean (
                                                MBeanServerConnection mbeanConn,
                                                ServiceCollectionResults collectionResults ) {

    SimonManagerMXBean simonMgrMxBean = null;

    ServiceInstance service = collectionResults.getServiceInstance();
    if ( service.getSimonMbean().length() > 0 ) {

        try {
            simonMgrMxBean = JMX.newMXBeanProxy(
                mbeanConn, new ObjectName(
                    collectionResults.getServiceInstance().getSimonMbean() ),
                SimonManagerMXBean.class );
        } catch (Exception e) {
            logger.warn( "Failed to get simon proxy", CSAP.getCsapFilteredStackTrace( e ) );
        }

    }

    logger.debug( "{} type: {} Simon mbean name: {} ",
        service.getServiceName(), service.getServerType(), service.getSimonMbean() );

    return simonMgrMxBean;
}
AbstractCommandsController.java 文件源码 项目:monarch 阅读 25 收藏 0 点赞 0 评论 0
/**
 * Gets the MemberMXBean from the JVM Platform MBeanServer for the specified member, identified by
 * name or ID in the GemFire cluster.
 * 
 * @param memberNameId a String indicating the name or ID of the GemFire member.
 * @return a proxy to the GemFire member's MemberMXBean.
 * @throws IllegalStateException if no MemberMXBean could be found for GemFire member with ID or
 *         name.
 * @throws RuntimeException wrapping the MalformedObjectNameException if the ObjectName pattern is
 *         malformed.
 * @see #getMBeanServer()
 * @see #isMemberMXBeanFound(java.util.Collection)
 * @see javax.management.ObjectName
 * @see javax.management.QueryExp
 * @see javax.management.MBeanServer#queryNames(javax.management.ObjectName,
 *      javax.management.QueryExp)
 * @see javax.management.JMX#newMXBeanProxy(javax.management.MBeanServerConnection,
 *      javax.management.ObjectName, Class)
 * @see org.apache.geode.management.MemberMXBean
 */
protected MemberMXBean getMemberMXBean(final String memberNameId) {
  try {
    final MBeanServer connection = getMBeanServer();

    final String objectNamePattern =
        ManagementConstants.OBJECTNAME__PREFIX.concat("type=Member,*");

    // NOTE throws a MalformedObjectNameException, but this should not happen since we constructed
    // the ObjectName above
    final ObjectName objectName = ObjectName.getInstance(objectNamePattern);

    final QueryExp query = Query.or(Query.eq(Query.attr("Name"), Query.value(memberNameId)),
        Query.eq(Query.attr("Id"), Query.value(memberNameId)));

    final Set<ObjectName> objectNames = connection.queryNames(objectName, query);

    assertState(isMemberMXBeanFound(objectNames),
        "No MemberMXBean with ObjectName (%1$s) based on Query (%2$s) was found in the Platform MBeanServer for member (%3$s)!",
        objectName, query, memberNameId);

    return JMX.newMXBeanProxy(connection, objectNames.iterator().next(), MemberMXBean.class);
  } catch (MalformedObjectNameException e) {
    throw new RuntimeException(e);
  }
}
AbstractCommandsController.java 文件源码 项目:monarch 阅读 30 收藏 0 点赞 0 评论 0
/**
 * Lookup operation for the MemberMXBean representing the Manager in the GemFire cluster. This
 * method gets an instance fo the Platform MBeanServer for this JVM process and uses it to lookup
 * the MemberMXBean for the GemFire Manager based on the ObjectName declared in the
 * DistributedSystemMXBean.getManagerObjectName() operation.
 * 
 * @return a proxy instance to the MemberMXBean of the GemFire Manager.
 * @see #getMBeanServer()
 * @see #createMemberMXBeanForManagerUsingProxy(javax.management.MBeanServer,
 *      javax.management.ObjectName)
 * @see org.apache.geode.management.DistributedSystemMXBean
 * @see org.apache.geode.management.MemberMXBean
 */
protected synchronized MemberMXBean getManagingMemberMXBean() {
  if (managingMemberMXBeanProxy == null) {
    SystemManagementService service = (SystemManagementService) ManagementService
        .getExistingManagementService(GemFireCacheImpl.getInstance());
    MBeanServer mbs = getMBeanServer();

    final DistributedSystemMXBean distributedSystemMXBean = JMX.newMXBeanProxy(mbs,
        MBeanJMXAdapter.getDistributedSystemName(), DistributedSystemMXBean.class);

    managingMemberMXBeanProxy = createMemberMXBeanForManagerUsingProxy(mbs,
        distributedSystemMXBean.getMemberObjectName());
  }

  return managingMemberMXBeanProxy;
}
MBeanProxyInvocationHandler.java 文件源码 项目:monarch 阅读 17 收藏 0 点赞 0 评论 0
/**
 * 
 * @param member member to which this MBean belongs
 * @param monitoringRegion corresponding MonitoringRegion
 * @param objectName ObjectName of the MBean
 * @param interfaceClass on which interface the proxy to be exposed
 * @return Object
 * @throws ClassNotFoundException
 * @throws IntrospectionException
 */
public static Object newProxyInstance(DistributedMember member,
    Region<String, Object> monitoringRegion, ObjectName objectName, Class interfaceClass)
    throws ClassNotFoundException, IntrospectionException {
  boolean isMXBean = JMX.isMXBeanInterface(interfaceClass);
  boolean notificationBroadcaster =
      ((FederationComponent) monitoringRegion.get(objectName.toString())).isNotificationEmitter();

  InvocationHandler handler =
      new MBeanProxyInvocationHandler(member, objectName, monitoringRegion, isMXBean);

  Class[] interfaces;

  if (notificationBroadcaster) {
    interfaces =
        new Class[] {interfaceClass, ProxyInterface.class, NotificationBroadCasterProxy.class};
  } else {
    interfaces = new Class[] {interfaceClass, ProxyInterface.class};
  }

  Object proxy = Proxy.newProxyInstance(MBeanProxyInvocationHandler.class.getClassLoader(),
      interfaces, handler);

  return interfaceClass.cast(proxy);
}
MBeanServerConnectionRule.java 文件源码 项目:monarch 阅读 23 收藏 0 点赞 0 评论 0
/**
 * Retrieve a new proxy MBean
 *
 * @return A new proxy MBean of the same type with which the class was constructed
 */
public <T> T getProxyMBean(Class<T> proxyClass, String beanQueryName)
    throws MalformedObjectNameException, IOException {
  ObjectName name = null;
  QueryExp query = null;

  if (proxyClass != null) {
    query = Query.isInstanceOf(Query.value(proxyClass.getName()));
  }

  if (beanQueryName != null) {
    name = ObjectName.getInstance(beanQueryName);
  }

  Set<ObjectInstance> beans = con.queryMBeans(name, query);
  assertEquals("failed to find only one instance of type " + proxyClass.getName() + " with name "
      + beanQueryName, 1, beans.size());

  return JMX.newMXBeanProxy(con, ((ObjectInstance) beans.toArray()[0]).getObjectName(),
      proxyClass);
}
TestUtils.java 文件源码 项目:jdk8u-jdk 阅读 50 收藏 0 点赞 0 评论 0
/**
 * Transfroms a proxy implementing T in a proxy implementing T plus
 * NotificationEmitter
 *
 **/
public static <T> T makeNotificationEmitter(T proxy,
                    Class<T> mbeanInterface) {
    if (proxy instanceof NotificationEmitter)
        return proxy;
    if (proxy == null) return null;
    if (!(proxy instanceof Proxy))
        throw new IllegalArgumentException("not a "+Proxy.class.getName());
    final Proxy p = (Proxy) proxy;
    final InvocationHandler handler =
            Proxy.getInvocationHandler(proxy);
    if (!(handler instanceof MBeanServerInvocationHandler))
        throw new IllegalArgumentException("not a JMX Proxy");
    final MBeanServerInvocationHandler h =
            (MBeanServerInvocationHandler)handler;
    final ObjectName name = h.getObjectName();
    final MBeanServerConnection mbs = h.getMBeanServerConnection();
    final boolean isMXBean = h.isMXBean();
    final T newProxy;
    if (isMXBean)
        newProxy = JMX.newMXBeanProxy(mbs,name,mbeanInterface,true);
    else
        newProxy = JMX.newMBeanProxy(mbs,name,mbeanInterface,true);
    return newProxy;
}
JMXProxyFallbackTest.java 文件源码 项目:jdk8u-jdk 阅读 23 收藏 0 点赞 0 评论 0
private static void testPrivate(Class<?> iface) throws Exception {
    try {
        System.out.println("Creating a proxy for private M(X)Bean " +
                            iface.getName() + " ...");

        MBeanServer mbs = MBeanServerFactory.newMBeanServer();
        ObjectName on = new ObjectName("test:type=Proxy");

        JMX.newMBeanProxy(mbs, on, iface);
        success("Created a proxy for private M(X)Bean - " + iface.getName());
    } catch (Exception e) {
        Throwable t = e;
        while (t != null && !(t instanceof NotCompliantMBeanException)) {
            t = t.getCause();
        }
        if (t != null) {
            fail("Proxy not created");
        } else {
            throw e;
        }
    }
}
ExceptionDiagnosisTest.java 文件源码 项目:jdk8u-jdk 阅读 23 收藏 0 点赞 0 评论 0
private static void testCaseProb() throws Exception {
    MBeanServer mbs = MBeanServerFactory.newMBeanServer();
    ObjectName name = new ObjectName("a:b=c");
    mbs.registerMBean(new CaseProbImpl(), name);
    CaseProbMXBean proxy = JMX.newMXBeanProxy(mbs, name, CaseProbMXBean.class);
    try {
        CaseProb prob = proxy.getCaseProb();
        fail("No exception from proxy method getCaseProb");
    } catch (IllegalArgumentException e) {
        String messageChain = messageChain(e);
        if (messageChain.contains("URLPath")) {
            System.out.println("Message chain contains URLPath as required: "
                    + messageChain);
        } else {
            fail("Exception chain for CaseProb does not mention property" +
                    " URLPath differing only in case");
            System.out.println("Full stack trace:");
            e.printStackTrace(System.out);
        }
    }
}
RandomMXBeanTest.java 文件源码 项目:jdk8u-jdk 阅读 22 收藏 0 点赞 0 评论 0
private static <T> void test(MBeanServer mbs, Class<T> c) throws Exception {
    System.out.println("Testing " + c.getName());
    T merlin = c.cast(
        Proxy.newProxyInstance(c.getClassLoader(),
            new Class<?>[] {c},
            new DullInvocationHandler()));
    ObjectName merlinName = new ObjectName("a:type=" + c.getName());
    mbs.registerMBean(merlin, merlinName);
    System.out.println(mbs.getMBeanInfo(merlinName));
    T merlinProxy = JMX.newMXBeanProxy(mbs, merlinName, c);
    Method[] merlinMethods = c.getMethods();
    for (Method m : merlinMethods) {
        Class<?>[] types = m.getParameterTypes();
        Object[] params = new Object[types.length];
        for (int i = 0; i < types.length; i++)
            params[i] = DullInvocationHandler.zeroFor(types[i]);
        System.out.println("Invoking " + m.getName());
        m.invoke(merlinProxy, (Object[]) params);
    }
}
JMXProxyFallbackTest.java 文件源码 项目:openjdk-jdk10 阅读 24 收藏 0 点赞 0 评论 0
private static void testPrivate(Class<?> iface) throws Exception {
    try {
        System.out.println("Creating a proxy for private M(X)Bean " +
                            iface.getName() + " ...");

        MBeanServer mbs = MBeanServerFactory.newMBeanServer();
        ObjectName on = new ObjectName("test:type=Proxy");

        JMX.newMBeanProxy(mbs, on, iface);
        success("Created a proxy for private M(X)Bean - " + iface.getName());
    } catch (Exception e) {
        Throwable t = e;
        while (t != null && !(t instanceof NotCompliantMBeanException)) {
            t = t.getCause();
        }
        if (t != null) {
            fail("Proxy not created");
        } else {
            throw e;
        }
    }
}
ExceptionDiagnosisTest.java 文件源码 项目:openjdk-jdk10 阅读 20 收藏 0 点赞 0 评论 0
private static void testCaseProb() throws Exception {
    MBeanServer mbs = MBeanServerFactory.newMBeanServer();
    ObjectName name = new ObjectName("a:b=c");
    mbs.registerMBean(new CaseProbImpl(), name);
    CaseProbMXBean proxy = JMX.newMXBeanProxy(mbs, name, CaseProbMXBean.class);
    try {
        CaseProb prob = proxy.getCaseProb();
        fail("No exception from proxy method getCaseProb");
    } catch (IllegalArgumentException e) {
        String messageChain = messageChain(e);
        if (messageChain.contains("URLPath")) {
            System.out.println("Message chain contains URLPath as required: "
                    + messageChain);
        } else {
            fail("Exception chain for CaseProb does not mention property" +
                    " URLPath differing only in case");
            System.out.println("Full stack trace:");
            e.printStackTrace(System.out);
        }
    }
}
RandomMXBeanTest.java 文件源码 项目:openjdk-jdk10 阅读 25 收藏 0 点赞 0 评论 0
private static <T> void test(MBeanServer mbs, Class<T> c) throws Exception {
    System.out.println("Testing " + c.getName());
    T merlin = c.cast(
        Proxy.newProxyInstance(c.getClassLoader(),
            new Class<?>[] {c},
            new DullInvocationHandler()));
    ObjectName merlinName = new ObjectName("a:type=" + c.getName());
    mbs.registerMBean(merlin, merlinName);
    System.out.println(mbs.getMBeanInfo(merlinName));
    T merlinProxy = JMX.newMXBeanProxy(mbs, merlinName, c);
    Method[] merlinMethods = c.getMethods();
    for (Method m : merlinMethods) {
        Class<?>[] types = m.getParameterTypes();
        Object[] params = new Object[types.length];
        for (int i = 0; i < types.length; i++)
            params[i] = DullInvocationHandler.zeroFor(types[i]);
        System.out.println("Invoking " + m.getName());
        m.invoke(merlinProxy, (Object[]) params);
    }
}
AbstractDynamicWrapperTest.java 文件源码 项目:hashsdn-controller 阅读 22 收藏 0 点赞 0 评论 0
@Test
public void testReadAttributes() throws Exception {
    DynamicMBean proxy = JMX.newMBeanProxy(platformMBeanServer, threadPoolDynamicWrapperON, DynamicMBean.class);

    assertEquals(threadCount, proxy.getAttribute(THREAD_COUNT));

    assertEquals(threadPoolConfigBean.isTriggerNewInstanceCreation(),
            proxy.getAttribute(TRIGGER_NEW_INSTANCE_CREATION));

    AttributeList attributes = proxy.getAttributes(new String[] { THREAD_COUNT, TRIGGER_NEW_INSTANCE_CREATION });
    assertEquals(2, attributes.size());
    Attribute threadCountAttr = (Attribute) attributes.get(0);
    assertEquals(THREAD_COUNT, threadCountAttr.getName());
    assertEquals(threadCount, threadCountAttr.getValue());
    Attribute boolTestAttr = (Attribute) attributes.get(1);
    assertEquals(TRIGGER_NEW_INSTANCE_CREATION, boolTestAttr.getName());
    assertEquals(threadPoolConfigBean.isTriggerNewInstanceCreation(), boolTestAttr.getValue());

    MBeanInfo beanInfo = proxy.getMBeanInfo();
    assertEquals(2, beanInfo.getAttributes().length);
}
DynamicWritableWrapperTest.java 文件源码 项目:hashsdn-controller 阅读 25 收藏 0 点赞 0 评论 0
@Test
public void testSetAttribute() throws Exception {
    DynamicMBean proxy = JMX.newMBeanProxy(platformMBeanServer, threadPoolDynamicWrapperON, DynamicMBean.class);

    proxy.setAttribute(new Attribute(THREAD_COUNT, newThreadCount));

    assertEquals(newThreadCount, proxy.getAttribute(THREAD_COUNT));
    assertEquals(newThreadCount, threadPoolConfigBean.getThreadCount());

    AttributeList attributeList = new AttributeList();
    attributeList.add(new Attribute(THREAD_COUNT, threadCount));
    boolean bool = true;
    attributeList.add(new Attribute(TRIGGER_NEW_INSTANCE_CREATION, bool));
    proxy.setAttributes(attributeList);

    assertEquals(threadCount, threadPoolConfigBean.getThreadCount());
    assertEquals(bool, threadPoolConfigBean.isTriggerNewInstanceCreation());
}
DynamicWritableWrapperTest.java 文件源码 项目:hashsdn-controller 阅读 19 收藏 0 点赞 0 评论 0
@Test
public void testObjectNameSetterWithONContainingTransaction_shouldBeTranslatedToReadOnlyON() throws Exception {
    TestingParallelAPSPModuleFactory testingParallelAPSPConfigBeanFactory = new TestingParallelAPSPModuleFactory();
    TestingParallelAPSPModule apspConfigBean = testingParallelAPSPConfigBeanFactory.createModule("", null, null);
    ModuleIdentifier moduleIdentifier2 = new ModuleIdentifier("apsp", "parallel");
    ObjectName dynON2 = ObjectNameUtil.createReadOnlyModuleON(moduleIdentifier2);
    AbstractDynamicWrapper dyn = getDynamicWrapper(apspConfigBean, moduleIdentifier2);
    platformMBeanServer.registerMBean(dyn, dynON2);
    try {
        TestingParallelAPSPConfigMXBean proxy = JMX.newMBeanProxy(platformMBeanServer, dynON2,
                TestingParallelAPSPConfigMXBean.class);
        ObjectName withTransactionName = ObjectNameUtil.createTransactionModuleON("transaction1", "moduleName",
                "instanceName");
        proxy.setThreadPool(withTransactionName);
        ObjectName withoutTransactionName = ObjectNameUtil.withoutTransactionName(withTransactionName);
        assertEquals(withoutTransactionName, proxy.getThreadPool());
    } finally {
        platformMBeanServer.unregisterMBean(dynON2);
    }
}
ThreadPoolMetrics.java 文件源码 项目:sstable-adaptor 阅读 22 收藏 0 点赞 0 评论 0
public static Object getJmxMetric(MBeanServerConnection mbeanServerConn, String jmxPath, String poolName, String metricName)
{
    String name = String.format("org.apache.cassandra.metrics:type=ThreadPools,path=%s,scope=%s,name=%s", jmxPath, poolName, metricName);

    try
    {
        ObjectName oName = new ObjectName(name);
        if (!mbeanServerConn.isRegistered(oName))
        {
            return "N/A";
        }

        switch (metricName)
        {
            case "ActiveTasks":
            case "PendingTasks":
            case "CompletedTasks":
                return JMX.newMBeanProxy(mbeanServerConn, oName, JmxReporter.JmxGaugeMBean.class).getValue();
            case "TotalBlockedTasks":
            case "CurrentlyBlockedTasks":
                return JMX.newMBeanProxy(mbeanServerConn, oName, JmxReporter.JmxCounterMBean.class).getCount();
            default:
                throw new AssertionError("Unknown metric name " + metricName);
        }
    }
    catch (Exception e)
    {
        throw new RuntimeException("Error reading: " + name, e);
    }
}
RedisThrottler.java 文件源码 项目:log4j2-redis-appender 阅读 24 收藏 0 点赞 0 评论 0
private RedisThrottlerJmxBean registerOrGetJmxBean() {
    MBeanServer mbs = ManagementFactory.getPlatformMBeanServer();
    try {
        synchronized (jmxBeanReferenceCountByName) {

            // Get the reference count for the JMX bean.
            Integer jmxBeanReferenceCount = jmxBeanReferenceCountByName.get(jmxBeanName);
            if (jmxBeanReferenceCount == null) {
                jmxBeanReferenceCount = 0;
            }

            // Create or get the JMX bean.
            RedisThrottlerJmxBean jmxBean;
            try {
                jmxBean = new RedisThrottlerInternalJmxBean();
                StandardMBean jmxBeanWrapper = new StandardMBean(jmxBean, RedisThrottlerJmxBean.class);
                mbs.registerMBean(jmxBeanWrapper, jmxBeanName);
            } catch (InstanceAlreadyExistsException ignored) {
                jmxBean = JMX.newMBeanProxy(mbs, jmxBeanName, RedisThrottlerJmxBean.class);
            }

            // Increment the reference count and return the JMX bean.
            jmxBeanReferenceCountByName.put(jmxBeanName, jmxBeanReferenceCount + 1);
            return jmxBean;

        }
    } catch (Throwable error) {
        String message = String.format("failed accessing the JMX bean (jmxBeanName=%s)", jmxBeanName);
        throw new RuntimeException(message, error);
    }
}
AbstractJMXAgentObserver.java 文件源码 项目:Pogamut3 阅读 68 收藏 0 点赞 0 评论 0
/**
 * Creates JMX wrapper for agent on specified adress and adds it to the list
 * of all connected agents.
 * @param serviceUrl URL of the JMX service where remote agent resides eg. service:jmx:rmi:///jndi/rmi://localhost:9999/server
 * @param objectName name of the MBean representing agent eg. myDomain:name=MyAgent1
 */
protected void addJMXAgentFromAdress(String serviceUrl, ObjectName objectName) throws IOException {
    JMXServiceURL url = new JMXServiceURL(serviceUrl);
    JMXConnector jmxc = JMXConnectorFactory.connect(url, null);
    MBeanServerConnection mbsc = jmxc.getMBeanServerConnection();

    IAgent agent = JMX.newMXBeanProxy(mbsc, objectName, IAgent.class);

    agents.add(agent);
}
JmxConnectionPool.java 文件源码 项目:streamsx.jmxclients 阅读 24 收藏 0 点赞 0 评论 0
@Override
public JobMXBean getJobBean(String domainId, String instanceId,
        BigInteger jobId) {
    ObjectName objName = ObjectNameBuilder.job(domainId, instanceId,
            jobId);

    return JMX.newMXBeanProxy(connection, objName, JobMXBean.class,
            true);
}
JmxConnectionPool.java 文件源码 项目:streamsx.jmxclients 阅读 22 收藏 0 点赞 0 评论 0
@Override
public PeMXBean getPeBean(String domainId, String instanceId,
        BigInteger peId) {
    ObjectName objName = ObjectNameBuilder.pe(domainId, instanceId,
            peId);
    return JMX
            .newMXBeanProxy(connection, objName, PeMXBean.class, true);
}
JmxConnectionPool.java 文件源码 项目:streamsx.jmxclients 阅读 26 收藏 0 点赞 0 评论 0
@Override
public DomainMXBean getDomainBean(String domainId) {
    ObjectName objName = ObjectNameBuilder.domain(domainId);

    return JMX.newMXBeanProxy(connection, objName, DomainMXBean.class,
            true);
}
JmxConnectionPool.java 文件源码 项目:streamsx.jmxclients 阅读 20 收藏 0 点赞 0 评论 0
@Override
public InstanceMXBean getInstanceBean(String domainId, String instanceId) {
    ObjectName objName = ObjectNameBuilder.instance(domainId,
            instanceId);
    return JMX.newMXBeanProxy(connection, objName,
            InstanceMXBean.class, true);
}
JmxConnectionPool.java 文件源码 项目:streamsx.jmxclients 阅读 22 收藏 0 点赞 0 评论 0
@Override
public ResourceMXBean getResourceBean(String domainId, String resourceId) {
    ObjectName resourceObjectName = ObjectNameBuilder.resource(
            domainId, resourceId);

    return JMX.newMXBeanProxy(connection, resourceObjectName,
            ResourceMXBean.class, true);
}
JmxConnectionPool.java 文件源码 项目:streamsx.jmxclients 阅读 22 收藏 0 点赞 0 评论 0
@Override
public DomainServiceMXBean getDomainServiceBean(String domainId,
        Type serviceType) {
    ObjectName serviceObjectName = ObjectNameBuilder.domainService(
            domainId, serviceType);
    return JMX.newMXBeanProxy(connection, serviceObjectName,
            DomainServiceMXBean.class, true);
}
JmxConnectionPool.java 文件源码 项目:streamsx.jmxclients 阅读 19 收藏 0 点赞 0 评论 0
@Override
public InstanceServiceMXBean getInstanceServiceMXBean(
        String domainId,
        String instanceId,
        com.ibm.streams.management.instance.InstanceServiceMXBean.Type serviceType) {
    ObjectName serviceObjectName = ObjectNameBuilder.instanceService(
            domainId, instanceId, serviceType);
    return JMX.newMXBeanProxy(connection, serviceObjectName,
            InstanceServiceMXBean.class, true);
}
ShutdownTest.java 文件源码 项目:hashsdn-controller 阅读 24 收藏 0 点赞 0 评论 0
@Test
public void testWrongSecret() throws Exception {
    setSecret("secret");
    try {
        ShutdownRuntimeMXBean runtime = JMX.newMXBeanProxy(platformMBeanServer, runtimeON, ShutdownRuntimeMXBean.class);
        runtime.shutdown("foo", 60000L, null);
        fail();
    } catch (final IllegalArgumentException e) {
        assertEquals("Invalid secret", e.getMessage());
    }
}
JmxConnectionPool.java 文件源码 项目:streamsx.jmxclients 阅读 21 收藏 0 点赞 0 评论 0
@Override
public OperatorInputPortMXBean getOperatorInputPortMXBean(
        String domainId, String instanceId, BigInteger jobId,
        String operator, int indexWithinOperator) {
    ObjectName inputPortName = ObjectNameBuilder.operatorInputPort(
            domainId, instanceId, jobId, operator, indexWithinOperator);
    return JMX.newMXBeanProxy(connection, inputPortName,
            OperatorInputPortMXBean.class, true);
}
JmxConnectionPool.java 文件源码 项目:streamsx.jmxclients 阅读 24 收藏 0 点赞 0 评论 0
@Override
public OperatorOutputPortMXBean getOperatorOutputPortMXBean(
        String domainId, String instanceId, BigInteger jobId,
        String operator, int indexWithinOperator) {
    ObjectName outputPortName = ObjectNameBuilder.operatorOutputPort(
            domainId, instanceId, jobId, operator, indexWithinOperator);
    return JMX.newMXBeanProxy(connection, outputPortName,
            OperatorOutputPortMXBean.class, true);
}
JmxConnectionPool.java 文件源码 项目:streamsx.jmxclients 阅读 21 收藏 0 点赞 0 评论 0
@Override
public PeInputPortMXBean getPeInputPortMXBean(String domainId,
        String instanceId, BigInteger peId, int indexWithinPe) {
    ObjectName inputPortName = ObjectNameBuilder.peInputPort(domainId,
            instanceId, peId, indexWithinPe);
    return JMX.newMXBeanProxy(connection, inputPortName,
            PeInputPortMXBean.class, true);
}
JmxConnectionPool.java 文件源码 项目:streamsx.jmxclients 阅读 25 收藏 0 点赞 0 评论 0
@Override
public PeOutputPortMXBean getPeOutputPortMXBean(String domainId,
        String instanceId, BigInteger peId, int indexWithinPe) {
    ObjectName outputPortName = ObjectNameBuilder.peOutputPort(
            domainId, instanceId, peId, indexWithinPe);
    return JMX.newMXBeanProxy(connection, outputPortName,
            PeOutputPortMXBean.class, true);
}


问题


面经


文章

微信
公众号

扫码关注公众号