javax.management.AttributeList Java Examples
The following examples show how to use
javax.management.AttributeList.
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: MemberTestMbean.java From gemfirexd-oss with Apache License 2.0 | 6 votes |
public void checkRegionLatencyCounters(JMXOperations ops, ObjectName targetMbean){ logInfo(prefix + " Calling checkRegionLatencyCounters"); String attributes[] = { "CacheListenerCallsAvgLatency", "CacheWriterCallsAvgLatency", //"CreatesAvgLatency", //"DestroyAvgLatency", //"GeAllAvgLatency", "GetsAvgLatency", "LoadsAverageLatency", "NetLoadsAverageLatency", "NetSearchAverageLatency", "PutAllAvgLatency", "PutsAvgLatency", }; String url = ops.selectManagingNode(); AttributeList attrList = (AttributeList) ops.getAttributes(url, targetMbean, attributes); logInfo("checkRegionLatencyCounters " + HydraUtil.ObjectToString(attrList)); logInfo(prefix + " Completed checkRegionLatencyCounters test successfully"); }
Example #2
Source File: ProxyClient.java From jmxmon with Apache License 2.0 | 6 votes |
private synchronized NameValueMap getCachedAttributes( ObjectName objName, Set<String> attrNames) throws InstanceNotFoundException, ReflectionException, IOException { NameValueMap values = cachedValues.get(objName); if (values != null && values.keySet().containsAll(attrNames)) { return values; } attrNames = new TreeSet<String>(attrNames); Set<String> oldNames = cachedNames.get(objName); if (oldNames != null) { attrNames.addAll(oldNames); } values = new NameValueMap(); final AttributeList attrs = conn.getAttributes( objName, attrNames.toArray(new String[attrNames.size()])); for (Attribute attr : attrs.asList()) { values.put(attr.getName(), attr.getValue()); } cachedValues.put(objName, values); cachedNames.put(objName, attrNames); return values; }
Example #3
Source File: RegionTestMBean.java From gemfirexd-oss with Apache License 2.0 | 6 votes |
public void checkRegionRuntimeAttributes(JMXOperations ops, ObjectName targetMbean){ logInfo(prefix + " Calling checkRegionRuntimeAttributes"); String attributes[] = { "LastModifiedTime", "LastAccessedTime", "MissCount", "HitCount", "HitRatio", "EntryCount", "TotalEntriesOnlyOnDisk", "TotalDiskEntriesInVM" }; String url = ops.selectManagingNode(); AttributeList attrList = (AttributeList) ops.getAttributes(url, targetMbean, attributes); logInfo("checkRegionRuntimeAttributes " + HydraUtil.ObjectToString(attrList)); logInfo(prefix + " Completed checkRegionRuntimeAttributes test successfully"); }
Example #4
Source File: PluggableMBeanServerImpl.java From wildfly-core with GNU Lesser General Public License v2.1 | 6 votes |
@Override public AttributeList getAttributes(ObjectName name, String[] attributes) throws InstanceNotFoundException, ReflectionException { Throwable error = null; MBeanServerPlugin delegate = null; final boolean readOnly = true; try { delegate = findDelegate(name); if (delegate.shouldAuthorize()) { for(String attribute : attributes) { authorizeMBeanOperation(delegate, name, GET_ATTRIBUTES, attribute, JmxAction.Impact.READ_ONLY); } } return delegate.getAttributes(name, attributes); } catch (Exception e) { error = e; if (e instanceof InstanceNotFoundException) throw (InstanceNotFoundException)e; if (e instanceof ReflectionException) throw (ReflectionException)e; throw makeRuntimeException(e); } finally { if (shouldAuditLog(delegate, readOnly)) { new MBeanServerAuditLogRecordFormatter(this, error, readOnly).getAttributes(name, attributes); } } }
Example #5
Source File: JmxReporterTest.java From metrics with Apache License 2.0 | 6 votes |
@Test public void registersMBeansForMeters() throws Exception { final AttributeList attributes = getAttributes("test.meter", "Count", "MeanRate", "OneMinuteRate", "FiveMinuteRate", "FifteenMinuteRate", "RateUnit"); Assertions.assertThat(values(attributes)) .contains(Assertions.entry("Count", 1L)) .contains(Assertions.entry("MeanRate", 2.0)) .contains(Assertions.entry("OneMinuteRate", 3.0)) .contains(Assertions.entry("FiveMinuteRate", 4.0)) .contains(Assertions.entry("FifteenMinuteRate", 5.0)) .contains(Assertions.entry("RateUnit", "events/second")); }
Example #6
Source File: RegionTestMBean.java From gemfirexd-oss with Apache License 2.0 | 6 votes |
public void checkRegionStatistics(JMXOperations ops, ObjectName targetMbean){ logInfo(prefix + " Calling checkRegionStatistics"); String attributes[] = { "GetsRate", "PutsRate", "CreatesRate", "DestroyRate", "PutAllRate", "PutLocalRate", "PutRemoteRate", "PutRemoteLatency", "PutRemoteAvgLatency", "DiskReadsRate", "DiskWritesRate", "CacheWriterCallsAvgLatency", "CacheListenerCallsAvgLatency", "LruEvictionRate", "LruDestroyRate" }; String url = ops.selectManagingNode(); AttributeList attrList = (AttributeList) ops.getAttributes(url, targetMbean, attributes); logInfo("checkRegionStatistics " + HydraUtil.ObjectToString(attrList)); logInfo(prefix + " Completed checkRegionStatistics test successfully"); }
Example #7
Source File: ROConnection.java From scheduling with GNU Affero General Public License v3.0 | 6 votes |
/** * @see javax.management.MBeanServerConnection#getAttributes(javax.management.ObjectName, java.lang.String[]) */ public AttributeList getAttributes(final ObjectName name, final String[] attributes) throws InstanceNotFoundException, ReflectionException, IOException { if (this.subject == null) { return this.mbs.getAttributes(name, attributes); } try { return (AttributeList) Subject.doAsPrivileged(this.subject, new PrivilegedExceptionAction<AttributeList>() { public final AttributeList run() throws Exception { return mbs.getAttributes(name, attributes); } }, this.context); } catch (final PrivilegedActionException pe) { final Exception e = JMXProviderUtils.extractException(pe); if (e instanceof InstanceNotFoundException) throw (InstanceNotFoundException) e; if (e instanceof ReflectionException) throw (ReflectionException) e; if (e instanceof IOException) throw (IOException) e; throw JMXProviderUtils.newIOException("Got unexpected server exception: " + e, e); } }
Example #8
Source File: MetricsDynamicMBeanBase.java From hadoop-gpu with Apache License 2.0 | 6 votes |
@Override public AttributeList getAttributes(String[] attributeNames) { if (attributeNames == null || attributeNames.length == 0) throw new IllegalArgumentException(); updateMbeanInfoIfMetricsListChanged(); AttributeList result = new AttributeList(attributeNames.length); for (String iAttributeName : attributeNames) { try { Object value = getAttribute(iAttributeName); result.add(new Attribute(iAttributeName, value)); } catch (Exception e) { continue; } } return result; }
Example #9
Source File: DataSourceConfigurationManagerService.java From attic-polygene-java with Apache License 2.0 | 6 votes |
@Override public AttributeList setAttributes( AttributeList attributeList ) { AttributeList list = new AttributeList(); for ( int i = 0; i < list.size(); i++ ) { Attribute attribute = ( Attribute ) list.get( i ); try { setAttribute( attribute ); list.add( attribute ); } catch ( AttributeNotFoundException | InvalidAttributeValueException | ReflectionException | MBeanException e ) { e.printStackTrace(); } } return list; }
Example #10
Source File: MBeanHelper.java From gemfirexd-oss with Apache License 2.0 | 6 votes |
public static void matchValues(AttributeList list, Map<String, Object> expectedMap) { for (Entry<String, Object> entry : expectedMap.entrySet()) { boolean found = false; for (int i = 0; i < list.size(); i++) { Attribute attr = (Attribute) list.get(i); if (attr.getName().equals(entry.getKey())) { found = true; Log.getLogWriter().info( entry.getKey() + "--> JMX : " + attr.getValue() + " BB : " + entry.getValue()); if (!attr.getValue().equals(entry.getValue())) { printAndSaveError("Attribute", null, attr, entry.getValue()); } } } if (!found) throw new TestException("Error attribute " + entry.getKey() + " not found"); } }
Example #11
Source File: RMRest.java From scheduling with GNU Affero General Public License v3.0 | 6 votes |
@Override public String getStatHistory(String sessionId, String range1, String function) throws ReflectionException, InterruptedException, IntrospectionException, NotConnectedException, InstanceNotFoundException, MalformedObjectNameException, IOException { String newRange = MBeanInfoViewer.possibleModifyRange(range1, dataSources, 'a'); StatHistoryCacheEntry entry = StatHistoryCaching.getInstance().getEntryOrCompute(newRange, () -> { RMProxyUserInterface rm = checkAccess(sessionId); AttributeList attrs = rm.getMBeanAttributes(new ObjectName(RMJMXBeans.RUNTIMEDATA_MBEAN_NAME), new String[] { "StatisticHistory" }); Attribute attr = (Attribute) attrs.get(0); // content of the RRD4J database backing file byte[] rrd4j = (byte[]) attr.getValue(); return MBeanInfoViewer.rrdContent(rrd4j, newRange, dataSources, function); }); return entry.getValue(); }
Example #12
Source File: MetricsDynamicMBeanBase.java From RDFS with Apache License 2.0 | 6 votes |
@Override public AttributeList getAttributes(String[] attributeNames) { if (attributeNames == null || attributeNames.length == 0) throw new IllegalArgumentException(); updateMbeanInfoIfMetricsListChanged(); AttributeList result = new AttributeList(attributeNames.length); for (String iAttributeName : attributeNames) { try { Object value = getAttribute(iAttributeName); result.add(new Attribute(iAttributeName, value)); } catch (Exception e) { continue; } } return result; }
Example #13
Source File: GatewaySenderTestMBean.java From gemfirexd-oss with Apache License 2.0 | 5 votes |
public void checkSenderRuntime(JMXOperations ops, ObjectName targetMbean){ String attributes[] = { "Running", "Paused", "Primary", "DispatcherThreads" }; logInfo(prefix + " Calling checkSenderRuntime"); String url = ops.selectManagingNode(); AttributeList attrList = (AttributeList) ops.getAttributes(url, targetMbean, attributes); logInfo("checkSenderRuntime " + HydraUtil.ObjectToString(attrList)); }
Example #14
Source File: MemberTestMbean.java From gemfirexd-oss with Apache License 2.0 | 5 votes |
public void checkRegionRateCounters(JMXOperations ops, ObjectName targetMbean){ logInfo(prefix + " Calling checkRegionRateCounters"); String attributes[] = { "CreatesRate", "DestroysRate", // "GetAllRate" , "GetsRate" , "PutAllRate", "PutsRate" }; String url = ops.selectManagingNode(); AttributeList attrList = (AttributeList) ops.getAttributes(url, targetMbean, attributes); logInfo("checkRegionRateCounters " + HydraUtil.ObjectToString(attrList)); logInfo(prefix + " Completed checkRegionRateCounters test successfully"); }
Example #15
Source File: DataSourceConfigurationManagerService.java From attic-polygene-java with Apache License 2.0 | 5 votes |
@Override public AttributeList getAttributes( String[] names ) { AttributeList list = new AttributeList(); for ( String name : names ) { try { Object value = getAttribute( name ); list.add( new Attribute( name, value ) ); } catch ( AttributeNotFoundException | MBeanException | ReflectionException e ) { e.printStackTrace(); } } return list; }
Example #16
Source File: OldMBeanServerTest.java From openjdk-jdk8u-backup with GNU General Public License v2.0 | 5 votes |
public AttributeList getAttributes(String[] attributes) { AttributeList list = new AttributeList(); for (String attr : attributes) { try { list.add(new Attribute(attr, getAttribute(attr))); } catch (Exception e) { // OK: ignore per spec } } return list; }
Example #17
Source File: MemberTestMbean.java From gemfirexd-oss with Apache License 2.0 | 5 votes |
public void checkGemfireLockCounters(JMXOperations ops, ObjectName targetMbean){ logInfo(prefix + " Calling checkGemfireLockCounters"); String attributes[] = { "LockRequestQueues", "LockWaitsInProgress", "TotalLockWaitTime", "TotalNumberOfLockService" }; String url = ops.selectManagingNode(); AttributeList attrList = (AttributeList) ops.getAttributes(url, targetMbean, attributes); logInfo("checkGemfireLockCounters " + HydraUtil.ObjectToString(attrList)); logInfo(prefix + " Completed checkGemfireLockCounters test successfully"); }
Example #18
Source File: MBeanServerDelegateImpl.java From jdk8u-jdk with GNU General Public License v2.0 | 5 votes |
/** * Makes it possible to get the values of several attributes of * the MBeanServerDelegate. * * @param attributes A list of the attributes to be retrieved. * * @return The list of attributes retrieved. * */ public AttributeList getAttributes(String[] attributes) { // If attributes is null, the get all attributes. // final String[] attn = (attributes==null?attributeNames:attributes); // Prepare the result list. // final int len = attn.length; final AttributeList list = new AttributeList(len); // Get each requested attribute. // for (int i=0;i<len;i++) { try { final Attribute a = new Attribute(attn[i],getAttribute(attn[i])); list.add(a); } catch (Exception x) { // Skip the attribute that couldn't be obtained. // if (MBEANSERVER_LOGGER.isLoggable(Level.FINEST)) { MBEANSERVER_LOGGER.logp(Level.FINEST, MBeanServerDelegateImpl.class.getName(), "getAttributes", "Attribute " + attn[i] + " not found"); } } } // Finally return the result. // return list; }
Example #19
Source File: LibraryVersions.java From cougar with Apache License 2.0 | 5 votes |
@Override public AttributeList getAttributes(String[] attributes) { AttributeList ret = new AttributeList(); for (String s : attributes) { ret.add(new Attribute(s, artifacts.get(s))); } return ret; }
Example #20
Source File: MBeanSupport.java From jdk8u-jdk with GNU General Public License v2.0 | 5 votes |
public final AttributeList setAttributes(AttributeList attributes) { final AttributeList result = new AttributeList(attributes.size()); for (Object attrObj : attributes) { // We can't use AttributeList.asList because it has side-effects Attribute attr = (Attribute) attrObj; try { setAttribute(attr); result.add(new Attribute(attr.getName(), attr.getValue())); } catch (Exception e) { // OK: attribute is not included in returned list, per spec // XXX: log the exception } } return result; }
Example #21
Source File: JmxReporterTest.java From metrics with Apache License 2.0 | 5 votes |
@Test public void registersMBeansForGauges() throws Exception { final AttributeList attributes = getAttributes("gauge", "Value"); Assertions.assertThat(values(attributes)) .contains(Assertions.entry("Value", 1)); }
Example #22
Source File: SoaBundle.java From soabase with Apache License 2.0 | 5 votes |
private void addMetrics(Environment environment) { Metric metric = new Gauge<Double>() { private double lastValue = 0.0; @Override public Double getValue() { try { MBeanServer mbs = ManagementFactory.getPlatformMBeanServer(); ObjectName name = ObjectName.getInstance("java.lang:type=OperatingSystem"); AttributeList list = mbs.getAttributes(name, new String[]{"SystemCpuLoad"}); if ( (list != null) && (list.size() > 0) ) { // unfortunately, this bean reports bad values occasionally. Filter them out. Object value = list.asList().get(0).getValue(); double d = (value instanceof Number) ? ((Number)value).doubleValue() : 0.0; d = ((d > 0.0) && (d < 1.0)) ? d : lastValue; lastValue = d; return d; } } catch ( Exception ignore ) { // ignore } return lastValue; } }; environment.metrics().register("system.cpu.load", metric); }
Example #23
Source File: RMIConnector.java From TencentKona-8 with GNU General Public License v2.0 | 5 votes |
static String getAttributesNames(AttributeList attributes) { return attributes != null ? attributes.asList().stream() .map(Attribute::getName) .collect(Collectors.joining(", ", "[", "]")) : "[]"; }
Example #24
Source File: PropertyMapDynamicBean.java From cloudstack with Apache License 2.0 | 5 votes |
@Override public synchronized AttributeList setAttributes(AttributeList list) { Attribute[] attrs = list.toArray(new Attribute[0]); AttributeList retList = new AttributeList(); for (Attribute attr : attrs) { String name = attr.getName(); Object value = attr.getValue(); _propMap.put(name, value); retList.add(new Attribute(name, value)); } return retList; }
Example #25
Source File: SpringModelMBean.java From java-technology-stack with MIT License | 5 votes |
/** * Switches the {@link Thread#getContextClassLoader() context ClassLoader} for the * managed resources {@link ClassLoader} before allowing the invocation to occur. * @see javax.management.modelmbean.ModelMBean#setAttributes */ @Override public AttributeList setAttributes(AttributeList attributes) { ClassLoader currentClassLoader = Thread.currentThread().getContextClassLoader(); try { Thread.currentThread().setContextClassLoader(this.managedResourceClassLoader); return super.setAttributes(attributes); } finally { Thread.currentThread().setContextClassLoader(currentClassLoader); } }
Example #26
Source File: RMIConnector.java From dragonwell8_jdk with GNU General Public License v2.0 | 5 votes |
static String getAttributesNames(AttributeList attributes) { return attributes != null ? attributes.asList().stream() .map(Attribute::getName) .collect(Collectors.joining(", ", "[", "]")) : "[]"; }
Example #27
Source File: MemberTestMbean.java From gemfirexd-oss with Apache License 2.0 | 5 votes |
public void checkGemfireLruCounters(JMXOperations ops, ObjectName targetMbean){ logInfo(prefix + " Calling checkGemfireLruCounters"); String attributes[] = { "LruDestroyRate", "LruEvictionRate" }; String url = ops.selectManagingNode(); AttributeList attrList = (AttributeList) ops.getAttributes(url, targetMbean, attributes); logInfo("checkGemfireLruCounters " + HydraUtil.ObjectToString(attrList)); logInfo(prefix + " Completed checkGemfireLruCounters test successfully"); }
Example #28
Source File: ReflectionMbean.java From simplejmx with ISC License | 5 votes |
@Override public AttributeList getAttributes(String[] attributeNames) { AttributeList returnList = new AttributeList(); for (String name : attributeNames) { try { returnList.add(new Attribute(name, getAttribute(name))); } catch (Exception e) { returnList.add(new Attribute(name, "Getting attribute threw: " + e.getMessage())); } } return returnList; }
Example #29
Source File: MBeanSupport.java From dragonwell8_jdk with GNU General Public License v2.0 | 5 votes |
public final AttributeList setAttributes(AttributeList attributes) { final AttributeList result = new AttributeList(attributes.size()); for (Object attrObj : attributes) { // We can't use AttributeList.asList because it has side-effects Attribute attr = (Attribute) attrObj; try { setAttribute(attr); result.add(new Attribute(attr.getName(), attr.getValue())); } catch (Exception e) { // OK: attribute is not included in returned list, per spec // XXX: log the exception } } return result; }
Example #30
Source File: MBeanServerAccessController.java From openjdk-jdk8u-backup with GNU General Public License v2.0 | 5 votes |
/** * Call <code>checkWrite()</code>, then forward this method to the * wrapped object. */ public AttributeList setAttributes(ObjectName name, AttributeList attributes) throws InstanceNotFoundException, ReflectionException { checkWrite(); return getMBeanServer().setAttributes(name, attributes); }