javax.management.RuntimeMBeanException类的使用及代码示例

x33g5p2x  于2022-01-28 转载在 其他  
字(6.6k)|赞(0)|评价(0)|浏览(105)

本文整理了Java中javax.management.RuntimeMBeanException类的一些代码示例,展示了RuntimeMBeanException类的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。RuntimeMBeanException类的具体详情如下:
包路径:javax.management.RuntimeMBeanException
类名称:RuntimeMBeanException

RuntimeMBeanException介绍

暂无

代码示例

代码示例来源:origin: spring-projects/spring-framework

throw ex.getTargetException();
  throw ((RuntimeMBeanException) rex).getTargetException();

代码示例来源:origin: neo4j/neo4j

private Map<String,Object> toNeo4jValue( ObjectName name, MBeanAttributeInfo attribute )
    throws JMException
{
  Object value;
  try
  {
    value = toNeo4jValue( jmxServer.getAttribute( name, attribute.getName() ) );
  }
  catch ( RuntimeMBeanException e )
  {
    if ( e.getCause() != null && e.getCause() instanceof UnsupportedOperationException )
    {
      // We include the name and description of this attribute still - but the value of it is
      // unknown. We do this rather than rethrow the exception, because several MBeans built into
      // the JVM will throw exception on attribute access depending on their runtime state, even
      // if the attribute is marked as readable. Notably the GC beans do this.
      value = null;
    }
    else
    {
      throw e;
    }
  }
  return map(
    "description", attribute.getDescription(),
    "value", value
  );
}

代码示例来源: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: org.jboss.jbossas/jboss-as-mbeans

throw new MBeanException(e.getTargetException(), e.getMessage());

代码示例来源:origin: org.wso2.carbon.analytics/org.wso2.carbon.analytics.jmx.agent

" from the UI list due to: " + e.getMessage());
} catch (ReflectionException e) {
  log.error("Removed the attribute " + info.getName() + " of " + mBean +

代码示例来源:origin: org.jboss.mx/jboss-mbeans

throw new MBeanException(e.getTargetException(), e.getMessage());

代码示例来源:origin: org.springframework/spring-context

throw ex.getTargetException();
  throw ((RuntimeMBeanException) rex).getTargetException();

代码示例来源:origin: apache/hive

if (e.getCause() instanceof UnsupportedOperationException) {
 LOG.debug("getting attribute "+attName+" of "+oname+" is unsupported");
} else {

代码示例来源: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: rhuss/jolokia

@SuppressWarnings({ "PMD.AvoidCatchingThrowable", "PMD.AvoidInstanceofChecksInCatchClause" })
private void handle(ServletRequestHandler pReqHandler,HttpServletRequest pReq, HttpServletResponse pResp) throws IOException {
  JSONAware json = null;
  try {
    // Check access policy
    requestHandler.checkAccess(allowDnsReverseLookup ? pReq.getRemoteHost() : null,
                  pReq.getRemoteAddr(),
                  getOriginOrReferer(pReq));
    // If a callback is given, check this is a valid javascript function name
    validateCallbackIfGiven(pReq);
    // Remember the agent URL upon the first request. Needed for discovery
    updateAgentDetailsIfNeeded(pReq);
    // Dispatch for the proper HTTP request method
    json = handleSecurely(pReqHandler, pReq, pResp);
  } catch (Throwable exp) {
    try {
      json = requestHandler.handleThrowable(
        exp instanceof RuntimeMBeanException ? ((RuntimeMBeanException) exp).getTargetException() : exp);
    } catch (Throwable exp2) {
      exp2.printStackTrace();
    }
  } finally {
    setCorsHeader(pReq, pResp);
    if (json == null) {
      json = requestHandler.handleThrowable(new Exception("Internal error while handling an exception"));
    }
    sendResponse(pResp, pReq, json);
  }
}

代码示例来源:origin: apache/hbase

if (e.getCause() instanceof UnsupportedOperationException) {
 if (LOG.isTraceEnabled()) {
  LOG.trace("Getting attribute " + attName + " of " + oname + " threw " + e);

代码示例来源: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: rhuss/jolokia

exp instanceof RuntimeMBeanException ? ((RuntimeMBeanException) exp).getTargetException() : exp);
} finally {
  sendResponse(pExchange, parsedUri, json);

代码示例来源:origin: org.apache.hadoop/hadoop-common

if (e.getCause() instanceof UnsupportedOperationException) {
 LOG.debug("getting attribute "+attName+" of "+oname+" threw an exception", e);
} else {

代码示例来源: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: org.jboss.seam/jboss-seam

public Object handleRuntimeMBeanException(ProxyContext ctx,
                     RuntimeMBeanException e,
                     Method m, Object[] args)
                     throws Exception
{
 // target is always a runtime exception, so its ok to throw it from here
 throw e.getTargetException();
}

代码示例来源:origin: apache/hbase

if (e.getCause() instanceof UnsupportedOperationException) {
 if (LOG.isTraceEnabled()) {
  LOG.trace("Getting attribute " + prs + " of " + oname + " threw " + e);

代码示例来源: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.jboss.jbossas/jboss-as-j2se

public Object handleRuntimeMBeanException(ProxyContext ctx,
                     RuntimeMBeanException e,
                     Method m, Object[] args)
                     throws Exception
{
 // target is always a runtime exception, so its ok to throw it from here
 throw e.getTargetException();
}

代码示例来源:origin: aragozin/jvm-tools

if (!(e.getCause() instanceof UnsupportedOperationException)) {
  error("getting attribute " + attName + " of " + oname + " threw " +
      "an exception", e);

相关文章