public synchronized void stopThrow ( ) throws JMException { if ( connector != null ) { try { connector . stop ( ) ; } catch ( IOException e ) { throw createJmException ( "Could not stop our Jmx connector server" , e ) ; } finally { connector = null ; } } if ( rmiRegistry != null ) { try { UnicastRemoteObject . unexportObject ( rmiRegistry , true ) ; } catch ( NoSuchObjectException e ) { throw createJmException ( "Could not unexport our RMI registry" , e ) ; } finally { rmiRegistry = null ; } } if ( serverHostNamePropertySet ) { System . clearProperty ( RMI_SERVER_HOST_NAME_PROPERTY ) ; serverHostNamePropertySet = false ; } }
Stop the JMX server by closing the connector and unpublishing it from the RMI registry . This throws a JMException on any issues .