Comparable<?> getComparableFromAttribute(ObjectName object,
String attribute,
Object value)
throws AttributeNotFoundException {
if (isComplexTypeAttribute) {
Object v = value;
for (String attr : remainingAttributes)
v = Introspector.elementFromComplex(v, attr);
return (Comparable<?>) v;
} else {
return (Comparable<?>) value;
}
}
java类javax.management.AttributeNotFoundException的实例源码
Monitor.java 文件源码
项目:OpenJSharp
阅读 33
收藏 0
点赞 0
评论 0
OldMBeanServerTest.java 文件源码
项目:openjdk-jdk10
阅读 21
收藏 0
点赞 0
评论 0
public Object getAttribute(String attribute)
throws AttributeNotFoundException, MBeanException, ReflectionException {
AttrMethods am = attrMap.get(attribute);
if (am == null || am.getter == null)
throw new AttributeNotFoundException(attribute);
return invokeMethod(am.getter);
}
JmxReporterTest.java 文件源码
项目:tqdev-metrics
阅读 24
收藏 0
点赞 0
评论 0
/**
* Should throw exception on unknown key.
*
* @throws MBeanException
* the MBean exception
* @throws AttributeNotFoundException
* the attribute not found exception
* @throws ReflectionException
* the reflection exception
*/
@Test
public void shouldThrowExceptionOnUnknownKey()
throws MBeanException, AttributeNotFoundException, ReflectionException {
registry.increment("jdbc.Statement.Invocations", "update");
try {
readJmx("jdbc.Statement.Invocations", "select");
Assert.fail("readJmx should have thrown an InvalidKeyException");
} catch (Exception e) {
assertThat(e.getClass().getSimpleName()).isEqualTo("InvalidKeyException");
}
}
MBeanServerWrapper.java 文件源码
项目:monarch
阅读 25
收藏 0
点赞 0
评论 0
@Override
public void setAttribute(ObjectName name, Attribute attribute)
throws InstanceNotFoundException, AttributeNotFoundException, InvalidAttributeValueException,
MBeanException, ReflectionException {
ResourcePermission ctx = getOperationContext(name, attribute.getName(), false);
this.securityService.authorize(ctx);
mbs.setAttribute(name, attribute);
}
MetricsSourceAdapter.java 文件源码
项目:hadoop
阅读 29
收藏 0
点赞 0
评论 0
@Override
public Object getAttribute(String attribute)
throws AttributeNotFoundException, MBeanException, ReflectionException {
updateJmxCache();
synchronized(this) {
Attribute a = attrCache.get(attribute);
if (a == null) {
throw new AttributeNotFoundException(attribute +" not found");
}
if (LOG.isDebugEnabled()) {
LOG.debug(attribute +": "+ a);
}
return a.getValue();
}
}
DefaultMBeanServerInterceptor.java 文件源码
项目:jdk8u-jdk
阅读 28
收藏 0
点赞 0
评论 0
public Object getAttribute(ObjectName name, String attribute)
throws MBeanException, AttributeNotFoundException,
InstanceNotFoundException, ReflectionException {
if (name == null) {
throw new RuntimeOperationsException(new
IllegalArgumentException("Object name cannot be null"),
"Exception occurred trying to invoke the getter on the MBean");
}
if (attribute == null) {
throw new RuntimeOperationsException(new
IllegalArgumentException("Attribute cannot be null"),
"Exception occurred trying to invoke the getter on the MBean");
}
name = nonDefaultDomain(name);
if (MBEANSERVER_LOGGER.isLoggable(Level.FINER)) {
MBEANSERVER_LOGGER.logp(Level.FINER,
DefaultMBeanServerInterceptor.class.getName(),
"getAttribute",
"Attribute = " + attribute + ", ObjectName = " + name);
}
final DynamicMBean instance = getMBean(name);
checkMBeanPermission(instance, attribute, name, "getAttribute");
try {
return instance.getAttribute(attribute);
} catch (AttributeNotFoundException e) {
throw e;
} catch (Throwable t) {
rethrowMaybeMBeanException(t);
throw new AssertionError(); // not reached
}
}
MBeanServerDelegateImpl.java 文件源码
项目:jdk8u-jdk
阅读 26
收藏 0
点赞 0
评论 0
/**
* This method always fail since all MBeanServerDelegateMBean attributes
* are read-only.
*
* @param attribute The identification of the attribute to
* be set and the value it is to be set to.
*
* @exception AttributeNotFoundException
*/
public void setAttribute(Attribute attribute)
throws AttributeNotFoundException, InvalidAttributeValueException,
MBeanException, ReflectionException {
// Now we will always fail:
// Either because the attribute is null or because it is not
// accessible (or does not exist).
//
final String attname = (attribute==null?null:attribute.getName());
if (attname == null) {
final RuntimeException r =
new IllegalArgumentException("Attribute name cannot be null");
throw new RuntimeOperationsException(r,
"Exception occurred trying to invoke the setter on the MBean");
}
// This is a hack: we call getAttribute in order to generate an
// AttributeNotFoundException if the attribute does not exist.
//
Object val = getAttribute(attname);
// If we reach this point, we know that the requested attribute
// exists. However, since all attributes are read-only, we throw
// an AttributeNotFoundException.
//
throw new AttributeNotFoundException(attname + " not accessible");
}
MBeanSupport.java 文件源码
项目:jdk8u-jdk
阅读 24
收藏 0
点赞 0
评论 0
public final void setAttribute(Attribute attribute)
throws AttributeNotFoundException,
InvalidAttributeValueException,
MBeanException,
ReflectionException {
final String name = attribute.getName();
final Object value = attribute.getValue();
perInterface.setAttribute(resource, name, value, getCookie());
}
MBeanServerAccessController.java 文件源码
项目:jdk8u-jdk
阅读 38
收藏 0
点赞 0
评论 0
/**
* Call <code>checkRead()</code>, then forward this method to the
* wrapped object.
*/
public Object getAttribute(ObjectName name, String attribute)
throws
MBeanException,
AttributeNotFoundException,
InstanceNotFoundException,
ReflectionException {
checkRead();
return getMBeanServer().getAttribute(name, attribute);
}
MBeanServerAccessController.java 文件源码
项目:jdk8u-jdk
阅读 26
收藏 0
点赞 0
评论 0
/**
* Call <code>checkWrite()</code>, then forward this method to the
* wrapped object.
*/
public void setAttribute(ObjectName name, Attribute attribute)
throws
InstanceNotFoundException,
AttributeNotFoundException,
InvalidAttributeValueException,
MBeanException,
ReflectionException {
checkWrite();
getMBeanServer().setAttribute(name, attribute);
}