Java Code Examples for javax.management.DynamicMBean#getAttribute()
The following examples show how to use
javax.management.DynamicMBean#getAttribute() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: DefaultMBeanServerInterceptor.java From hottub with GNU General Public License v2.0 | 5 votes |
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 } }
Example 2
Source File: DynamicMBeanFactoryAttributesTest.java From datakernel with Apache License 2.0 | 5 votes |
@Test public void properlyAggregateMapsByKeyAccordingToTheirValueAggregationPolicy() throws Exception { Map<String, Integer> map_1 = new HashMap<>(); map_1.put("a", 1); map_1.put("b", 2); map_1.put("c", 100); Map<String, Integer> map_2 = new HashMap<>(); map_2.put("b", 2); map_2.put("c", 200); map_2.put("d", 5); MBeanWithMap mBeanWithMap_1 = new MBeanWithMap(map_1); MBeanWithMap mBeanWithMap_2 = new MBeanWithMap(map_2); DynamicMBean mbean = createDynamicMBeanFor(mBeanWithMap_1, mBeanWithMap_2); TabularData tabularData = (TabularData) mbean.getAttribute("nameToNumber"); assertEquals(4, tabularData.size()); CompositeData row_1 = tabularData.get(keyForTabularData("a")); assertEquals(1, row_1.get("value")); CompositeData row_2 = tabularData.get(keyForTabularData("b")); assertEquals(2, row_2.get("value")); CompositeData row_3 = tabularData.get(keyForTabularData("c")); assertNull(row_3.get("value")); CompositeData row_4 = tabularData.get(keyForTabularData("d")); assertEquals(5, row_4.get("value")); }
Example 3
Source File: DefaultMBeanServerInterceptor.java From jdk8u-dev-jdk with GNU General Public License v2.0 | 5 votes |
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 } }
Example 4
Source File: JmxExporterSpiTest.java From ignite with Apache License 2.0 | 5 votes |
/** */ public TabularDataSupport systemView(IgniteEx g, String name) { try { DynamicMBean caches = metricRegistry(g.name(), VIEWS, name); MBeanAttributeInfo[] attrs = caches.getMBeanInfo().getAttributes(); assertEquals(1, attrs.length); return (TabularDataSupport)caches.getAttribute(VIEWS); } catch (Exception e) { throw new RuntimeException(e); } }
Example 5
Source File: IgniteSnapshotMXBeanTest.java From ignite with Apache License 2.0 | 5 votes |
/** * @param mBean Ignite snapshot MBean. * @return Value of snapshot end time. */ private static long getLastSnapshotEndTime(DynamicMBean mBean) { try { return (long)mBean.getAttribute("LastSnapshotEndTime"); } catch (MBeanException | ReflectionException | AttributeNotFoundException e) { throw new RuntimeException(e); } }
Example 6
Source File: DefaultMBeanServerInterceptor.java From jdk8u-jdk with GNU General Public License v2.0 | 5 votes |
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 } }
Example 7
Source File: DefaultMBeanServerInterceptor.java From jdk8u_jdk with GNU General Public License v2.0 | 5 votes |
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 } }
Example 8
Source File: DefaultMBeanServerInterceptor.java From openjdk-8 with GNU General Public License v2.0 | 5 votes |
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 } }
Example 9
Source File: DefaultMBeanServerInterceptor.java From openjdk-8-source with GNU General Public License v2.0 | 5 votes |
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 } }
Example 10
Source File: DefaultMBeanServerInterceptor.java From jdk1.8-source-analysis with Apache License 2.0 | 5 votes |
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 } }
Example 11
Source File: DefaultMBeanServerInterceptor.java From jdk8u-jdk with GNU General Public License v2.0 | 5 votes |
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 } }
Example 12
Source File: DefaultMBeanServerInterceptor.java From openjdk-jdk9 with GNU General Public License v2.0 | 5 votes |
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.TRACE)) { MBEANSERVER_LOGGER.log(Level.TRACE, "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 } }
Example 13
Source File: DefaultMBeanServerInterceptor.java From openjdk-jdk8u-backup with GNU General Public License v2.0 | 5 votes |
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 } }
Example 14
Source File: DefaultMBeanServerInterceptor.java From openjdk-jdk8u with GNU General Public License v2.0 | 5 votes |
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 } }
Example 15
Source File: DefaultMBeanServerInterceptor.java From JDKSourceCode1.8 with MIT License | 5 votes |
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 } }
Example 16
Source File: DefaultMBeanServerInterceptor.java From jdk8u60 with GNU General Public License v2.0 | 5 votes |
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 } }
Example 17
Source File: DefaultMBeanServerInterceptor.java From TencentKona-8 with GNU General Public License v2.0 | 5 votes |
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 } }
Example 18
Source File: DefaultMBeanServerInterceptor.java From dragonwell8_jdk with GNU General Public License v2.0 | 5 votes |
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 } }
Example 19
Source File: JmxExporterSpiTest.java From ignite with Apache License 2.0 | 4 votes |
/** @throws Exception If failed. */ @Test public void testIgniteKernal() throws Exception { DynamicMBean mbn = metricRegistry(ignite.name(), null, IGNITE_METRICS); assertNotNull(mbn); assertEquals(36, mbn.getMBeanInfo().getAttributes().length); assertFalse(stream(mbn.getMBeanInfo().getAttributes()).anyMatch(a -> F.isEmpty(a.getDescription()))); assertFalse(F.isEmpty((String)mbn.getAttribute("fullVersion"))); assertFalse(F.isEmpty((String)mbn.getAttribute("copyright"))); assertFalse(F.isEmpty((String)mbn.getAttribute("osInformation"))); assertFalse(F.isEmpty((String)mbn.getAttribute("jdkInformation"))); assertFalse(F.isEmpty((String)mbn.getAttribute("vmName"))); assertFalse(F.isEmpty((String)mbn.getAttribute("discoverySpiFormatted"))); assertFalse(F.isEmpty((String)mbn.getAttribute("communicationSpiFormatted"))); assertFalse(F.isEmpty((String)mbn.getAttribute("deploymentSpiFormatted"))); assertFalse(F.isEmpty((String)mbn.getAttribute("checkpointSpiFormatted"))); assertFalse(F.isEmpty((String)mbn.getAttribute("collisionSpiFormatted"))); assertFalse(F.isEmpty((String)mbn.getAttribute("eventStorageSpiFormatted"))); assertFalse(F.isEmpty((String)mbn.getAttribute("failoverSpiFormatted"))); assertFalse(F.isEmpty((String)mbn.getAttribute("loadBalancingSpiFormatted"))); assertEquals(System.getProperty("user.name"), (String)mbn.getAttribute("osUser")); assertNotNull(DateFormat.getDateTimeInstance().parse((String)mbn.getAttribute("startTimestampFormatted"))); assertNotNull(LocalTime.parse((String)mbn.getAttribute("uptimeFormatted"))); assertTrue((boolean)mbn.getAttribute("isRebalanceEnabled")); assertTrue((boolean)mbn.getAttribute("isNodeInBaseline")); assertTrue((boolean)mbn.getAttribute("active")); assertTrue((long)mbn.getAttribute("startTimestamp") > 0); assertTrue((long)mbn.getAttribute("uptime") > 0); assertEquals(ignite.name(), (String)mbn.getAttribute("instanceName")); assertEquals(Collections.emptyList(), mbn.getAttribute("userAttributesFormatted")); assertEquals(Collections.emptyList(), mbn.getAttribute("lifecycleBeansFormatted")); assertEquals(Collections.emptyMap(), mbn.getAttribute("longJVMPauseLastEvents")); assertEquals(0L, mbn.getAttribute("longJVMPausesCount")); assertEquals(0L, mbn.getAttribute("longJVMPausesTotalDuration")); long clusterStateChangeTime = (long)mbn.getAttribute("lastClusterStateChangeTime"); assertTrue(0 < clusterStateChangeTime && clusterStateChangeTime < System.currentTimeMillis()); assertEquals(String.valueOf(ignite.configuration().getPublicThreadPoolSize()), mbn.getAttribute("executorServiceFormatted")); assertEquals(ignite.configuration().isPeerClassLoadingEnabled(), mbn.getAttribute("isPeerClassLoadingEnabled")); assertTrue(((String)mbn.getAttribute("currentCoordinatorFormatted")) .contains(ignite.localNode().id().toString())); assertEquals(ignite.configuration().getIgniteHome(), (String)mbn.getAttribute("igniteHome")); assertEquals(ignite.localNode().id(), mbn.getAttribute("localNodeId")); assertEquals(ignite.configuration().getGridLogger().toString(), (String)mbn.getAttribute("gridLoggerFormatted")); assertEquals(ignite.configuration().getMBeanServer().toString(), (String)mbn.getAttribute("mBeanServerFormatted")); assertEquals(ClusterState.ACTIVE.toString(), mbn.getAttribute("clusterState")); }