本文整理了Java中javax.management.RuntimeMBeanException.<init>
方法的一些代码示例,展示了RuntimeMBeanException.<init>
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。RuntimeMBeanException.<init>
方法的具体详情如下:
包路径:javax.management.RuntimeMBeanException
类名称:RuntimeMBeanException
方法名:<init>
暂无
代码示例来源:origin: apache/geode
@Override
public void setAlertLevelAsString(String level) {
String newLevel = level != null ? level.trim() : null;
try {
super.setAlertLevelAsString(newLevel);
} catch (IllegalArgumentException e) {
throw new RuntimeMBeanException(e, e.getMessage());
}
}
代码示例来源:origin: neo4j/neo4j
@Test
public void shouldHandleMBeanThatThrowsOnGetAttribute() throws Throwable
{
// given some JVM MBeans do not allow accessing their attributes, despite marking
// then as readable
when( jmxServer.getAttribute( beanName, "name" ) )
// We throw the exact combo thrown by JVM MBeans here, so that any other exception will bubble up,
// and we can make an informed decision about swallowing more exception on an as-needed basis.
.thenThrow( new RuntimeMBeanException(
new UnsupportedOperationException( "Haha, screw discoverable services!" ) ) );
JmxQueryProcedure procedure = new JmxQueryProcedure( ProcedureSignature.procedureName( "bob" ), jmxServer );
// when
RawIterator<Object[],ProcedureException> result = procedure.apply( null, new Object[]{"*:*"}, resourceTracker );
// then
assertThat( asList( result ), contains(
equalTo( new Object[]{
"org.neo4j:chevyMakesTheTruck=bobMcCoshMakesTheDifference",
"This is a description",
map( attributeName, map(
"description", "This is the attribute desc.",
"value", null
) )
} ) ) );
}
代码示例来源:origin: org.jboss.jbossas/jboss-as-mbeans
private void rethrowAsRuntimeMBeanException(Throwable t)
{
if (t instanceof RuntimeException)
throw new RuntimeMBeanException((RuntimeException) t);
else if (t instanceof Error)
throw new RuntimeErrorException((Error) t);
else
throw new RuntimeMBeanException(new RuntimeException("Unhandled exception", t));
}
}
代码示例来源:origin: org.jboss.mx/jboss-mbeans
private void rethrowAsRuntimeMBeanException(Throwable t)
{
if (t instanceof RuntimeException)
throw new RuntimeMBeanException((RuntimeException) t);
else if (t instanceof Error)
throw new RuntimeErrorException((Error) t);
else
throw new RuntimeMBeanException(new RuntimeException("Unhandled exception", t));
}
}
代码示例来源:origin: io.snappydata/gemfire-core
@Override
public void setAlertLevelAsString(String level) {
String newLevel = level != null ? level.trim() : null;
try {
super.setAlertLevelAsString(newLevel);
} catch (IllegalArgumentException e) {
throw new RuntimeMBeanException(e, e.getMessage());
}
}
代码示例来源:origin: org.apache.geode/gemfire-core
public void setAlertLevelAsString(String level) {
String newLevel = level != null ? level.trim() : null;
try {
super.setAlertLevelAsString(newLevel);
} catch (IllegalArgumentException e) {
throw new RuntimeMBeanException(e, e.getMessage());
}
}
代码示例来源:origin: org.jboss.jbossas/jboss-as-mbeans
protected void addNotificationListenerToResource(NotificationListener listener, NotificationFilter filter, Object handback)
{
if (resource instanceof NotificationBroadcaster)
{
((NotificationBroadcaster) resource).addNotificationListener(listener, filter, handback);
}
else
{
throw new RuntimeMBeanException(new IllegalArgumentException("Target XXX is not a notification broadcaster"
// FIXME: add the XXX object name, store from registration
));
}
}
代码示例来源:origin: org.jboss.mx/jboss-mbeans
protected void addNotificationListenerToResource(NotificationListener listener, NotificationFilter filter, Object handback)
{
if (resource instanceof NotificationBroadcaster)
{
((NotificationBroadcaster) resource).addNotificationListener(listener, filter, handback);
}
else
{
throw new RuntimeMBeanException(new IllegalArgumentException("Target XXX is not a notification broadcaster"
// FIXME: add the XXX object name, store from registration
));
}
}
代码示例来源:origin: org.jboss.jbossas/jboss-as-mbeans
protected void removeNotificationListenerFromResource(NotificationListener listener)
throws ListenerNotFoundException
{
if (resource instanceof NotificationBroadcaster)
{
((NotificationBroadcaster) resource).removeNotificationListener(listener);
}
else
{
throw new RuntimeMBeanException(new IllegalArgumentException("Target XXX is not a notification broadcaster"
// FIXME: add the XXX object name, store from registration
));
}
}
代码示例来源:origin: org.jboss.mx/jboss-mbeans
protected void removeNotificationListenerFromResource(NotificationListener listener)
throws ListenerNotFoundException
{
if (resource instanceof NotificationBroadcaster)
{
((NotificationBroadcaster) resource).removeNotificationListener(listener);
}
else
{
throw new RuntimeMBeanException(new IllegalArgumentException("Target XXX is not a notification broadcaster"
// FIXME: add the XXX object name, store from registration
));
}
}
代码示例来源:origin: org.jboss.mx/jboss-mbeans
private void rethrowAsMBeanException(Throwable t) throws MBeanException
{
if (t instanceof RuntimeException)
throw new RuntimeMBeanException((RuntimeException) t);
else if (t instanceof Error)
throw new RuntimeErrorException((Error) t);
else
throw new MBeanException((Exception) t);
}
代码示例来源:origin: org.jboss.jbossas/jboss-as-mbeans
private void rethrowAsMBeanException(Throwable t) throws MBeanException
{
if (t instanceof RuntimeException)
throw new RuntimeMBeanException((RuntimeException) t);
else if (t instanceof Error)
throw new RuntimeErrorException((Error) t);
else
throw new MBeanException((Exception) t);
}
代码示例来源:origin: org.jboss.jbossas/jboss-as-mbeans
protected void removeNotificationListenerFromResource(NotificationListener listener,
NotificationFilter filter,
Object handback)
throws ListenerNotFoundException
{
if (resource instanceof NotificationEmitter)
{
((NotificationEmitter) resource).removeNotificationListener(listener, filter, handback);
}
else if (resource instanceof NotificationBroadcaster)
{
//JGH NOTE: looks like a listener against the MBeanServer is
//wrapped as a XMBean which has a broadcaster that is an NotificationEmitter
//but this resource target is a NotificationBroadcaster, in which case,
//w/o this .. you'll get a resource failure below
removeNotificationListener(listener);
}
else
{
throw new RuntimeMBeanException(new IllegalArgumentException("Target XXX is not a notification emitter"
// FIXME: add the XXX object name, store from registration
));
}
}
代码示例来源:origin: org.jboss.mx/jboss-mbeans
protected void removeNotificationListenerFromResource(NotificationListener listener,
NotificationFilter filter,
Object handback)
throws ListenerNotFoundException
{
if (resource instanceof NotificationEmitter)
{
((NotificationEmitter) resource).removeNotificationListener(listener, filter, handback);
}
else if (resource instanceof NotificationBroadcaster)
{
//JGH NOTE: looks like a listener against the MBeanServer is
//wrapped as a XMBean which has a broadcaster that is an NotificationEmitter
//but this resource target is a NotificationBroadcaster, in which case,
//w/o this .. you'll get a resource failure below
removeNotificationListener(listener);
}
else
{
throw new RuntimeMBeanException(new IllegalArgumentException("Target XXX is not a notification emitter"
// FIXME: add the XXX object name, store from registration
));
}
}
代码示例来源:origin: apache/felix
protected Object invokeImpl(MBeanMetaData metadata, String method, String[] signature, Object[] args) throws ReflectionException, MBeanException, IllegalArgumentException
{
Method m = getStandardManagementMethod(metadata, method, signature);
try
{
return m.invoke(metadata.mbean, args);
}
catch (IllegalAccessException x)
{
throw new ReflectionException(x);
}
catch (InvocationTargetException x)
{
Throwable t = x.getTargetException();
if (t instanceof Error) throw new RuntimeErrorException((Error)t);
if (t instanceof JMRuntimeException) throw (JMRuntimeException)t;
if (t instanceof RuntimeException) throw new RuntimeMBeanException((RuntimeException)t);
throw new MBeanException((Exception)t);
}
}
代码示例来源:origin: apache/felix
public Object getAttribute(MBeanMetaData metadata, String attribute) throws MBeanException, AttributeNotFoundException, ReflectionException
{
if (metadata.dynamic)
{
try
{
return ((DynamicMBean)metadata.mbean).getAttribute(attribute);
}
catch (JMRuntimeException x)
{
throw x;
}
catch (RuntimeException x)
{
throw new RuntimeMBeanException(x);
}
catch (Error x)
{
throw new RuntimeErrorException(x);
}
}
else
{
return metadata.invoker.getAttribute(metadata, attribute);
}
}
代码示例来源:origin: org.jboss.jbossas/jboss-as-mbeans
protected void handleInvocationExceptions(Throwable t) throws Throwable
{
// the invoked method threw an exception
if (t instanceof InvocationTargetException)
{
t = ((InvocationTargetException) t).getTargetException();
if (t instanceof RuntimeOperationsException)
throw (RuntimeOperationsException) t;
else if (t instanceof RuntimeException)
throw new RuntimeMBeanException((RuntimeException) t);
else if (t instanceof Error)
throw new RuntimeErrorException((Error) t);
else if (t instanceof Exception)
throw new MBeanException((Exception) t);
else
throw t;
}
else if (t instanceof Exception)
throw new ReflectionException((Exception) t);
else if (t instanceof Error)
throw new RuntimeErrorException((Error) t);
else
throw t;
}
代码示例来源:origin: apache/felix
public void setAttribute(MBeanMetaData metadata, Attribute attribute) throws MBeanException, AttributeNotFoundException, InvalidAttributeValueException, ReflectionException
{
if (metadata.dynamic)
{
try
{
((DynamicMBean)metadata.mbean).setAttribute(attribute);
}
catch (JMRuntimeException x)
{
throw x;
}
catch (RuntimeException x)
{
throw new RuntimeMBeanException(x);
}
catch (Error x)
{
throw new RuntimeErrorException(x);
}
}
else
{
metadata.invoker.setAttribute(metadata, attribute);
}
}
代码示例来源:origin: org.jboss.mx/jboss-mbeans
protected void handleInvocationExceptions(Throwable t) throws Throwable
{
// the invoked method threw an exception
if (t instanceof InvocationTargetException)
{
t = ((InvocationTargetException) t).getTargetException();
if (t instanceof RuntimeOperationsException)
throw (RuntimeOperationsException) t;
else if (t instanceof RuntimeException)
throw new RuntimeMBeanException((RuntimeException) t);
else if (t instanceof Error)
throw new RuntimeErrorException((Error) t);
else if (t instanceof Exception)
throw new MBeanException((Exception) t);
else
throw t;
}
else if (t instanceof Exception)
throw new ReflectionException((Exception) t);
else if (t instanceof Error)
throw new RuntimeErrorException((Error) t);
else
throw t;
}
代码示例来源:origin: apache/felix
public MBeanInfo getMBeanInfo(MBeanMetaData metadata)
{
if (metadata.dynamic)
{
// From JMX 1.1 the MBeanInfo may be dynamically changed at every time, let's refresh it
MBeanInfo info = null;
try {
info = ((DynamicMBean)metadata.mbean).getMBeanInfo();
} catch (RuntimeException x) {
throw new RuntimeMBeanException(x);
}
if (info == null) return null;
metadata.info = info;
// Refresh also ObjectInstance.getClassName(), if it's the case
String className = info.getClassName();
if (!metadata.instance.getClassName().equals(className))
{
metadata.instance = new ObjectInstance(metadata.name, className);
}
}
return (MBeanInfo)metadata.info.clone();
}
内容来源于网络,如有侵权,请联系作者删除!