当前位置: 首页>>代码示例>>Java>>正文


Java AttributeNotFoundException类代码示例

本文整理汇总了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);
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:17,代码来源:PerInterface.java

示例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);
    }
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:27,代码来源:RMIConnector.java

示例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);
    }
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:27,代码来源:RMIConnector.java

示例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();
}
 
开发者ID:naver,项目名称:hadoop,代码行数:26,代码来源:JMXGet.java

示例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());
}
 
开发者ID:naver,项目名称:hadoop,代码行数:18,代码来源:TestSecondaryWebUi.java

示例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);
}
 
开发者ID:lambdalab-mirror,项目名称:jdk8u-jdk,代码行数:19,代码来源:PerInterface.java

示例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);
    }
}
 
开发者ID:lambdalab-mirror,项目名称:jdk8u-jdk,代码行数:27,代码来源:RMIConnector.java

示例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);
}
 
开发者ID:lambdalab-mirror,项目名称:jdk8u-jdk,代码行数:18,代码来源:RMIConnectorLogAttributesTest.java

示例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);
    }

}
 
开发者ID:hashsdn,项目名称:hashsdn-controller,代码行数:27,代码来源:DynamicWritableWrapper.java

示例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;
}
 
开发者ID:hashsdn,项目名称:hashsdn-controller,代码行数:18,代码来源:DynamicWritableWrapper.java

示例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);
    }
}
 
开发者ID:kefik,项目名称:Pogamut3,代码行数:8,代码来源:DynamicProxy.java

示例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);
    }
}
 
开发者ID:kefik,项目名称:Pogamut3,代码行数:8,代码来源:DynamicProxy.java

示例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);
    }
}
 
开发者ID:kefik,项目名称:Pogamut3,代码行数:9,代码来源:FolderMBean.java

示例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);
    }
}
 
开发者ID:kefik,项目名称:Pogamut3,代码行数:9,代码来源:FolderMBean.java

示例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");
	}
}
 
开发者ID:mevdschee,项目名称:tqdev-metrics,代码行数:10,代码来源:JmxReporter.java


注:本文中的javax.management.AttributeNotFoundException类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。