本文整理汇总了Java中org.rhq.core.domain.measurement.MeasurementScheduleRequest类的典型用法代码示例。如果您正苦于以下问题:Java MeasurementScheduleRequest类的具体用法?Java MeasurementScheduleRequest怎么用?Java MeasurementScheduleRequest使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
MeasurementScheduleRequest类属于org.rhq.core.domain.measurement包,在下文中一共展示了MeasurementScheduleRequest类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getValues
import org.rhq.core.domain.measurement.MeasurementScheduleRequest; //导入依赖的package包/类
@Override
public void getValues(final MeasurementReport report, final Set<MeasurementScheduleRequest> requests) throws Exception {
final ServiceMetrics metrics = getServiceMetrics();
final Service service = getService();
if ((metrics != null) && (service != null)) {
for (MeasurementScheduleRequest request: requests) {
final MeasurementDataNumeric measurementData = getCommonMetric(request, metrics);
if (measurementData != null) {
report.addData(measurementData);
} else {
final String name = request.getName();
final Throttling throttling = service.getThrottling();
if (METRIC_THROTTLING_ENABLED.equals(name)) {
report.addData(new MeasurementDataTrait(request, Boolean.toString(throttling.isEnabled())));
} else if (METRIC_TIME_PERIOD.equals(name)) {
report.addData(new MeasurementDataTrait(request, Long.toString(throttling.getTimePeriod())));
} else if (METRIC_MAX_REQUESTS.equals(name)) {
report.addData(new MeasurementDataTrait(request, Integer.toString(throttling.getMaxRequests())));
} else if (LOG.isDebugEnabled()) {
LOG.debug("Unable to collect Service measurement " + request.getName());
}
}
}
}
}
示例2: getCommonMetric
import org.rhq.core.domain.measurement.MeasurementScheduleRequest; //导入依赖的package包/类
protected MeasurementDataNumeric getCommonMetric(final MeasurementScheduleRequest request, final Metrics metrics) {
final String name = request.getName();
if (METRIC_SUCCESS_COUNT.equals(name)) {
return new MeasurementDataNumeric(request, Double.valueOf(metrics.getSuccessCount()));
} else if (METRIC_FAULT_COUNT.equals(name)) {
return new MeasurementDataNumeric(request, Double.valueOf(metrics.getFaultCount()));
} else if (METRIC_TOTAL_COUNT.equals(name)) {
return new MeasurementDataNumeric(request, Double.valueOf(metrics.getTotalCount()));
} else if (METRIC_TOTAL_PROCESSING_TIME.equals(name)) {
return new MeasurementDataNumeric(request, Double.valueOf(metrics.getTotalTime()));
} else if (METRIC_AVERAGE_PROCESSING_TIME.equals(name)) {
return new MeasurementDataNumeric(request, Double.valueOf(metrics.getAverageTime()));
} else if (METRIC_MIN_PROCESSING_TIME.equals(name)) {
return new MeasurementDataNumeric(request, Double.valueOf(metrics.getMinTime()));
} else if (METRIC_MAX_PROCESSING_TIME.equals(name)) {
return new MeasurementDataNumeric(request, Double.valueOf(metrics.getMaxTime()));
} else {
return null;
}
}
示例3: getValues
import org.rhq.core.domain.measurement.MeasurementScheduleRequest; //导入依赖的package包/类
@Override
public void getValues(final MeasurementReport report, final Set<MeasurementScheduleRequest> requests) throws Exception {
final GatewayMetrics metrics = getGatewayMetrics();
final Gateway gateway = getGateway();
if ((metrics != null) && (gateway != null)) {
for (MeasurementScheduleRequest request: requests) {
final MeasurementDataNumeric measurementData = getCommonMetric(request, metrics);
if (measurementData != null) {
report.addData(measurementData);
} else {
final String name = request.getName();
if (METRIC_STATE.equals(name)) {
report.addData(new MeasurementDataTrait(request, gateway.getState()));
} else if (LOG.isDebugEnabled()) {
LOG.debug("Unable to collect Reference Binding measurement " + request.getName());
}
}
}
}
}
示例4: getValues
import org.rhq.core.domain.measurement.MeasurementScheduleRequest; //导入依赖的package包/类
@Override
public void getValues(final MeasurementReport report, final Set<MeasurementScheduleRequest> requests) throws Exception {
final GatewayMetrics metrics = getGatewayMetrics();
final Gateway gateway = getGateway();
if ((metrics != null) && (gateway != null)) {
for (MeasurementScheduleRequest request: requests) {
final MeasurementDataNumeric measurementData = getCommonMetric(request, metrics);
if (measurementData != null) {
report.addData(measurementData);
} else {
final String name = request.getName();
if (METRIC_STATE.equals(name)) {
report.addData(new MeasurementDataTrait(request, gateway.getState()));
} else if (LOG.isDebugEnabled()) {
LOG.debug("Unable to collect Service Binding measurement " + request.getName());
}
}
}
}
}
示例5: getValue
import org.rhq.core.domain.measurement.MeasurementScheduleRequest; //导入依赖的package包/类
public void getValue(WebSphereServer server, MeasurementReport report, MeasurementScheduleRequest request) throws InterruptedException, JMException, ConnectorException {
Object value;
try {
value = mbean.invoke(operationName, new Object[0], new String[0]);
} catch (InstanceNotFoundException ex) {
if (ignoreInstanceNotFound) {
if (log.isDebugEnabled()) {
log.debug("Ignoring InstanceNotFoundException for measurement of " + request.getName() + " on " + mbean);
}
value = null;
} else {
throw ex;
}
}
JMXMeasurementDataUtils.addData(report, request, value);
}
示例6: getValues
import org.rhq.core.domain.measurement.MeasurementScheduleRequest; //导入依赖的package包/类
public void getValues(WebSphereServer server, MeasurementReport report, Map<String,MeasurementScheduleRequest> requests) {
String[] attributes = requests.keySet().toArray(new String[requests.size()]);
AttributeList list;
try {
list = mbean.getAttributes(attributes);
} catch (Exception ex) {
log.error("Failed to get values for attributes " + requests.keySet());
// TODO: shouldn't we fall back to fetching each attribute individually?
return;
}
if (log.isDebugEnabled()) {
log.debug("Fetched attributes from " + mbean + ": " + Arrays.asList(attributes) + "=" + list);
}
for (int i=0; i<attributes.length; i++) {
JMXMeasurementDataUtils.addData(report, requests.get(attributes[i]), ((Attribute)list.get(i)).getValue());
}
}
示例7: getValues
import org.rhq.core.domain.measurement.MeasurementScheduleRequest; //导入依赖的package包/类
public void getValues(MeasurementReport report, Set<MeasurementScheduleRequest> requests) throws Exception {
String[] stats = cache.getAllCacheStatistics(instanceName);
for (MeasurementScheduleRequest request : requests) {
String name = request.getName();
String value = null;
for (String stat : stats) {
if (stat.indexOf('=') == name.length() && stat.startsWith(name)) {
value = stat.substring(name.length()+1);
break;
}
}
if (value != null) {
report.addData(new MeasurementDataNumeric(request, Double.parseDouble(value)));
}
}
}
示例8: getValues
import org.rhq.core.domain.measurement.MeasurementScheduleRequest; //导入依赖的package包/类
@Override
public void getValues(MeasurementReport mr, Set<MeasurementScheduleRequest> msrs) {
Map<String, Double> digest = new HashMap<String, Double>();
try {
digest(digest);
} catch (Exception e) {
log.warn("failed to digest additional content", e);
}
msrs = new HashSet(msrs); // need to copy - RHQ Bug 821058
for (Iterator<MeasurementScheduleRequest> i = msrs.iterator(); i.hasNext(); ) {
MeasurementScheduleRequest msr = i.next();
Double d = digest.get(msr.getName());
if (d != null) {
mr.addData(new MeasurementDataNumeric(msr, d));
i.remove();
}
}
if (!msrs.isEmpty()) // JIRA issue HADOOP-8389
super.getValues(mr, msrs);
}
示例9: getValues
import org.rhq.core.domain.measurement.MeasurementScheduleRequest; //导入依赖的package包/类
@Override
public void getValues(MeasurementReport report, Set<MeasurementScheduleRequest> metrics) throws Exception {
QueueData queueData = getQueueData();
log.debug("queue data " + queueData);
for (MeasurementScheduleRequest mr : metrics) {
String n = mr.getName();
if (n.equals("jobCount"))
report.addData(new MeasurementDataNumeric(mr, (double)queueData.jobCount));
if (n.equals("mapTotal"))
report.addData(new MeasurementDataNumeric(mr, (double)queueData.mapTotal));
if (n.equals("mapComplete"))
report.addData(new MeasurementDataNumeric(mr, (double)queueData.mapComplete));
if (n.equals("reducersComplete"))
report.addData(new MeasurementDataNumeric(mr, (double)queueData.reducersComplete));
if (n.equals("reducersTotal"))
report.addData(new MeasurementDataNumeric(mr, (double)queueData.reducersTotal));
}
}
示例10: getValues
import org.rhq.core.domain.measurement.MeasurementScheduleRequest; //导入依赖的package包/类
@Override
public void getValues(MeasurementReport mr, Set<MeasurementScheduleRequest> msrs) throws Exception {
if (map.isEmpty())
getAvailability();
for (Iterator<MeasurementScheduleRequest> i = msrs.iterator(); i.hasNext(); ) {
MeasurementScheduleRequest msr = i.next();
Object o = map.get(msr.getName());
if (o != null) {
if (msr.getDataType() == DataType.MEASUREMENT) {
mr.addData(new MeasurementDataNumeric(msr, (Double)o));
} else {
mr.addData(new MeasurementDataTrait(msr, o.toString()));
}
}
}
}
示例11: getValues
import org.rhq.core.domain.measurement.MeasurementScheduleRequest; //导入依赖的package包/类
@Override
public void getValues(MeasurementReport mr, Set<MeasurementScheduleRequest> msr) throws Exception {
getAvailability(); // loads stats
for (MeasurementScheduleRequest r : msr) {
String name = r.getName();
Object val = stats.get(name);
if (val == null) {
continue;
}
if (r.getDataType() == DataType.MEASUREMENT) {
Number n;
if (name.endsWith("WindowId")) {
n = AppComponent.windowId(val);
} else {
n = Double.parseDouble(val.toString());
}
mr.addData(new MeasurementDataNumeric(r, n.doubleValue()));
} else {
mr.addData(new MeasurementDataTrait(r, val.toString()));
}
}
}
示例12: getValues
import org.rhq.core.domain.measurement.MeasurementScheduleRequest; //导入依赖的package包/类
public void getValues(MeasurementReport report, Set<MeasurementScheduleRequest> requests) {
for (MeasurementScheduleRequest request : requests) {
String name = request.getName();
if (name.equals(ELAPSED)) {
report.addData(new MeasurementDataNumeric(request, (double)elapsed));
} else if (name.equals(ENABLED)) {
report.addData(new MeasurementDataTrait(request, setting(ENABLED, Boolean.toString(false))));
} else if (name.equals(GROUP)) {
report.addData(new MeasurementDataTrait(request, setting(GROUP)));
} else if (name.equals(OUTPUT)) {
report.addData(new MeasurementDataTrait(request, setting(OUTPUT)));
} else {
log.warn("unknown metric " + name);
}
}
}
示例13: getValues
import org.rhq.core.domain.measurement.MeasurementScheduleRequest; //导入依赖的package包/类
@Override
public void getValues(MeasurementReport mr, Set<MeasurementScheduleRequest> msrs) throws Exception {
getAvailability();
for (MeasurementScheduleRequest msr : msrs) {
String s = info.getProperty(msr.getName());
if (s != null) {
if (msr.getDataType() == DataType.TRAIT) {
mr.addData(new MeasurementDataTrait(msr, s));
} else {
mr.addData(new MeasurementDataNumeric(msr, Double.parseDouble(s)));
}
} else {
log.warn("not found " + msr.getName());
}
}
}
示例14: getValues
import org.rhq.core.domain.measurement.MeasurementScheduleRequest; //导入依赖的package包/类
@Override
public void getValues(MeasurementReport report,
Set<MeasurementScheduleRequest> metrics) throws Exception {
getAvailability();
long now = System.currentTimeMillis();
for (MeasurementScheduleRequest metric : metrics) {
String name = metric.getName();
Object trait = traits.get(name);
if (name.equals("startElapsed") && startTime != null) {
report.addData(new MeasurementDataNumeric(metric, (double) (now - startTime.getTime())));
} else if (name.equals("actionElapsed") && lastAction != null) {
report.addData(new MeasurementDataNumeric(metric, (double) (lastAction.getTime() - now)));
} else if (trait != null) {
report.addData(new MeasurementDataTrait(metric, s(trait)));
}
}
}
示例15: getValues
import org.rhq.core.domain.measurement.MeasurementScheduleRequest; //导入依赖的package包/类
public void getValues(MeasurementReport report, Set<MeasurementScheduleRequest> requests) {
List<EmsBean> beans = parent.getEmsConnection().queryBeans(objectName);
log.debug("found " + beans.size());
for (MeasurementScheduleRequest request : requests) {
String name = request.getName();
double sum = 0;
for (EmsBean bean : beans) {
EmsAttribute attr = bean.getAttribute(name);
if (attr == null || attr.getValue() == null) {
log.error(name + " not found");
continue;
}
Object value = attr.getValue();
if (value instanceof Number) {
sum += ((Number)value).doubleValue();
}
}
if (request.getDataType() == DataType.MEASUREMENT) {
report.addData(new MeasurementDataNumeric(request, sum));
}
}
}