本文整理了Java中javax.management.AttributeList.get()
方法的一些代码示例,展示了AttributeList.get()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。AttributeList.get()
方法的具体详情如下:
包路径:javax.management.AttributeList
类名称:AttributeList
方法名:get
暂无
代码示例来源:origin: quartz-scheduler/quartz
private Attribute getAttribute(AttributeList attributeList, int index) {
return (Attribute)attributeList.get(index);
}
代码示例来源:origin: quartz-scheduler/quartz
private Attribute getAttribute(AttributeList attributeList, int index) {
return (Attribute)attributeList.get(index);
}
代码示例来源:origin: aragozin/jvm-tools
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;
}
}
代码示例来源:origin: stackoverflow.com
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);
}
代码示例来源:origin: wildfly/wildfly
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;
}
代码示例来源:origin: uber-common/jvm-profiler
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();
代码示例来源:origin: neo4j/neo4j
@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() );
}
}
代码示例来源:origin: stackoverflow.com
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.
}
}
}
代码示例来源:origin: org.gridkit.jvmtool/sjk-core
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;
}
}
代码示例来源:origin: org.netbeans.modules/org-netbeans-modules-j2ee-sun-appsrv
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;
}
代码示例来源:origin: com.adobe.acs/acs-aem-commons-bundle
@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();
}
代码示例来源:origin: Adobe-Consulting-Services/acs-aem-commons
@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();
}
代码示例来源:origin: org.apache.sling/org.apache.sling.hc.core
@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();
}
代码示例来源:origin: org.apache.felix/org.apache.felix.healthcheck.core
@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();
}
代码示例来源:origin: org.apache.activemq/artemis-jms-client-all
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;
}
代码示例来源:origin: apache/activemq-artemis
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;
}
代码示例来源:origin: apache/activemq-artemis
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;
}
代码示例来源:origin: org.jboss.eap/wildfly-client-all
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;
}
代码示例来源:origin: com.mysql/management
/**
* 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;
}
代码示例来源:origin: mysql/mysql-connector-mxj
/**
* 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;
}
内容来源于网络,如有侵权,请联系作者删除!