use of org.glassfish.external.amx.AMXGlassfish in project Payara by payara.
the class WebServicesContainer method postConstruct.
@Override
public void postConstruct() {
// Register listener for AMX DomainRoot loaded
final AMXGlassfish amxg = AMXGlassfish.DEFAULT;
amxg.listenForDomainRoot(ManagementFactory.getPlatformMBeanServer(), this);
LazyMOMProvider.INSTANCE.initMOMForScope(LazyMOMProvider.Scope.GLASSFISH_NO_JMX);
}
use of org.glassfish.external.amx.AMXGlassfish in project Payara by payara.
the class MonitoringBootstrap method setStatsProviderManagerDelegate.
public void setStatsProviderManagerDelegate() {
// only run the code one time!
if (spmd != null)
return;
// Set the StatsProviderManagerDelegate, so we can start processing the StatsProviders
spmd = new StatsProviderManagerDelegateImpl(pcm, probeRegistry, mrdr, serverEnv.getInstanceName(), monitoringService);
StatsProviderManager.setStatsProviderManagerDelegate(spmd);
StatsProviderUtil.setStatsProviderManagerDelegate(spmd);
if (LOGGER.isLoggable(Level.FINE))
LOGGER.fine(" StatsProviderManagerDelegate is assigned");
// Register listener for AMX DomainRoot loaded
final AMXGlassfish amxg = AMXGlassfish.DEFAULT;
amxg.listenForDomainRoot(ManagementFactory.getPlatformMBeanServer(), spmd);
}
use of org.glassfish.external.amx.AMXGlassfish in project Payara by payara.
the class AMXStartupService method _loadAMXMBeans.
public synchronized ObjectName _loadAMXMBeans() {
// self-check important MBeans
final AMXGlassfish amxg = AMXGlassfish.DEFAULT;
final MBeanListener<MyListener> bootAMXListener = amxg.listenForBootAMX(mMBeanServer, new MyListener());
final MBeanListener<MyListener> domainRootListener = amxg.listenForDomainRoot(mMBeanServer, new MyListener());
// loads the high-level AMX MBeans, like DomainRoot, QueryMgr, etc
loadDomainRoot();
FeatureAvailability.getInstance().registerFeature(FeatureAvailability.AMX_CORE_READY_FEATURE, getDomainRoot());
logger.log(Level.FINE, "AMXStartupServiceNew: AMX core MBeans are ready for use, DomainRoot = {0}", getDomainRoot());
try {
// Find and load any additional AMX subsystems
final Collection<AMXLoader> loaders = mHabitat.getAllServices(AMXLoader.class);
logger.log(Level.FINE, "AMXStartupService._loadAMXMBeans(): found this many loaders: {0}", loaders.size());
final AMXLoaderThread[] threads = new AMXLoaderThread[loaders.size()];
int i = 0;
for (final AMXLoader loader : loaders) {
logger.log(Level.FINE, "AMXStartupService._loadAMXMBeans(): found this many loaders: {0}", loader);
threads[i] = new AMXLoaderThread(loader);
threads[i].start();
++i;
}
// don't mark AMX ready until all loaders have finished
for (final AMXLoaderThread thread : threads) {
thread.waitDone();
}
} catch (Throwable t) {
logger.log(Level.INFO, AMXLoggerInfo.fatalError, t);
} finally {
FeatureAvailability.getInstance().registerFeature(FeatureAvailability.AMX_READY_FEATURE, getDomainRoot());
logger.log(Level.INFO, AMXLoggerInfo.startupServiceDomainRoot, getDomainRoot());
}
// sanity-check (self-test) our listeners
if (bootAMXListener.getCallback().getRegistered() == null) {
throw new IllegalStateException("BootAMX listener was not called");
}
if (domainRootListener.getCallback().getRegistered() == null) {
throw new IllegalStateException("DomainRoot listener was not called");
}
return getDomainRoot();
}
use of org.glassfish.external.amx.AMXGlassfish in project Payara by payara.
the class RuntimeRootImpl method getJMXServiceURLs.
public String[] getJMXServiceURLs() {
try {
final AMXGlassfish amxg = AMXGlassfish.DEFAULT;
final JMXServiceURL[] items = (JMXServiceURL[]) getMBeanServer().getAttribute(amxg.getBootAMXMBeanObjectName(), "JMXServiceURLs");
final String[] urls = new String[items.length];
for (int i = 0; i < items.length; ++i) {
urls[i] = "" + items[i];
}
return urls;
} catch (final JMException e) {
throw new RuntimeException(e);
}
}
Aggregations