本文整理汇总了Java中javax.management.AttributeNotFoundException类的典型用法代码示例。如果您正苦于以下问题:Java AttributeNotFoundException类的具体用法?Java AttributeNotFoundException怎么用?Java AttributeNotFoundException使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
AttributeNotFoundException类属于javax.management包,在下文中一共展示了AttributeNotFoundException类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getAttribute
import javax.management.AttributeNotFoundException; //导入依赖的package包/类
Object getAttribute(Object resource, String attribute, Object cookie)
throws AttributeNotFoundException,
MBeanException,
ReflectionException {
final M cm = getters.get(attribute);
if (cm == null) {
final String msg;
if (setters.containsKey(attribute))
msg = "Write-only attribute: " + attribute;
else
msg = "No such attribute: " + attribute;
throw new AttributeNotFoundException(msg);
}
return introspector.invokeM(cm, resource, (Object[]) null, cookie);
}
示例2: getAttribute
import javax.management.AttributeNotFoundException; //导入依赖的package包/类
public Object getAttribute(ObjectName name,
String attribute)
throws MBeanException,
AttributeNotFoundException,
InstanceNotFoundException,
ReflectionException,
IOException {
if (logger.debugOn()) logger.debug("getAttribute",
"name=" + name + ", attribute="
+ attribute);
final ClassLoader old = pushDefaultClassLoader();
try {
return connection.getAttribute(name,
attribute,
delegationSubject);
} catch (IOException ioe) {
communicatorAdmin.gotIOException(ioe);
return connection.getAttribute(name,
attribute,
delegationSubject);
} finally {
popDefaultClassLoader(old);
}
}
示例3: setAttribute
import javax.management.AttributeNotFoundException; //导入依赖的package包/类
public void setAttribute(ObjectName name,
Attribute attribute)
throws InstanceNotFoundException,
AttributeNotFoundException,
InvalidAttributeValueException,
MBeanException,
ReflectionException,
IOException {
if (logger.debugOn()) logger.debug("setAttribute",
"name=" + name + ", attribute="
+ attribute);
final MarshalledObject<Attribute> sAttribute =
new MarshalledObject<Attribute>(attribute);
final ClassLoader old = pushDefaultClassLoader();
try {
connection.setAttribute(name, sAttribute, delegationSubject);
} catch (IOException ioe) {
communicatorAdmin.gotIOException(ioe);
connection.setAttribute(name, sAttribute, delegationSubject);
} finally {
popDefaultClassLoader(old);
}
}
示例4: getValue
import javax.management.AttributeNotFoundException; //导入依赖的package包/类
/**
* get single value by key
*/
public String getValue(String key) throws Exception {
Object val = null;
for (ObjectName oname : hadoopObjectNames) {
try {
val = mbsc.getAttribute(oname, key);
} catch (AttributeNotFoundException anfe) {
/* just go to the next */
continue;
} catch (ReflectionException re) {
if (re.getCause() instanceof NoSuchMethodException) {
continue;
}
}
err("Info: key = " + key + "; val = " +
(val == null ? "null" : val.getClass()) + ":" + val);
break;
}
return (val == null) ? "" : val.toString();
}
示例5: testSecondaryWebUi
import javax.management.AttributeNotFoundException; //导入依赖的package包/类
@Test
public void testSecondaryWebUi()
throws IOException, MalformedObjectNameException,
AttributeNotFoundException, MBeanException,
ReflectionException, InstanceNotFoundException {
MBeanServer mbs = ManagementFactory.getPlatformMBeanServer();
ObjectName mxbeanName = new ObjectName(
"Hadoop:service=SecondaryNameNode,name=SecondaryNameNodeInfo");
String[] checkpointDir = (String[]) mbs.getAttribute(mxbeanName,
"CheckpointDirectories");
Assert.assertArrayEquals(checkpointDir, snn.getCheckpointDirectories());
String[] checkpointEditlogDir = (String[]) mbs.getAttribute(mxbeanName,
"CheckpointEditlogDirectories");
Assert.assertArrayEquals(checkpointEditlogDir,
snn.getCheckpointEditlogDirectories());
}
示例6: setAttribute
import javax.management.AttributeNotFoundException; //导入依赖的package包/类
void setAttribute(Object resource, String attribute, Object value,
Object cookie)
throws AttributeNotFoundException,
InvalidAttributeValueException,
MBeanException,
ReflectionException {
final M cm = setters.get(attribute);
if (cm == null) {
final String msg;
if (getters.containsKey(attribute))
msg = "Read-only attribute: " + attribute;
else
msg = "No such attribute: " + attribute;
throw new AttributeNotFoundException(msg);
}
introspector.invokeSetter(attribute, cm, resource, value, cookie);
}
示例7: setAttribute
import javax.management.AttributeNotFoundException; //导入依赖的package包/类
public void setAttribute(ObjectName name,
Attribute attribute)
throws InstanceNotFoundException,
AttributeNotFoundException,
InvalidAttributeValueException,
MBeanException,
ReflectionException,
IOException {
if (logger.debugOn()) logger.debug("setAttribute",
"name=" + name + ", attribute name="
+ attribute.getName());
final MarshalledObject<Attribute> sAttribute =
new MarshalledObject<Attribute>(attribute);
final ClassLoader old = pushDefaultClassLoader();
try {
connection.setAttribute(name, sAttribute, delegationSubject);
} catch (IOException ioe) {
communicatorAdmin.gotIOException(ioe);
connection.setAttribute(name, sAttribute, delegationSubject);
} finally {
popDefaultClassLoader(old);
}
}
示例8: doTest
import javax.management.AttributeNotFoundException; //导入依赖的package包/类
private void doTest(JMXConnector connector) throws IOException,
MalformedObjectNameException, ReflectionException,
InstanceAlreadyExistsException, MBeanRegistrationException,
MBeanException, NotCompliantMBeanException, InstanceNotFoundException, AttributeNotFoundException, InvalidAttributeValueException {
MBeanServerConnection mbsc = connector.getMBeanServerConnection();
ObjectName objName = new ObjectName("com.redhat.test.jmx:type=NameMBean");
System.out.println("DEBUG: Calling createMBean");
mbsc.createMBean(Name.class.getName(), objName);
System.out.println("DEBUG: Calling setAttributes");
AttributeList attList = new AttributeList();
attList.add(new Attribute("FirstName", ANY_NAME));
attList.add(new Attribute("LastName", ANY_NAME));
mbsc.setAttributes(objName, attList);
}
示例9: setAttribute
import javax.management.AttributeNotFoundException; //导入依赖的package包/类
@Override
public synchronized void setAttribute(final Attribute attribute)
throws AttributeNotFoundException, InvalidAttributeValueException, MBeanException, ReflectionException {
Attribute newAttribute = attribute;
if (configBeanModificationDisabled.get()) {
throw new IllegalStateException("Operation is not allowed now");
}
if ("Attribute".equals(newAttribute.getName())) {
setAttribute((Attribute) newAttribute.getValue());
return;
}
try {
if (newAttribute.getValue() instanceof ObjectName) {
newAttribute = fixDependencyAttribute(newAttribute);
} else if (newAttribute.getValue() instanceof ObjectName[]) {
newAttribute = fixDependencyListAttribute(newAttribute);
}
internalServer.setAttribute(objectNameInternal, newAttribute);
} catch (final InstanceNotFoundException e) {
throw new MBeanException(e);
}
}
示例10: setAttributes
import javax.management.AttributeNotFoundException; //导入依赖的package包/类
@Override
public AttributeList setAttributes(final AttributeList attributes) {
AttributeList result = new AttributeList();
for (Object attributeObject : attributes) {
Attribute attribute = (Attribute) attributeObject;
try {
setAttribute(attribute);
result.add(attribute);
} catch (final InvalidAttributeValueException | AttributeNotFoundException | MBeanException
| ReflectionException e) {
LOG.warn("Setting attribute {} failed on {}", attribute.getName(), moduleIdentifier, e);
throw new IllegalArgumentException(
"Setting attribute failed - " + attribute.getName() + " on " + moduleIdentifier, e);
}
}
return result;
}
示例11: getAttribute
import javax.management.AttributeNotFoundException; //导入依赖的package包/类
public Object getAttribute(String attribute) throws AttributeNotFoundException, MBeanException, ReflectionException {
try {
return mbsc.getAttribute(objectName, attribute);
} catch (Exception ex) {
throw new MBeanException(ex);
}
}
示例12: setAttribute
import javax.management.AttributeNotFoundException; //导入依赖的package包/类
public void setAttribute(Attribute attribute) throws AttributeNotFoundException, InvalidAttributeValueException, MBeanException, ReflectionException {
try {
mbsc.setAttribute(objectName, attribute);
} catch (Exception ex) {
throw new MBeanException(ex);
}
}
示例13: getAttribute
import javax.management.AttributeNotFoundException; //导入依赖的package包/类
@Override
public Object getAttribute(String attribute) throws AttributeNotFoundException, MBeanException, ReflectionException {
try {
return folder.getProperty(attribute).getValue();
} catch (IntrospectionException ex) {
throw new MBeanException(ex);
}
}
示例14: setAttribute
import javax.management.AttributeNotFoundException; //导入依赖的package包/类
@Override
public void setAttribute(Attribute attribute) throws AttributeNotFoundException, InvalidAttributeValueException, MBeanException, ReflectionException {
try {
folder.getProperty(attribute.getName()).setValue(attribute.getValue());
} catch (IntrospectionException ex) {
throw new MBeanException(ex);
}
}
示例15: setAttribute
import javax.management.AttributeNotFoundException; //导入依赖的package包/类
@Override
public void setAttribute(Attribute attribute)
throws AttributeNotFoundException, InvalidAttributeValueException, MBeanException, ReflectionException {
if (attribute.getName().equals("enabled")) {
registry.setEnabled((boolean) attribute.getValue());
} else {
throw new AttributeNotFoundException("No writable attribute has been found");
}
}