use of org.glassfish.admin.mbeanserver.JMXStartupService in project Payara by payara.
the class ActiveJmsResourceAdapter method isASRmiRegistryPortAvailable.
private boolean isASRmiRegistryPortAvailable(JmsRaUtil jmsraUtil) {
if (_logger.isLoggable(Level.FINE))
logFine("isASRmiRegistryPortAvailable - JMSService Type:" + jmsraUtil.getJMSServiceType());
// AS RMI Registry. So the check below is not necessary.
if (jmsraUtil.getJMSServiceType().equals(REMOTE) || jmsraUtil.getJMSServiceType().equals(LOCAL)) {
return false;
}
try {
JmxConnector jmxConnector = getJmxConnector();
if (!"true".equals(jmxConnector.getEnabled()))
return false;
if ("true".equals(jmxConnector.getSecurityEnabled()))
return false;
// Attempt to detect JMXStartupService for RMI registry
if (_logger.isLoggable(Level.FINE)) {
_logger.fine("Detecting JMXStartupService...");
}
JMXStartupService jmxservice = Globals.get(JMXStartupService.class);
if (jmxservice == null)
return false;
jmxservice.waitUntilJMXConnectorStarted();
if (_logger.isLoggable(Level.FINE)) {
_logger.fine("Found JMXStartupService");
}
String name = "rmi://" + getConfiguredRmiRegistryHost() + ":" + getConfiguredRmiRegistryPort() + "/jmxrmi";
if (_logger.isLoggable(Level.FINE)) {
_logger.fine("Attempting to list " + name);
}
Naming.list(name);
if (_logger.isLoggable(Level.FINE)) {
_logger.fine("List on " + name + " succeeded");
}
// return configured port only if RMI registry is available
return true;
} catch (Exception e) {
if (_logger.isLoggable(Level.FINE)) {
_logger.fine("Failed to detect JMX RMI Registry: " + e.getMessage());
}
return false;
}
}
Aggregations