private Attribute getAttribute(AttributeList attributeList, int index) { return (Attribute)attributeList.get(index); }
private Attribute getAttribute(AttributeList attributeList, int index) { return (Attribute)attributeList.get(index); }
private long totalTime(long id) throws JMException, IOException { AttributeList list = mserver.getAttributes(name, new String[]{"CollectionCount", "CollectionTime"}); long rid = ((Number)((Attribute)list.get(0)).getValue()).longValue(); if (id == rid) { return ((Number)((Attribute)list.get(1)).getValue()).longValue(); } else { return -1; } }
public static double getProcessCpuLoad() throws Exception { MBeanServer mbs = ManagementFactory.getPlatformMBeanServer(); ObjectName name = ObjectName.getInstance("java.lang:type=OperatingSystem"); AttributeList list = mbs.getAttributes(name, new String[]{ "ProcessCpuLoad" }); if (list.isEmpty()) return Double.NaN; Attribute att = (Attribute)list.get(0); Double value = (Double)att.getValue(); // usually takes a couple of seconds before we get real values if (value == -1.0) return Double.NaN; // returns a percentage value with 1 decimal point precision return ((int)(value * 1000) / 10.0); }
public AttributeList setAttributes(AttributeList list) { AttributeList results=new AttributeList(); for(int i=0;i < list.size();i++) { Attribute attr=(Attribute)list.get(i); if(setNamedAttribute(attr)) results.add(attr); else { if(log.isWarnEnabled()) log.warn("Failed to update attribute name " + attr.getName() + " with value " + attr.getValue()); } } return results; }
Attribute att = (Attribute) cpuAttributes.get(ATTRIBUTE_INDEX_ProcessCpuLoad); processCpuLoad = (Double) att.getValue(); if (processCpuLoad == Double.NaN) { att = (Attribute) cpuAttributes.get(ATTRIBUTE_INDEX_SystemCpuLoad); systemCpuLoad = (Double) att.getValue(); if (systemCpuLoad == Double.NaN) { att = (Attribute) cpuAttributes.get(ATTRIBUTE_INDEX_ProcessCpuTime); processCpuTime = (Long) att.getValue();
@Test public void durationListedWithUnit() { ConfigurationBean configurationBean = ( (GraphDatabaseAPI) graphdb ).getDependencyResolver().resolveDependency( JmxKernelExtension.class ).getSingleManagementBean( ConfigurationBean.class ); Object v = configurationBean.getAttribute( GraphDatabaseSettings.log_queries_threshold.name() ); assertEquals( "0ms", v ); AttributeList attrs = configurationBean.getAttributes( new String[]{ GraphDatabaseSettings.log_queries_threshold.name() } ); assertEquals( 1, attrs.size() ); Attribute attr = (Attribute) attrs.get( 0 ); assertEquals( "0ms", attr.getValue() ); assertEquals( "dbms.logs.query.threshold = 0ms", attr.toString() ); } }
private double[] getAngles( SequenceAttribute beamSequence ) { Iterator is = beamSequence.iterator(); while (is.hasNext()) { SequenceItem item = (SequenceItem)is.next(); if (item != null) { AttributeList itemList = item.getAttributeList(); if (itemList != null) { Attribute ctrlPoint = itemList.get( TagFromName.ControlPointSequence ); // Do the same sifting through this sequence to get your gantry angle // and add it to your list of values. } } }
private long totalTime(long id) throws JMException, IOException { AttributeList list = mserver.getAttributes(name, new String[]{"CollectionCount", "CollectionTime"}); long rid = ((Number)((Attribute)list.get(0)).getValue()).longValue(); if (id == rid) { return ((Number)((Attribute)list.get(1)).getValue()).longValue(); } else { return -1; } }
private static HashMap getObjMap(AttributeList attrList){ HashMap attrs = new HashMap(); for(int k=0; k<attrList.size(); k++){ Attribute currAttr = (Attribute)attrList.get(k); String pname = currAttr.getName(); Object pObjvalue = currAttr.getValue(); attrs.put(pname, pObjvalue); } return attrs; }
@Override public final double getCpuLevel() throws InstanceNotFoundException, ReflectionException { // This method will block until CPU usage is low enough AttributeList list = mbs.getAttributes(osBeanName, new String[]{"ProcessCpuLoad"}); if (list.isEmpty()) { LOG.error("No CPU stats found for ProcessCpuLoad"); return -1; } Attribute att = (Attribute) list.get(0); return (Double) att.getValue(); }
@Override public final double getCpuLevel() throws InstanceNotFoundException, ReflectionException { // This method will block until CPU usage is low enough AttributeList list = mbs.getAttributes(osBeanName, new String[]{"ProcessCpuLoad"}); if (list.isEmpty()) { LOG.error("No CPU stats found for ProcessCpuLoad"); return -1; } Attribute att = (Attribute) list.get(0); return (Double) att.getValue(); }
@Override public Object getAttribute(final String attribute) throws AttributeNotFoundException, MBeanException, ReflectionException { // we should call getAttributes - and not vice versa to have the result // of a single check call - and not do a check call for each attribute final AttributeList result = this.getAttributes(new String[] {attribute}); if ( result.size() == 0 ) { throw new AttributeNotFoundException(attribute); } final Attribute attr = (Attribute) result.get(0); return attr.getValue(); }
@Override public Object getAttribute(final String attribute) throws AttributeNotFoundException, MBeanException, ReflectionException { // we should call getAttributes - and not vice versa to have the result // of a single check call - and not do a check call for each attribute final AttributeList result = this.getAttributes(new String[] { attribute }); if (result.size() == 0) { throw new AttributeNotFoundException(attribute); } final Attribute attr = (Attribute) result.get(0); return attr.getValue(); }
public AttributeList setAttributes(AttributeList list) { AttributeList results=new AttributeList(); for(int i=0;i < list.size();i++) { Attribute attr=(Attribute)list.get(i); if(setNamedAttribute(attr)) results.add(attr); else { if(log.isWarnEnabled()) log.warn("Failed to update attribute name " + attr.getName() + " with value " + attr.getValue()); } } return results; }
public AttributeList setAttributes(AttributeList list) { AttributeList results=new AttributeList(); for(int i=0;i < list.size();i++) { Attribute attr=(Attribute)list.get(i); if(setNamedAttribute(attr)) results.add(attr); else { if(log.isWarnEnabled()) log.warn("Failed to update attribute name " + attr.getName() + " with value " + attr.getValue()); } } return results; }
public AttributeList setAttributes(AttributeList list) { AttributeList results=new AttributeList(); for(int i=0;i < list.size();i++) { Attribute attr=(Attribute)list.get(i); if(setNamedAttribute(attr)) results.add(attr); else { if(log.isWarnEnabled()) log.warn("Failed to update attribute name " + attr.getName() + " with value " + attr.getValue()); } } return results; }
public AttributeList setAttributes(AttributeList list) { AttributeList results=new AttributeList(); for(int i=0;i < list.size();i++) { Attribute attr=(Attribute)list.get(i); if(setNamedAttribute(attr)) results.add(attr); else { if(log.isWarnEnabled()) log.warn("Failed to update attribute name " + attr.getName() + " with value " + attr.getValue()); } } return results; }
/** * Allows the JMX Agent to set a number of command line options at once. */ public synchronized AttributeList setAttributes(AttributeList attributes) { for (int i = 0; i < attributes.size(); i++) { final Attribute att = (Attribute) attributes.get(i); new Exceptions.VoidBlock() { public void inner() throws Exception { setAttribute(att); } }.exec(); } return attributes; }
/** * Allows the JMX Agent to set a number of command line options at once. */ public synchronized AttributeList setAttributes(AttributeList attributes) { for (int i = 0; i < attributes.size(); i++) { final Attribute att = (Attribute) attributes.get(i); new Exceptions.VoidBlock() { public void inner() throws Exception { setAttribute(att); } }.exec(); } return attributes; }