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;
}
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);
}
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;
}
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);
}
}
}
}
}
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());
}
}
Aggregations