Search in sources :

Example 91 with JMException

use of javax.management.JMException in project ignite by apache.

the class IgniteUtils method jmException.

/**
 * Utility method creating {@link JMException} with given cause.
 *
 * @param e Cause exception.
 * @return Newly created {@link JMException}.
 */
public static JMException jmException(Throwable e) {
    JMException x = new JMException();
    x.initCause(e);
    return x;
}
Also used : JMException(javax.management.JMException)

Example 92 with JMException

use of javax.management.JMException in project cxf by apache.

the class InstrumentationManagerImpl method register.

private void register(Object obj, ObjectName name, ModelMBeanInfo mbi, boolean forceRegistration) throws JMException {
    RequiredModelMBean rtMBean = (RequiredModelMBean) mbs.instantiate("javax.management.modelmbean.RequiredModelMBean");
    rtMBean.setModelMBeanInfo(mbi);
    try {
        rtMBean.setManagedResource(obj, "ObjectReference");
    } catch (InvalidTargetObjectTypeException itotex) {
        throw new JMException(itotex.getMessage());
    }
    registerMBeanWithServer(rtMBean, persist(name), forceRegistration);
}
Also used : JMException(javax.management.JMException) InvalidTargetObjectTypeException(javax.management.modelmbean.InvalidTargetObjectTypeException) RequiredModelMBean(javax.management.modelmbean.RequiredModelMBean)

Example 93 with JMException

use of javax.management.JMException in project cxf by apache.

the class InstrumentationManagerImpl method setBus.

public void setBus(Bus bus) {
    if (this.bus == null) {
        readJMXProperties(bus);
    } else {
        // possibly this bus was reassigned from another im bean
        InstrumentationManager im = bus.getExtension(InstrumentationManager.class);
        if (this != im) {
            bus.setExtension(this, InstrumentationManager.class);
            try {
                ManagedBus mbus = new ManagedBus(bus);
                im.unregister(mbus);
                if (LOG.isLoggable(Level.INFO)) {
                    LOG.info("unregistered " + mbus.getObjectName());
                }
            } catch (JMException e) {
            // ignore
            }
        }
    }
    this.bus = bus;
}
Also used : ManagedBus(org.apache.cxf.bus.ManagedBus) JMException(javax.management.JMException) InstrumentationManager(org.apache.cxf.management.InstrumentationManager)

Example 94 with JMException

use of javax.management.JMException in project cxf by apache.

the class RMEndpoint method initialise.

void initialise(RMConfiguration config, Conduit c, EndpointReferenceType r, org.apache.cxf.transport.Destination d, Message message) {
    configuration = config;
    conduit = c;
    replyTo = r;
    createServices();
    createEndpoints(d);
    setPolicies(message);
    if (manager != null && manager.getBus() != null) {
        managedEndpoint = new ManagedRMEndpoint(this);
        instrumentationManager = manager.getBus().getExtension(InstrumentationManager.class);
        if (instrumentationManager != null) {
            ModelMBeanAssembler assembler = new ModelMBeanAssembler();
            ModelMBeanInfo mbi = assembler.getModelMbeanInfo(managedEndpoint.getClass());
            MBeanServer mbs = instrumentationManager.getMBeanServer();
            if (mbs == null) {
                LOG.log(Level.WARNING, "MBeanServer not available.");
            } else {
                try {
                    RequiredModelMBean rtMBean = (RequiredModelMBean) mbs.instantiate("javax.management.modelmbean.RequiredModelMBean");
                    rtMBean.setModelMBeanInfo(mbi);
                    try {
                        rtMBean.setManagedResource(managedEndpoint, "ObjectReference");
                    } catch (InvalidTargetObjectTypeException itotex) {
                        throw new JMException(itotex.getMessage());
                    }
                    ObjectName name = managedEndpoint.getObjectName();
                    instrumentationManager.register(rtMBean, name);
                    modelMBean = rtMBean;
                } catch (JMException jmex) {
                    LOG.log(Level.WARNING, "Registering ManagedRMEndpoint failed.", jmex);
                }
            }
        }
    }
}
Also used : ModelMBeanAssembler(org.apache.cxf.management.jmx.export.runtime.ModelMBeanAssembler) JMException(javax.management.JMException) InstrumentationManager(org.apache.cxf.management.InstrumentationManager) InvalidTargetObjectTypeException(javax.management.modelmbean.InvalidTargetObjectTypeException) ModelMBeanInfo(javax.management.modelmbean.ModelMBeanInfo) MBeanServer(javax.management.MBeanServer) RequiredModelMBean(javax.management.modelmbean.RequiredModelMBean) ObjectName(javax.management.ObjectName)

Example 95 with JMException

use of javax.management.JMException in project cxf by apache.

the class ManagedRMEndpoint method closeSourceSequence.

@ManagedOperation(description = "Close Source Sequence")
@ManagedOperationParameters({ @ManagedOperationParameter(name = "sequenceId", description = "The sequence identifier") })
public void closeSourceSequence(String sid) throws JMException {
    SourceSequence ss = getSourceSeq(sid);
    if (null == ss) {
        throw new JMException("no source sequence");
    }
    RetransmissionQueue rq = endpoint.getManager().getRetransmissionQueue();
    rq.stop(ss);
    Proxy proxy = endpoint.getProxy();
    try {
        proxy.lastMessage(ss);
    } catch (RMException e) {
        e.printStackTrace();
        throw new JMException("Error closing sequence: " + e.getMessage());
    }
}
Also used : JMException(javax.management.JMException) ManagedOperationParameters(org.apache.cxf.management.annotation.ManagedOperationParameters) ManagedOperation(org.apache.cxf.management.annotation.ManagedOperation)

Aggregations

JMException (javax.management.JMException)116 ObjectName (javax.management.ObjectName)66 MBeanServer (javax.management.MBeanServer)33 IOException (java.io.IOException)22 InstrumentationManager (org.apache.cxf.management.InstrumentationManager)13 MBeanInfo (javax.management.MBeanInfo)11 MalformedObjectNameException (javax.management.MalformedObjectNameException)11 MBeanAttributeInfo (javax.management.MBeanAttributeInfo)9 SnmpStatusException (com.sun.management.snmp.SnmpStatusException)7 ArrayList (java.util.ArrayList)7 HashMap (java.util.HashMap)7 Map (java.util.Map)7 StandardMBean (javax.management.StandardMBean)7 RequiredModelMBean (javax.management.modelmbean.RequiredModelMBean)6 Date (java.util.Date)5 Attribute (javax.management.Attribute)5 InvalidTargetObjectTypeException (javax.management.modelmbean.InvalidTargetObjectTypeException)5 Element (org.w3c.dom.Element)5 PostConstruct (javax.annotation.PostConstruct)4 ModelMBeanInfo (javax.management.modelmbean.ModelMBeanInfo)4