private synchronized void createJMXWorkAreaResourceIfChanged ( VirtualHost vhost ) { // Make sure our context root has been registered... String contextRoot = registeredContextRoot ; if ( contextRoot != null ) { // Make sure that we are dealing with the secure port before writing the file... String newAppURLString = vhost . getUrlString ( contextRoot , true ) ; if ( newAppURLString . startsWith ( "https" ) ) { // If we are dealing with the secure port, woohoo! String oldAppURL = appURL ; String newAppURL = processContextRootURL ( newAppURLString ) ; if ( oldAppURL == null || ! oldAppURL . equals ( newAppURL ) ) { this . appURL = newAppURL ; if ( restJMXAddressWorkareaFile == null ) { restJMXAddressWorkareaFile = createJMXWorkAreaResource ( locationService ) ; } else { createJmxAddressResource ( restJMXAddressWorkareaFile ) ; } if ( restJMXAddressStateFile == null ) { restJMXAddressStateFile = createJMXStateResource ( locationService ) ; } else { createJmxAddressResource ( restJMXAddressStateFile ) ; } // Register or update a marker service with JMX host/port Hashtable < String , Object > props = new Hashtable < String , Object > ( ) ; props . put ( "name" , "JMXConnectorEndpoint" ) ; props . put ( "jmxHost" , vhost . getHostName ( secureAlias ) ) ; props . put ( "jmxPort" , vhost . getSecureHttpPort ( secureAlias ) ) ; props . put ( "jmxAlias" , secureAlias ) ; if ( jmxEndpointRegistration == null ) jmxEndpointRegistration = bContext . registerService ( Object . class , this , props ) ; else jmxEndpointRegistration . setProperties ( props ) ; } } } }
Called to create the work area resource . Only re - generate the file if this is the first time or something in the url has changed .