Search in sources :

Example 11 with InstrumentationManagerImpl

use of org.apache.cxf.management.jmx.InstrumentationManagerImpl in project fabric8 by jboss-fuse.

the class EnableJMXFeature method initialize.

@Override
public void initialize(Server server, Bus bus) {
    ManagedApi mApi = new ManagedApi(bus, server.getEndpoint(), server);
    ManagedEndpoint mEndpoint = new ManagedEndpoint(bus, server.getEndpoint(), server);
    InstrumentationManager iMgr = bus.getExtension(InstrumentationManager.class);
    if (iMgr == null) {
        iMgr = new InstrumentationManagerImpl(bus);
    }
    ((InstrumentationManagerImpl) iMgr).setUsePlatformMBeanServer(true);
    ((InstrumentationManagerImpl) iMgr).setCreateMBServerConnectorFactory(false);
    ((InstrumentationManagerImpl) iMgr).setEnabled(true);
    ((InstrumentationManagerImpl) iMgr).init();
    if (iMgr != null) {
        try {
            iMgr.register(mApi);
            iMgr.register(mEndpoint);
            ServerLifeCycleManager slcMgr = bus.getExtension(ServerLifeCycleManager.class);
            if (slcMgr != null) {
                slcMgr.registerListener(mApi);
                slcMgr.registerListener(mEndpoint);
                mApi.startServer(server);
                mEndpoint.startServer(server);
            }
        } catch (JMException jmex) {
            jmex.printStackTrace();
            LOG.log(Level.WARNING, "Registering ManagedApi failed.", jmex);
        }
    }
}
Also used : InstrumentationManagerImpl(org.apache.cxf.management.jmx.InstrumentationManagerImpl) ServerLifeCycleManager(org.apache.cxf.endpoint.ServerLifeCycleManager) JMException(javax.management.JMException) ManagedEndpoint(org.apache.cxf.endpoint.ManagedEndpoint) InstrumentationManager(org.apache.cxf.management.InstrumentationManager)

Aggregations

InstrumentationManagerImpl (org.apache.cxf.management.jmx.InstrumentationManagerImpl)11 InstrumentationManager (org.apache.cxf.management.InstrumentationManager)10 Bus (org.apache.cxf.Bus)6 ObjectName (javax.management.ObjectName)5 Test (org.junit.Test)5 JMException (javax.management.JMException)4 MBeanServer (javax.management.MBeanServer)4 ManagedEndpoint (org.apache.cxf.endpoint.ManagedEndpoint)4 Greeter (org.apache.hello_world_soap_http.Greeter)3 ArrayList (java.util.ArrayList)2 SpringBusFactory (org.apache.cxf.bus.spring.SpringBusFactory)2 Server (org.apache.cxf.endpoint.Server)2 ServerLifeCycleManager (org.apache.cxf.endpoint.ServerLifeCycleManager)2 ServerRegistry (org.apache.cxf.endpoint.ServerRegistry)2 CounterRepository (org.apache.cxf.management.counters.CounterRepository)2 SOAPService (org.apache.hello_world_soap_http.SOAPService)2 Properties (java.util.Properties)1 InstanceNotFoundException (javax.management.InstanceNotFoundException)1 Endpoint (javax.xml.ws.Endpoint)1 AbstractFeature (org.apache.cxf.feature.AbstractFeature)1