private Exception decode(Exception e) { Throwable t = JMXExceptionDecoder.decode(e); if(t instanceof Exception) return (Exception) t; throw (Error) t; }
/** * Decode and rethrow the given Throwable. If it * is a container JMX exception, then the target * is thrown. Otherwise the argument is thrown. */ public static void rethrow(final Exception e) throws Exception { Throwable t = decode(e); if (t instanceof Exception) throw (Exception) t; else throw (Error) t; } }
/** * Go through the myriad of nested JMX exception to pull out the true * exception if possible and log it. * * @param e The exception to be logged. */ private void logException(Throwable e) { Throwable t = org.jboss.mx.util.JMXExceptionDecoder.decode(e); log.error("operation failed", t); }
/** Unwrap a possibly nested jmx exception down to the last * JMException || JMRuntimeException. * * @param ex the exception to unwrap * @return A JMException || JMRuntimeException if ex was of this type, or * ex if it was not. */ public static Throwable decodeToJMXException(final Throwable ex) { Throwable jmxEx = ex; Throwable lastJmxEx = ex; while( jmxEx instanceof JMException || jmxEx instanceof JMRuntimeException) { lastJmxEx = jmxEx; jmxEx = decode(jmxEx); if( jmxEx == lastJmxEx ) break; } return lastJmxEx; }
/** * Deactivate */ protected void deactivate() { Object[] params = new Object[] { this, activationSpec }; try { server.invoke(resourceAdapterObjectName, "endpointDeactivation", params, activationSig); } catch (Throwable t) { t = JMXExceptionDecoder.decode(t); log.warn("Endpoint activation failed ra=" + resourceAdapterObjectName + " activationSpec=" + activationSpec, t); } } }
/** * The <code>shutdownServices</code> method calls the one and only * ServiceController to shut down all the mbeans registered with it. */ protected void shutdownServices() { try { // get the deployed objects from ServiceController controller.shutdown(); } catch (Exception e) { Throwable t = JMXExceptionDecoder.decode(e); log.error("Failed to shutdown services", t); } }
throw new RuntimeException("Could not get mbeanInfo", JMXExceptionDecoder.decode(e));
throw new RuntimeException("Could not get mbeanInfo", JMXExceptionDecoder.decode(e));
throw new RuntimeException("Could not get mbeanInfo", JMXExceptionDecoder.decode(e));
public Object invoke(Object proxy, Method method, Object[] args) throws Throwable { try { return getAction(proxy, method).perform(args); } catch (Throwable t) { throw JMXExceptionDecoder.decode(t); } }
public Object invoke(Object proxy, Method method, Object[] args) throws Throwable { try { return getAction(proxy, method).perform(args); } catch (Throwable t) { throw JMXExceptionDecoder.decode(t); } }
private BaseConnectionManager2 getCM() throws ResourceException { if (realCm == null) { try { MBeanServer server = MBeanServerLocator.locateJBoss(); realCm = (BaseConnectionManager2) server.getAttribute(cmName, "Instance"); } catch (Throwable t) { Throwable t2 = JMXExceptionDecoder.decode(t); JBossResourceException.rethrowAsResourceException("Problem locating real ConnectionManager: " + cmName, t2); } } return realCm; } }
/** * Activate * * @throws DeploymentException for any error */ protected void activate() throws DeploymentException { if (deliveryActive.get() == false) { log.info("Delivery is disabled: " + getServiceName()); return; } Object[] params = new Object[] { this, activationSpec }; try { server.invoke(resourceAdapterObjectName, "endpointActivation", params, activationSig); } catch (Throwable t) { t = JMXExceptionDecoder.decode(t); DeploymentException.rethrowAsDeploymentException("Endpoint activation failed ra=" + resourceAdapterObjectName + " activationSpec=" + activationSpec, t); } }
/** * Create the activation spec * * @throws DeploymentException for any error */ protected void createActivationSpec() throws DeploymentException { properties = new HashMap(metaData.getActivationConfigProperties()); augmentActivationConfigProperties(); Object[] params = new Object[] { messagingTypeClass, properties.values() }; try { activationSpec = (ActivationSpec) server.invoke(resourceAdapterObjectName, "createActivationSpec", params, createActivationSpecSig); } catch (Throwable t) { t = JMXExceptionDecoder.decode(t); DeploymentException.rethrowAsDeploymentException("Unable to create activation spec ra=" + resourceAdapterObjectName + " messaging-type=" + messagingTypeClass.getName() + " properties=" + metaData.getActivationConfigProperties(), t); } }
e = (Exception) JMXExceptionDecoder.decode(e);
Throwable th = JMXExceptionDecoder.decode(e); if(log.isTraceEnabled())
/** * Invoke a method. */ public Object invoke(Invocation invocation) throws Exception { ClassLoader oldCl = TCLAction.UTIL.getContextClassLoader(); ObjectName mbean = (ObjectName) Registry.lookup((Integer) invocation.getObjectName()); try { Object[] args = {invocation}; Object rtnValue = serverAction.invoke(mbean, "invoke", args, Invocation.INVOKE_SIGNATURE); return rtnValue; } catch (Exception e) { e = (Exception) JMXExceptionDecoder.decode(e); if (log.isTraceEnabled()) log.trace("Failed to invoke on mbean: " + mbean, e); throw e; } finally { TCLAction.UTIL.setContextClassLoader(oldCl); } }