當前位置: 首頁>>代碼示例>>Java>>正文


Java IntrospectionException類代碼示例

本文整理匯總了Java中javax.management.IntrospectionException的典型用法代碼示例。如果您正苦於以下問題:Java IntrospectionException類的具體用法?Java IntrospectionException怎麽用?Java IntrospectionException使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


IntrospectionException類屬於javax.management包,在下文中一共展示了IntrospectionException類的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: getMBeanInfo

import javax.management.IntrospectionException; //導入依賴的package包/類
public MBeanInfo getMBeanInfo(ObjectName name)
throws InstanceNotFoundException,
        IntrospectionException,
        ReflectionException,
        IOException {

    if (logger.debugOn()) logger.debug("getMBeanInfo", "name=" + name);
    final ClassLoader old = pushDefaultClassLoader();
    try {
        return connection.getMBeanInfo(name, delegationSubject);
    } catch (IOException ioe) {
        communicatorAdmin.gotIOException(ioe);

        return connection.getMBeanInfo(name, delegationSubject);
    } finally {
        popDefaultClassLoader(old);
    }
}
 
開發者ID:SunburstApps,項目名稱:OpenJSharp,代碼行數:19,代碼來源:RMIConnector.java

示例2: testInvokeChangeBufferSize

import javax.management.IntrospectionException; //導入依賴的package包/類
/**
 * Tests if buffer sizes are changeable via invoke function.
 * @throws IOException IOException
 * @throws IntrospectionException IntrospectionException
 * @throws InstanceNotFoundException InstanceNotFoundException
 * @throws ReflectionException ReflectionException
 */
@Test
public void testInvokeChangeBufferSize() throws IOException, IntrospectionException, InstanceNotFoundException, ReflectionException {
    //connect to server
    final JMXConnector connection = JmxConnectionHelper.buildJmxMPConnector(JMXSERVERIP,serverObj.getConnectorSystemPort());
    //get MBeanServerConnection
    MBeanServerConnection mbsConnection = JmxServerHelper.getMBeanServer(connection);
    //check if mbeans are registered
    Assert.assertNotSame(0,mbsConnection.getMBeanCount());
    //do actual test
    ObjectName networkManagerOn = JmxServerHelper.findObjectName(mbsConnection,"de.b4sh.byter","NetworkManager");
    //change writer buffer size
    int networkBufferSizeOLD = JmxServerHelper.getNetworkManagerNetworkBufferSize(mbsConnection,networkManagerOn);
    int writerBufferSizeOLD =  JmxServerHelper.getNetworkManagerWriterBufferSize(mbsConnection,networkManagerOn);
    JmxServerHelper.setNetworkManagerNetworkBufferSize(mbsConnection,networkManagerOn,1337);
    JmxServerHelper.setNetworkManagerWriterBufferSize(mbsConnection,networkManagerOn,1337);
    int networkBufferSize = JmxServerHelper.getNetworkManagerNetworkBufferSize(mbsConnection,networkManagerOn);
    int writerBufferSize =  JmxServerHelper.getNetworkManagerWriterBufferSize(mbsConnection,networkManagerOn);
    Assert.assertNotEquals(networkBufferSize,networkBufferSizeOLD);
    Assert.assertNotEquals(writerBufferSize,writerBufferSizeOLD);
    Assert.assertEquals(networkBufferSize,1337);
    Assert.assertEquals(writerBufferSize,1337);
}
 
開發者ID:deB4SH,項目名稱:Byter,代碼行數:30,代碼來源:JmxNetworkManagerTest.java

示例3: registerMbeans

import javax.management.IntrospectionException; //導入依賴的package包/類
private static void registerMbeans() {
    try {
        MBeanServer mbs = ManagementFactory.getPlatformMBeanServer();

        IndexingMbean indexingMbean = IndexingMbean.getInstance();
        SearchMbean searchMbean = SearchMbean.getInstance();
        GeneralMbean generalMbean = GeneralMbean.getInstance();

        JMXBeanWrapper indexingMbeanWrapper = new JMXBeanWrapper(indexingMbean);
        JMXBeanWrapper searchMbeanWrapper = new JMXBeanWrapper(searchMbean);
        JMXBeanWrapper generalMbeanWrapper = new JMXBeanWrapper(generalMbean);

        mbs.registerMBean(indexingMbeanWrapper, new ObjectName("io.logz.benchmarks.elasticsearch:type=Indexing,name=Indexing Metrics"));
        mbs.registerMBean(searchMbeanWrapper, new ObjectName("io.logz.benchmarks.elasticsearch:type=Search,name=Search Metrics"));
        mbs.registerMBean(generalMbeanWrapper, new ObjectName("io.logz.benchmarks.elasticsearch:type=General,name=General Metrics"));

    } catch (IntrospectionException | MalformedObjectNameException | NotCompliantMBeanException |
            InstanceAlreadyExistsException | MBeanRegistrationException e) {
        throw new RuntimeException("Could not initialize JMX metrics!", e);
    }
}
 
開發者ID:logzio,項目名稱:elasticsearch-benchmark-tool,代碼行數:22,代碼來源:ElasticsearchBenchmarkToolMain.java

示例4: logPluginConfig

import javax.management.IntrospectionException; //導入依賴的package包/類
protected void logPluginConfig(final String id)
{
    try
    {
        final StringBuilder nameBuff = new StringBuilder(200)
                .append("Alfresco:Type=Configuration,Category=Authentication,id1=managed,id2=").append(URLDecoder.decode(id, "UTF-8"));
        final ObjectName name = new ObjectName(nameBuff.toString());
        if (this.mbeanServer != null && this.mbeanServer.isRegistered(name))
        {
            final MBeanInfo info = this.mbeanServer.getMBeanInfo(name);
            final MBeanAttributeInfo[] attributes = info.getAttributes();
            LOGGER.debug("{} attributes:", id);
            for (final MBeanAttributeInfo attribute : attributes)
            {
                final Object value = this.mbeanServer.getAttribute(name, attribute.getName());
                LOGGER.debug("{} = {}", attribute.getName(), value);
            }
        }
    }
    catch (final MalformedObjectNameException | InstanceNotFoundException | IntrospectionException | AttributeNotFoundException
            | ReflectionException | MBeanException | IOException e)
    {
        LOGGER.warn("Exception during logging", e);
    }
}
 
開發者ID:Acosix,項目名稱:alfresco-mt-support,代碼行數:26,代碼來源:TenantAwareChainingUserRegistrySynchronizer.java

示例5: testEndpointMBeanExporterWithProperties

import javax.management.IntrospectionException; //導入依賴的package包/類
@Test
public void testEndpointMBeanExporterWithProperties() throws IntrospectionException,
		InstanceNotFoundException, MalformedObjectNameException, ReflectionException {
	MockEnvironment environment = new MockEnvironment();
	environment.setProperty("endpoints.jmx.domain", "test-domain");
	environment.setProperty("endpoints.jmx.unique_names", "true");
	environment.setProperty("endpoints.jmx.static_names", "key1=value1, key2=value2");
	this.context = new AnnotationConfigApplicationContext();
	this.context.setEnvironment(environment);
	this.context.register(JmxAutoConfiguration.class, EndpointAutoConfiguration.class,
			EndpointMBeanExportAutoConfiguration.class);
	this.context.refresh();
	this.context.getBean(EndpointMBeanExporter.class);

	MBeanExporter mbeanExporter = this.context.getBean(EndpointMBeanExporter.class);
	assertThat(mbeanExporter.getServer().getMBeanInfo(ObjectNameManager.getInstance(
			getObjectName("test-domain", "healthEndpoint", this.context).toString()
					+ ",key1=value1,key2=value2"))).isNotNull();
}
 
開發者ID:vikrammane23,項目名稱:https-github.com-g0t4-jenkins2-course-spring-boot,代碼行數:20,代碼來源:EndpointMBeanExportAutoConfigurationTests.java

示例6: testMBeanForDatasource

import javax.management.IntrospectionException; //導入依賴的package包/類
private MBeanInfo testMBeanForDatasource() throws Exception {
    Map<String, String[]> env = new HashMap<>();
    String[] credentials = { "admin", "admin" };
    env.put(JMXConnector.CREDENTIALS, credentials);
    try {
        String url = "service:jmx:rmi://localhost:12311/jndi/rmi://localhost:11199/jmxrmi";
        JMXServiceURL jmxUrl = new JMXServiceURL(url);
        JMXConnector jmxConnector = JMXConnectorFactory.connect(jmxUrl, env);
        MBeanServerConnection mBeanServer = jmxConnector.getMBeanServerConnection();
        ObjectName mbeanObject = new ObjectName(dataSourceName + ",-1234:type=DataSource");
        MBeanInfo mBeanInfo = mBeanServer.getMBeanInfo(mbeanObject);
        return mBeanInfo;
    } catch (MalformedURLException | MalformedObjectNameException | IntrospectionException |
            ReflectionException e) {
        throw new AxisFault("Error while connecting to MBean Server " + e.getMessage(), e);
    }
}
 
開發者ID:wso2,項目名稱:product-ei,代碼行數:18,代碼來源:CARBON15928JMXDisablingTest.java

示例7: checkAttributeName

import javax.management.IntrospectionException; //導入依賴的package包/類
private String checkAttributeName(ObjectName mBeanName, String attributeName) throws UnsupportedOperationException, InstanceNotFoundException, IntrospectionException, ReflectionException, IOException {
    MBeanInfo beanInfo = server.getMBeanInfo(mBeanName);
    MBeanAttributeInfo monitoredAttribute = null;
    MBeanAttributeInfo[] attributes = beanInfo.getAttributes();
    for (MBeanAttributeInfo attribute : attributes) {
        if (attribute.getName().equals(attributeName)) {
            monitoredAttribute = attribute;
            break;
        }
    }
    if (monitoredAttribute == null) {
        throw new UnsupportedOperationException("MBean [" + mBeanName +
                "] has no attribute named [" + attributeName + "]");
    }
    return monitoredAttribute.getType();
}
 
開發者ID:performancecopilot,項目名稱:parfait,代碼行數:17,代碼來源:AgentMonitoringView.java

示例8: testEndpointMBeanExporterWithProperties

import javax.management.IntrospectionException; //導入依賴的package包/類
@Test
public void testEndpointMBeanExporterWithProperties() throws IntrospectionException,
		InstanceNotFoundException, MalformedObjectNameException, ReflectionException {
	MockEnvironment environment = new MockEnvironment();
	environment.setProperty("endpoints.jmx.domain", "test-domain");
	environment.setProperty("endpoints.jmx.unique_names", "true");
	environment.setProperty("endpoints.jmx.static_names", "key1=value1, key2=value2");
	this.context = new AnnotationConfigApplicationContext();
	this.context.setEnvironment(environment);
	this.context.register(JmxAutoConfiguration.class, EndpointAutoConfiguration.class,
			EndpointMBeanExportAutoConfiguration.class);
	this.context.refresh();
	this.context.getBean(EndpointMBeanExporter.class);

	MBeanExporter mbeanExporter = this.context.getBean(EndpointMBeanExporter.class);

	assertNotNull(mbeanExporter.getServer()
			.getMBeanInfo(ObjectNameManager.getInstance(
					getObjectName("test-domain", "healthEndpoint", this.context)
							.toString() + ",key1=value1,key2=value2")));
}
 
開發者ID:Nephilim84,項目名稱:contestparser,代碼行數:22,代碼來源:EndpointMBeanExportAutoConfigurationTests.java

示例9: testEndpointMBeanExporterInParentChild

import javax.management.IntrospectionException; //導入依賴的package包/類
@Test
public void testEndpointMBeanExporterInParentChild() throws IntrospectionException,
		InstanceNotFoundException, MalformedObjectNameException, ReflectionException {
	this.context = new AnnotationConfigApplicationContext();
	this.context.register(JmxAutoConfiguration.class, EndpointAutoConfiguration.class,
			EndpointMBeanExportAutoConfiguration.class);

	AnnotationConfigApplicationContext parent = new AnnotationConfigApplicationContext();
	parent.register(JmxAutoConfiguration.class, EndpointAutoConfiguration.class,
			EndpointMBeanExportAutoConfiguration.class);
	this.context.setParent(parent);

	parent.refresh();
	this.context.refresh();

	parent.close();
}
 
開發者ID:Nephilim84,項目名稱:contestparser,代碼行數:18,代碼來源:EndpointMBeanExportAutoConfigurationTests.java

示例10: getNodeMBeanInfo

import javax.management.IntrospectionException; //導入依賴的package包/類
/**
 * Retrieves attributes of the specified mbean.
 * 
 * @param sessionId current session
 * @param nodeJmxUrl mbean server url
 * @param objectName name of mbean
 * @param attrs set of mbean attributes
 * 
 * @return mbean attributes values
 */
@Override
@GET
@GZIP
@Produces("application/json")
@Path("node/mbean")
public Object getNodeMBeanInfo(@HeaderParam("sessionid") String sessionId,
        @QueryParam("nodejmxurl") String nodeJmxUrl, @QueryParam("objectname") String objectName,
        @QueryParam("attrs") List<String> attrs)
        throws InstanceNotFoundException, IntrospectionException, ReflectionException, IOException,
        NotConnectedException, MalformedObjectNameException, NullPointerException {

    // checking that still connected to the RM
    RMProxyUserInterface rmProxy = checkAccess(sessionId);
    return rmProxy.getNodeMBeanInfo(nodeJmxUrl, objectName, attrs);
}
 
開發者ID:ow2-proactive,項目名稱:scheduling,代碼行數:26,代碼來源:RMRest.java

示例11: getNodeMBeansInfo

import javax.management.IntrospectionException; //導入依賴的package包/類
/**
 * Retrieves attributes of the specified mbeans.
 * 
 * @param sessionId current session
 * @param objectNames mbean names (@see ObjectName format)
 * @param nodeJmxUrl mbean server url
 * @param attrs set of mbean attributes
 * 
 * @return mbean attributes values
 */
@Override
@GET
@GZIP
@Produces("application/json")
@Path("node/mbeans")
public Object getNodeMBeansInfo(@HeaderParam("sessionid") String sessionId,
        @QueryParam("nodejmxurl") String nodeJmxUrl, @QueryParam("objectname") String objectNames,
        @QueryParam("attrs") List<String> attrs)
        throws InstanceNotFoundException, IntrospectionException, ReflectionException, IOException,
        NotConnectedException, MalformedObjectNameException, NullPointerException {

    // checking that still connected to the RM
    RMProxyUserInterface rmProxy = checkAccess(sessionId);
    return rmProxy.getNodeMBeansInfo(nodeJmxUrl, objectNames, attrs);
}
 
開發者ID:ow2-proactive,項目名稱:scheduling,代碼行數:26,代碼來源:RMRest.java

示例12: getMBeanInfo

import javax.management.IntrospectionException; //導入依賴的package包/類
/**
 * Returns the attributes <code>attr</code> of the mbean
 * registered as <code>name</code>.
 * @param sessionId a valid session
 * @param name mbean's object name
 * @param attrs attributes to enumerate
 * @return returns the attributes of the mbean 
 * @throws InstanceNotFoundException
 * @throws IntrospectionException
 * @throws ReflectionException
 * @throws IOException
 * @throws NotConnectedException 
 */
@Override
@GET
@GZIP
@Path("info/{name}")
@Produces("application/json")
public Object getMBeanInfo(@HeaderParam("sessionid") String sessionId, @PathParam("name") ObjectName name,
        @QueryParam("attr") List<String> attrs) throws InstanceNotFoundException, IntrospectionException,
        ReflectionException, IOException, NotConnectedException {
    RMProxyUserInterface rm = checkAccess(sessionId);

    if ((attrs == null) || (attrs.size() == 0)) {
        // no attribute is requested, we return
        // the description of the mbean
        return rm.getMBeanInfo(name);

    } else {
        return rm.getMBeanAttributes(name, attrs.toArray(new String[attrs.size()]));
    }
}
 
開發者ID:ow2-proactive,項目名稱:scheduling,代碼行數:33,代碼來源:RMRest.java

示例13: getMBeanInfo

import javax.management.IntrospectionException; //導入依賴的package包/類
/**
 * @see javax.management.MBeanServerConnection#getMBeanInfo(javax.management.ObjectName)
 */
public MBeanInfo getMBeanInfo(final ObjectName name)
        throws InstanceNotFoundException, IntrospectionException, ReflectionException, IOException {
    if (this.subject == null) {
        return this.mbs.getMBeanInfo(name);
    }
    try {
        return (MBeanInfo) Subject.doAsPrivileged(this.subject, new PrivilegedExceptionAction<MBeanInfo>() {
            public final MBeanInfo run() throws Exception {
                return mbs.getMBeanInfo(name);
            }
        }, this.context);
    } catch (final PrivilegedActionException pe) {
        final Exception e = JMXProviderUtils.extractException(pe);
        if (e instanceof InstanceNotFoundException)
            throw (InstanceNotFoundException) e;
        if (e instanceof IntrospectionException)
            throw (IntrospectionException) e;
        if (e instanceof ReflectionException)
            throw (ReflectionException) e;
        if (e instanceof IOException)
            throw (IOException) e;
        throw JMXProviderUtils.newIOException("Got unexpected server exception: " + e, e);
    }
}
 
開發者ID:ow2-proactive,項目名稱:scheduling,代碼行數:28,代碼來源:ROConnection.java

示例14: copyAllAttributes

import javax.management.IntrospectionException; //導入依賴的package包/類
public static void copyAllAttributes(ObjectName on, JsonObject targetObject) {
	try {
		MBeanInfo mbi = mbs.getMBeanInfo(on);
		for (MBeanAttributeInfo mbai : mbi.getAttributes()) {
			Object attValue = mbs.getAttribute(on, mbai.getName());
			if (attValue instanceof Boolean) {
				targetObject.addProperty(mbai.getName(), (Boolean) attValue);
			} else if (attValue instanceof Character) {
				targetObject.addProperty(mbai.getName(), (Character) attValue);
			} else if (attValue instanceof Number) {
				targetObject.addProperty(mbai.getName(), (Number) attValue);
			} else if (attValue instanceof String) {
				targetObject.addProperty(mbai.getName(), (String) attValue);
			} else {
				targetObject.addProperty("OBJECT:" + mbai.getName(), attValue != null ? attValue.toString() : "null");
			}
		}
	} catch (InstanceNotFoundException | IntrospectionException | ReflectionException | AttributeNotFoundException
			| MBeanException e) {
		log.error("Failed to query mbean", e);
	}
}
 
開發者ID:oglimmer,項目名稱:lunchy,代碼行數:23,代碼來源:MBeanService.java

示例15: setYarnAndNonYarnDaemons

import javax.management.IntrospectionException; //導入依賴的package包/類
private void setYarnAndNonYarnDaemons(String host, YarnSlaveParam slave,
    ProfilerJMXDump dump,
    WorkerJMXInfo levelJMXInfo) throws IOException,
    AttributeNotFoundException, InstanceNotFoundException, MBeanException, ReflectionException,
    IntrospectionException {
  levelJMXInfo.setDataNode(dump.getAllJMXAttribute(JMXDeamons.DATA_NODE,  host,
      slave.getDataNodeJmxPort()));
  if(isYarnEnable){
    YarnWorkerJMXInfo ywji = (YarnWorkerJMXInfo) levelJMXInfo;
    ywji.setNodeManager(dump.getAllJMXAttribute(JMXDeamons.NODE_MANAGER,
        host, slave.getNodeManagerJmxPort()));
  }else{
    levelJMXInfo.setTaskTracker(dump.getAllJMXAttribute(JMXDeamons.TASK_TRACKER,  host,
          slave.getTaskTrackerJmxPort()));
  }
}
 
開發者ID:Impetus,項目名稱:jumbune,代碼行數:17,代碼來源:ExecutionServlet.java


注:本文中的javax.management.IntrospectionException類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。