protected MBeanServerConnection getMBeanServerConnection ( String childName ) { MBeanConnectionInfo connInfo = connections . get ( childName ) ; if ( connInfo == null ) { connInfo = new MBeanConnectionInfo ( ) ; connections . put ( childName , connInfo ) ; } long childPid = main . getFirstJavaChildPid ( childName ) ; if ( childPid > 0 && childPid != connInfo . childPid && connInfo . connector != null ) { try { connInfo . connector . close ( ) ; } catch ( IOException e ) { logger . log ( Level . FINE , "Failed to close JMXConnector" , e ) ; } connInfo . connector = null ; connInfo . server = null ; } if ( childPid > 0 ) { try { if ( connInfo . connector == null ) { connInfo . connector = DeployerControl . getJMXConnector ( childPid ) ; } if ( connInfo . connector != null && connInfo . server == null ) { connInfo . server = connInfo . connector . getMBeanServerConnection ( ) ; connInfo . childPid = childPid ; } } catch ( IOException e ) { logger . log ( Level . FINE , "Failed to get JMX connection" , e ) ; try { connInfo . connector . close ( ) ; } catch ( Exception e2 ) { logger . log ( Level . FINE , "Failed to close JMXConnector" , e2 ) ; } connInfo . connector = null ; connInfo . server = null ; } } return connInfo . server ; }
Return the MBean server connection to the child process .