use of javax.management.JMException in project cxf by apache.
the class WorkQueueManagerImpl method setBus.
@Resource
public final void setBus(Bus bus) {
this.bus = bus;
if (null != bus) {
bus.setExtension(this, WorkQueueManager.class);
imanager = bus.getExtension(InstrumentationManager.class);
if (null != imanager) {
try {
imanager.register(new WorkQueueManagerImplMBeanWrapper(this));
} catch (JMException jmex) {
LOG.log(Level.WARNING, jmex.getMessage(), jmex);
}
}
ConfiguredBeanLocator locator = bus.getExtension(ConfiguredBeanLocator.class);
Collection<? extends AutomaticWorkQueue> q = locator.getBeansOfType(AutomaticWorkQueue.class);
if (q != null) {
for (AutomaticWorkQueue awq : q) {
addNamedWorkQueue(awq.getName(), awq);
}
}
if (!namedQueues.containsKey(DEFAULT_QUEUE_NAME)) {
AutomaticWorkQueue defaultQueue = locator.getBeanOfType(DEFAULT_WORKQUEUE_BEAN_NAME, AutomaticWorkQueue.class);
if (defaultQueue != null) {
addNamedWorkQueue(DEFAULT_QUEUE_NAME, defaultQueue);
}
}
bus.getExtension(BusLifeCycleManager.class).registerLifeCycleListener(new WQLifecycleListener());
}
}
use of javax.management.JMException in project cxf by apache.
the class RMManager method initialise.
@PostConstruct
void initialise() {
if (configuration == null) {
getConfiguration().setExponentialBackoff(true);
}
DeliveryAssurance da = configuration.getDeliveryAssurance();
if (da == null) {
configuration.setDeliveryAssurance(DeliveryAssurance.AT_LEAST_ONCE);
}
if (null == sourcePolicy) {
setSourcePolicy(null);
}
if (null == destinationPolicy) {
DestinationPolicyType dp = new DestinationPolicyType();
dp.setAcksPolicy(new AcksPolicyType());
setDestinationPolicy(dp);
}
if (null == retransmissionQueue) {
retransmissionQueue = new RetransmissionQueueImpl(this);
}
if (null == redeliveryQueue) {
redeliveryQueue = new RedeliveryQueueImpl(this);
}
if (null == idGenerator) {
idGenerator = new DefaultSequenceIdentifierGenerator();
}
if (null != bus) {
managedManager = new ManagedRMManager(this);
instrumentationManager = bus.getExtension(InstrumentationManager.class);
if (instrumentationManager != null) {
try {
instrumentationManager.register(managedManager);
} catch (JMException jmex) {
LOG.log(Level.WARNING, "Registering ManagedRMManager failed.", jmex);
}
}
}
}
use of javax.management.JMException in project cxf by apache.
the class ManagedRMEndpoint method terminateSourceSequence.
@ManagedOperation(description = "Terminate Source Sequence")
@ManagedOperationParameters({ @ManagedOperationParameter(name = "sequenceId", description = "The sequence identifier") })
public void terminateSourceSequence(String sid) throws JMException {
SourceSequence ss = getSourceSeq(sid);
if (null == ss) {
throw new JMException("no source sequence");
}
Proxy proxy = endpoint.getProxy();
try {
proxy.terminate(ss);
ss.getSource().removeSequence(ss);
} catch (RMException e) {
throw new JMException("Error terminating sequence: " + e.getMessage());
}
}
use of javax.management.JMException in project cxf by apache.
the class ManagedRMEndpoint method terminateDestinationSequence.
@ManagedOperation(description = "Terminate Destination Sequence")
@ManagedOperationParameters({ @ManagedOperationParameter(name = "sequenceId", description = "The sequence identifier") })
public void terminateDestinationSequence(String sid) throws JMException {
DestinationSequence ds = getDestinationSeq(sid);
if (null == ds) {
throw new JMException("no destination sequence");
}
Proxy proxy = endpoint.getProxy();
try {
proxy.terminate(ds);
ds.getDestination().removeSequence(ds);
} catch (RMException e) {
throw new JMException("Error terminating sequence: " + e.getMessage());
}
}
use of javax.management.JMException in project cxf by apache.
the class JMXManagedComponentManagerTest method testRegisterInstrumentation.
@Test
public void testRegisterInstrumentation() throws Exception {
AnnotationTestInstrumentation im = new AnnotationTestInstrumentation();
ObjectName name = new ObjectName("org.apache.cxf:type=foo,name=bar");
im.setName("John Smith");
manager.register(im, name);
Object val = manager.getMBeanServer().getAttribute(name, NAME_ATTRIBUTE);
assertEquals("Incorrect result", "John Smith", val);
try {
manager.register(im, name);
fail("Registering with existing name should fail.");
} catch (JMException jmex) {
// Expected
}
manager.register(im, name, true);
val = manager.getMBeanServer().getAttribute(name, NAME_ATTRIBUTE);
assertEquals("Incorrect result", "John Smith", val);
manager.unregister(name);
im.setName("Foo Bar");
name = manager.register(im);
val = manager.getMBeanServer().getAttribute(name, NAME_ATTRIBUTE);
assertEquals("Incorrect result", "Foo Bar", val);
try {
manager.register(im);
fail("Registering with existing name should fail.");
} catch (JMException jmex) {
// Expected
}
name = manager.register(im, true);
val = manager.getMBeanServer().getAttribute(name, NAME_ATTRIBUTE);
assertEquals("Incorrect result", "Foo Bar", val);
manager.unregister(im);
}
Aggregations