src/java/org/apache/cassandra/tools/NodeProbe.java
/**
     * Create a connection to the JMX agent and setup the M[X]Bean proxies.
     * 
     * @throws IOException on connection failures
     */
Create a connection to the JMX agent and setup the M[X]Bean proxies.

@throws IOException on connection failures
Create a connection to the JMX agent and setup the M [ X ] Bean proxies . @throws IOException on connection failures
private void connect() throws IOException
    {
        JMXServiceURL jmxUrl = new JMXServiceURL(String.format(fmtUrl, host, port));
        Map<String,Object> env = new HashMap<String,Object>();
        if (username != null)
        {
            String[] creds = { username, password };
            env.put(JMXConnector.CREDENTIALS, creds);
        }
        jmxc = JMXConnectorFactory.connect(jmxUrl, env);
        mbeanServerConn = jmxc.getMBeanServerConnection();
        try
        {
            ObjectName name = new ObjectName(ssObjName);
            ssProxy = JMX.newMBeanProxy(mbeanServerConn, name, StorageServiceMBean.class);
            name = new ObjectName(MessagingService.MBEAN_NAME);
            msProxy = JMX.newMBeanProxy(mbeanServerConn, name, MessagingServiceMBean.class);
            name = new ObjectName(StreamingService.MBEAN_OBJECT_NAME);
            streamProxy = JMX.newMBeanProxy(mbeanServerConn, name, StreamingServiceMBean.class);
            name = new ObjectName(CompactionManager.MBEAN_OBJECT_NAME);
            compactionProxy = JMX.newMBeanProxy(mbeanServerConn, name, CompactionManagerMBean.class);
            name = new ObjectName(FailureDetector.MBEAN_NAME);
            fdProxy = JMX.newMBeanProxy(mbeanServerConn, name, FailureDetectorMBean.class);
            name = new ObjectName(CacheService.MBEAN_NAME);
            cacheService = JMX.newMBeanProxy(mbeanServerConn, name, CacheServiceMBean.class);
        } catch (MalformedObjectNameException e)
        {
            throw new RuntimeException(
                    "Invalid ObjectName? Please report this as a bug.", e);
        }
        memProxy = ManagementFactory.newPlatformMXBeanProxy(mbeanServerConn, 
                ManagementFactory.MEMORY_MXBEAN_NAME, MemoryMXBean.class);
        runtimeProxy = ManagementFactory.newPlatformMXBeanProxy(
                mbeanServerConn, ManagementFactory.RUNTIME_MXBEAN_NAME, RuntimeMXBean.class);
    }
private void connect ( ) throws IOException { JMXServiceURL jmxUrl = new JMXServiceURL ( String . format ( fmtUrl , host , port ) ) ; Map < String , Object > env = new HashMap < String , Object > ( ) ; if ( username != null ) { String [ ] creds = { username , password } ; env . put ( JMXConnector . CREDENTIALS , creds ) ; } jmxc = JMXConnectorFactory . connect ( jmxUrl , env ) ; mbeanServerConn = jmxc . getMBeanServerConnection ( ) ; try { ObjectName name = new ObjectName ( ssObjName ) ; ssProxy = JMX . newMBeanProxy ( mbeanServerConn , name , StorageServiceMBean . class ) ; name = new ObjectName ( MessagingService . MBEAN_NAME ) ; msProxy = JMX . newMBeanProxy ( mbeanServerConn , name , MessagingServiceMBean . class ) ; name = new ObjectName ( StreamingService . MBEAN_OBJECT_NAME ) ; streamProxy = JMX . newMBeanProxy ( mbeanServerConn , name , StreamingServiceMBean . class ) ; name = new ObjectName ( CompactionManager . MBEAN_OBJECT_NAME ) ; compactionProxy = JMX . newMBeanProxy ( mbeanServerConn , name , CompactionManagerMBean . class ) ; name = new ObjectName ( FailureDetector . MBEAN_NAME ) ; fdProxy = JMX . newMBeanProxy ( mbeanServerConn , name , FailureDetectorMBean . class ) ; name = new ObjectName ( CacheService . MBEAN_NAME ) ; cacheService = JMX . newMBeanProxy ( mbeanServerConn , name , CacheServiceMBean . class ) ; } catch ( MalformedObjectNameException e ) { throw new RuntimeException ( "Invalid ObjectName? Please report this as a bug." , e ) ; } memProxy = ManagementFactory . newPlatformMXBeanProxy ( mbeanServerConn , ManagementFactory . MEMORY_MXBEAN_NAME , MemoryMXBean . class ) ; runtimeProxy = ManagementFactory . newPlatformMXBeanProxy ( mbeanServerConn , ManagementFactory . RUNTIME_MXBEAN_NAME , RuntimeMXBean . class ) ; }
Create a connection to the JMX agent and setup the M[X]Bean proxies.
Create a connection to the JMX agent and setup the M [ X ] Bean proxies .