本文整理汇总了Java中com.j256.simplejmx.common.JmxAttributeMethod类的典型用法代码示例。如果您正苦于以下问题:Java JmxAttributeMethod类的具体用法?Java JmxAttributeMethod怎么用?Java JmxAttributeMethod使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
JmxAttributeMethod类属于com.j256.simplejmx.common包,在下文中一共展示了JmxAttributeMethod类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getComponent
import com.j256.simplejmx.common.JmxAttributeMethod; //导入依赖的package包/类
@JmxAttributeMethod(description = "get Component")
public String getComponent() {
String value = "";
try {
value = GameComponentsLookup.componentNames()[indexComponent] + " : ";
if (entitas.allContexts()[context].getEntities()[indexEntity].hasComponent(indexComponent)) {
value += gson.toJson(entitas.allContexts()[context].getEntities()[indexEntity].getComponent(indexComponent));
} else {
value += "Nulo";
}
} catch (Exception ex) {
value = ex.getMessage();
System.out.println(ex.getMessage());
}
//return gson.toJson(entitas.game.getEntities()[indexEntity].getComponent(indexComponent));
return value;
}
示例2: getComponentNames
import com.j256.simplejmx.common.JmxAttributeMethod; //导入依赖的package包/类
@JmxAttributeMethod(description = "get Components names")
public String[] getComponentNames() {
IComponent[] components = entitas.allContexts()[context].getEntities()[indexEntity].getComponents();
String[] componentNames = new String[components.length];
for (int i = 0; i < components.length; i++) {
componentNames[i] = components[i].getClass().getSimpleName();
}
return componentNames;
}
示例3: getGameComponents
import com.j256.simplejmx.common.JmxAttributeMethod; //导入依赖的package包/类
@JmxAttributeMethod(description = "Game Components")
public Map<String, Integer> getGameComponents() {
Map<String, Integer> components = new TreeMap<>();
for (int i = 0; i < GameComponentsLookup.componentNames().length; i++) {
components.put(GameComponentsLookup.componentNames()[i], i);
}
return components;
}
示例4: getSensorComponents
import com.j256.simplejmx.common.JmxAttributeMethod; //导入依赖的package包/类
@JmxAttributeMethod(description = "Sensor Components")
public Map<String, Integer> getSensorComponents() {
Map<String, Integer> components = new TreeMap<>();
for (int i = 0; i < SensorComponentsLookup.componentNames().length; i++) {
components.put(SensorComponentsLookup.componentNames()[i], i);
}
return components;
}
示例5: getActuatorComponents
import com.j256.simplejmx.common.JmxAttributeMethod; //导入依赖的package包/类
@JmxAttributeMethod(description = "Actuator Components")
public Map<String, Integer> getActuatorComponents() {
Map<String, Integer> components = new TreeMap<>();
for (int i = 0; i < ActuatorComponentsLookup.componentNames().length; i++) {
components.put(ActuatorComponentsLookup.componentNames()[i], i);
}
return components;
}
示例6: getMetricValues
import com.j256.simplejmx.common.JmxAttributeMethod; //导入依赖的package包/类
@JmxAttributeMethod(description = "Metric values we are managing")
public String[] getMetricValues() {
// update the metrics
updateMetrics();
List<String> values;
synchronized (metrics) {
values = new ArrayList<String>(metrics.size());
for (ControlledMetric<?, ?> metric : metrics) {
values.add(MiscUtils.metricToString(metric) + "=" + metric.getValue());
}
}
return values.toArray(new String[values.size()]);
}
示例7: getLastDumpTimeMillisString
import com.j256.simplejmx.common.JmxAttributeMethod; //导入依赖的package包/类
/**
* Get the last time we have dumped the metrics to disk.
*/
@JmxAttributeMethod(description = "Last time the metrics were written")
public String getLastDumpTimeMillisString() {
if (lastDumpTimeMillis == 0) {
return "never";
} else {
return new SimpleDateFormat("yyyy/MM/dd HH:mm:ss z").format(new Date(lastDumpTimeMillis));
}
}
示例8: getMetricsValues
import com.j256.simplejmx.common.JmxAttributeMethod; //导入依赖的package包/类
/**
* Get the values for all of the metric managed by this class.
*/
@JmxAttributeMethod(description = "Values of configured file metrics")
public String[] getMetricsValues() {
List<String> results = new ArrayList<String>();
for (FileMetric fileMetric : fileMetrics) {
results.add(fileMetric.getMetric().toString() + " = " + fileMetric.getMetric().getValue());
}
return results.toArray(new String[results.size()]);
}
示例9: discoverAttributeMethods
import com.j256.simplejmx.common.JmxAttributeMethod; //导入依赖的package包/类
private void discoverAttributeMethods(Map<String, JmxAttributeMethodInfo> attributeMethodInfoMap,
Set<String> attributeNameSet, List<MBeanAttributeInfo> attributes, boolean ignoreErrors, Class<?> clazz) {
for (Method method : clazz.getMethods()) {
JmxAttributeMethod jmxAttribute = method.getAnnotation(JmxAttributeMethod.class);
JmxAttributeMethodInfo attributeMethodInfo = null;
if (jmxAttribute == null) {
// skip it if no annotation
if (attributeMethodInfoMap != null) {
// was this attribute method already configured?
attributeMethodInfo = attributeMethodInfoMap.get(method.getName());
}
if (attributeMethodInfo == null) {
continue;
}
} else {
attributeMethodInfo = new JmxAttributeMethodInfo(method.getName(), jmxAttribute);
jmxAttribute = null;
}
try {
discoverAttributeMethod(attributeNameSet, method, attributeMethodInfo);
} catch (IllegalArgumentException iae) {
if (!ignoreErrors) {
throw iae;
}
}
}
}
示例10: getRunTime
import com.j256.simplejmx.common.JmxAttributeMethod; //导入依赖的package包/类
@JmxAttributeMethod(description = "The time we have been running in seconds or milliseconds")
public long getRunTime() {
long diffMillis = System.currentTimeMillis() - startMillis;
if (showSeconds) {
return diffMillis / 1000;
} else {
return diffMillis;
}
}
示例11: getRunTime
import com.j256.simplejmx.common.JmxAttributeMethod; //导入依赖的package包/类
@JmxAttributeMethod(description = "Run time in seconds or milliseconds")
public long getRunTime() {
// show how long we are running
long diffMillis = System.currentTimeMillis() - startMillis;
if (showSeconds) {
// as seconds
return diffMillis / 1000;
} else {
// or as milliseconds
return diffMillis;
}
}
示例12: getComponentIndices
import com.j256.simplejmx.common.JmxAttributeMethod; //导入依赖的package包/类
@JmxAttributeMethod(description = "get Components indices")
public int[] getComponentIndices() {
return entitas.allContexts()[context].getEntities()[indexEntity].getComponentIndices();
}
示例13: getGameComponentLookup
import com.j256.simplejmx.common.JmxAttributeMethod; //导入依赖的package包/类
@JmxAttributeMethod(description = "get Game Components Lookup")
public String getGameComponentLookup() {
return gson.toJson(new GameComponentsLookup());
}
示例14: getEntity
import com.j256.simplejmx.common.JmxAttributeMethod; //导入依赖的package包/类
@JmxAttributeMethod(description = "get Entity")
public Entity getEntity() {
return entitas.allContexts()[context].getEntities()[indexEntity];
}
示例15: getPersistCount
import com.j256.simplejmx.common.JmxAttributeMethod; //导入依赖的package包/类
@JmxAttributeMethod(description = "Number of times we have persisted the metrics")
public int getPersistCount() {
return persistCount;
}