• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Java AvailabilityType类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Java中org.rhq.core.domain.measurement.AvailabilityType的典型用法代码示例。如果您正苦于以下问题:Java AvailabilityType类的具体用法?Java AvailabilityType怎么用?Java AvailabilityType使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



AvailabilityType类属于org.rhq.core.domain.measurement包,在下文中一共展示了AvailabilityType类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。

示例1: getCurrentAvailaibility

import org.rhq.core.domain.measurement.AvailabilityType; //导入依赖的package包/类
private AvailabilityType getCurrentAvailaibility(Resource resource) {
	Subject user = LookupUtil.getSubjectManager().getOverlord();
	AgentManagerLocal agentManager = LookupUtil.getAgentManager();
	AgentClient agentClient = agentManager.getAgentClient(user, resource.getId());
	DiscoveryAgentService discoveryAgentService = agentClient.getDiscoveryAgentService();
	AvailabilityReport currentAvailability = discoveryAgentService.getCurrentAvailability(resource, false);
	// the discoveryAgentService returns the live availability of the requested resource and the last
	// known availabilities of any child resources
	List<Datum> datums = currentAvailability.getResourceAvailability();
	for(Datum datum : datums) {
		if(datum.getResourceId() == resource.getId()) {
			return datum.getAvailabilityType();
		}
	}
	throw new IllegalStateException("Agent didn't respond with requested resource's availability. Resource: "
			+ resource.toString());
}
 
开发者ID:kszbcss,项目名称:rhq-websphere-plugin,代码行数:18,代码来源:WebSphereServerPlugin.java


示例2: doGetAvailability

import org.rhq.core.domain.measurement.AvailabilityType; //导入依赖的package包/类
@Override
protected AvailabilityType doGetAvailability() {
    EJBMonitor ejbMonitor = getApplication().getParent().getEjbMonitor();
    try {
        if (((MBeanClientProxy)ejbMonitor).getMBeanClient().isRegistered()) {
            // TODO: once XM4WAS 0.4.0 has been released, use the variant of the validateStatelessSessionBean method that takes a timeout (and set it to 3 seconds)
            String result = ejbMonitor.validateStatelessSessionBean(getApplicationName(), getModuleName(), getBeanName());
            if (result != null && log.isDebugEnabled()) {
                log.debug("validateStatelessSessionBean result:\n" + result);
            }
            return result == null ? AvailabilityType.UP : AvailabilityType.DOWN;
        } else {
            log.debug("EJBMonitor not available => availability = UP");
            return AvailabilityType.UP;
        }
    } catch (Exception ex) {
        log.debug("Caught exception => availability = DOWN", ex);
        return AvailabilityType.DOWN;
    }
}
 
开发者ID:kszbcss,项目名称:rhq-websphere-plugin,代码行数:21,代码来源:StatelessSessionBeanComponent.java


示例3: doGetAvailability

import org.rhq.core.domain.measurement.AvailabilityType; //导入依赖的package包/类
@Override
protected AvailabilityType doGetAvailability() {
    AvailabilityType availability = super.doGetAvailability();
    if (availability == AvailabilityType.DOWN) {
        return AvailabilityType.DOWN;
    } else {
        try {
            Integer status = endpoint.getStatus();
            if (log.isDebugEnabled()) {
                log.debug("Status of J2CMessageEndpoint for MDB " + getResourceContext().getResourceKey() + ": " + status);
            }
            return status != null && status.intValue() == 1 ? AvailabilityType.UP : AvailabilityType.DOWN;
        } catch (Exception ex) {
            if (log.isDebugEnabled()) {
                log.debug("Error getting status of J2CMessageEndpoint for MDB " + getResourceContext().getResourceKey(), ex);
            }
            return AvailabilityType.DOWN;
        }
    }
}
 
开发者ID:kszbcss,项目名称:rhq-websphere-plugin,代码行数:21,代码来源:MessageDrivenBeanComponent.java


示例4: checkRefire

import org.rhq.core.domain.measurement.AvailabilityType; //导入依赖的package包/类
void checkRefire(AlertDefinition def) {
    if (log.isDebugEnabled())
        log.debug("check def " + def);
    if (!def.getEnabled() || def.getDeleted() || nonZero(def.getRecoveryId())) {
        log.debug("not enabled, deleted, or recovery");
        return;
    }
    Resource resource = def.getResource();
    if (resource == null) {
        log.debug("no resource");
        return;
    }
    AvailabilityType avail = resource.getCurrentAvailability().getAvailabilityType();
    if (avail != AvailabilityType.DOWN) {
        log.debug("not down; ignore");
        return;
    }
    if (hasAlert(def)) {
        log.debug("already alerted on");
        return;
    }
    for (AlertCondition ac : def.getConditions()) {
        checkCondition(ac);
    }
}
 
开发者ID:genman,项目名称:rhq-server-plugins,代码行数:26,代码来源:AlertCleanup.java


示例5: checkCondition

import org.rhq.core.domain.measurement.AvailabilityType; //导入依赖的package包/类
public void checkCondition(AlertCondition ac) {
    AlertDefinition def = ac.getAlertDefinition();
    Resource resource = def.getResource();

    if (ac.getCategory() == AVAIL_DURATION || ac.getCategory() == AVAILABILITY) {
        AlertConditionOperator oper = AlertConditionOperator.valueOf(ac.getName());
        if (ignoreCond.contains(oper)) {
            log.debug("not a condition for down " + oper);
            return;
        }
        log.info("fire alert for not up " + resource);

        AvailabilityType avail = resource.getCurrentAvailability().getAvailabilityType();
        long ctime = System.currentTimeMillis();

        String msg = "refired for state " + avail;
        acml.updateUnmatchedLogByAlertConditionId(ac.getId(), ctime, msg);
        alertManager.fireAlert(def.getId());
        log.debug("done");
    }
}
 
开发者ID:genman,项目名称:rhq-server-plugins,代码行数:22,代码来源:AlertCleanup.java


示例6: before

import org.rhq.core.domain.measurement.AvailabilityType; //导入依赖的package包/类
@BeforeMethod
public void before() {
    cleanup = new AlertCleanup(alertManager, acml);

    Resource r = new Resource();
    def = new AlertDefinition();
    def.setId(555);
    def.setEnabled(true);
    def.setDeleted(false);
    def.setResource(r);
    avail = new ResourceAvailability(r, AvailabilityType.DOWN);
    r.setCurrentAvailability(avail);
    AlertCondition condition = new AlertCondition(def, AlertConditionCategory.AVAIL_DURATION);
    condition.setName(AlertConditionOperator.AVAIL_GOES_DOWN.name());
    def.addCondition(condition);
}
 
开发者ID:genman,项目名称:rhq-server-plugins,代码行数:17,代码来源:AlertCleanupTest.java


示例7: getAvailability

import org.rhq.core.domain.measurement.AvailabilityType; //导入依赖的package包/类
@Override
public AvailabilityType getAvailability() {
    InputStream is;
    try {
        is = url.openStream();
        try {
            this.map = parse(IOUtils.toString(is));
        } finally {
            is.close();
        }
    } catch (Exception e) {
        log.warn("cannot parse " + url, e);
        return AvailabilityType.DOWN;
    }
    return AvailabilityType.UP;
}
 
开发者ID:genman,项目名称:rhq-plugins,代码行数:17,代码来源:JobTrackerInfoHtml.java


示例8: getAvailability

import org.rhq.core.domain.measurement.AvailabilityType; //导入依赖的package包/类
/**
 * Returns UP if container is found, and in active state.
 */
public AvailabilityType getAvailability() {
    boolean found = false;
    try {
        List<Map<String, Object>> l = app.getOperatorData();
        int count = 0;
        for (Map<String, Object> op: l) {
            String name  = (String) op.get("name");
            opId = (String) op.get("id");
            if (name.equals(this.name) && instance == count++) {
                this.stats = op;
                String status = (String) stats.get("status");
                if (!ACTIVE.equals(status)) {
                    return AvailabilityType.DOWN;
                }
                found = true;
                break;
            }
        }
    } catch (Exception e) {
        log.warn("operator " + this, e);
        return AvailabilityType.DOWN;
    }
    return found ? AvailabilityType.UP : AvailabilityType.DOWN;
}
 
开发者ID:genman,项目名称:rhq-plugins,代码行数:28,代码来源:OperatorComponent.java


示例9: getAvailability

import org.rhq.core.domain.measurement.AvailabilityType; //导入依赖的package包/类
/**
 * Returns UP if container is found, and in active state.
 */
@Override
public AvailabilityType getAvailability() {
    boolean found = false;
    try {
        List<Map<String, Object>> l = app.getContainerData();
        String fullKey = getFullKey();
        for (Map<String, Object> con: l) {
            String id = (String) con.get("id");
            if (id.equals(fullKey)) {
                this.stats = con;
                String state = (String) stats.get("state");
                if (!ACTIVE.equals(state)) {
                    return AvailabilityType.DOWN;
                }
                found = true;
                break;
            }
        }
    } catch (Exception e) {
        log.warn("container " + this, e);
        return AvailabilityType.DOWN;
    }
    return found ? AvailabilityType.UP : AvailabilityType.DOWN;
}
 
开发者ID:genman,项目名称:rhq-plugins,代码行数:28,代码来源:ContainerComponent.java


示例10: refresh

import org.rhq.core.domain.measurement.AvailabilityType; //导入依赖的package包/类
private void refresh(Configuration conf) throws Exception {
    long start = System.nanoTime();
    ProcessExecutionResults res = callVD(conf);
    String output = res.getCapturedOutput();
    if (res.getExitCode() == null)
        throw new RuntimeException("Process expired");
    int code = res.getExitCode();
    if (code != 0) {
        log.warn("vd failed with output: " + output);
        throw new RuntimeException("Non-zero exit status");
    }
    JSONParser reader = new JSONParser();
    verdad = (Map)reader.parse(output);
    avail = AvailabilityType.UP;

    int hc = output.hashCode();
    if (verdadHash != 0 && verdadHash != hc) {
        log.debug("vd tree changed, request discovery");
        inventoryContext.requestDeferredChildResourcesDiscovery();
    }
    verdadHash = hc;
    elapsed = (int) (System.nanoTime() - start);
}
 
开发者ID:genman,项目名称:rhq-plugins,代码行数:24,代码来源:VerdadComponent.java


示例11: getAvailability

import org.rhq.core.domain.measurement.AvailabilityType; //导入依赖的package包/类
/**
 * Returns UP if the information can be obtained and
 * the metrics file can be read.
 */
@Override
public AvailabilityType getAvailability() {
    try {
        log.debug("probe");
        Service service = SplunkDiscovery.service(config);
        serviceInfo = service.getInfo();
        service.logout();
        /*
        Splunk file rotation makes the metrics file unreadable
        This is Splunk case 117457
        log.debug("tail");
        tail.read();
        */
        log.debug("done");
        return AvailabilityType.UP;
    } catch (Exception e) {
        log.debug("failed checking splunk", e);
        return AvailabilityType.DOWN;
    }
}
 
开发者ID:genman,项目名称:rhq-plugins,代码行数:25,代码来源:SplunkComponent.java


示例12: up

import org.rhq.core.domain.measurement.AvailabilityType; //导入依赖的package包/类
@Test
public void up() throws Exception {
    log.info("testUp");
    sleep = 150;
    assertEquals(AvailabilityType.UP, component.getAvailability());
    MeasurementReport report = getMeasurementReport(component);
    Double rt = getValue(report, "responseTime");
    assertNotNull(rt);
    assertTrue(rt > 100 && rt < 200);
    assertEquals((double)body.length(), getValue(report, "responseSize"));

    assertEquals(42.0, getValue(report, regexApple));
    assertEquals(49.0, getValue(report, regexBanana));
    assertEquals(13.0, ComponentTest.map(report).get("#x-head"));

    // TODO figure out how to test this
    assertEquals("ServletServer_Servlet", component.getVersion());
    component.clearState();
    assertEquals(null, component.getVersion());
    assertEquals(AvailabilityType.UP, component.getAvailability());
}
 
开发者ID:genman,项目名称:rhq-plugins,代码行数:22,代码来源:ServerComponentTest.java


示例13: getAvailability

import org.rhq.core.domain.measurement.AvailabilityType; //导入依赖的package包/类
/**
 * Returns UP if able to obtain one of the defined measurement mib.
 */
@Override
public AvailabilityType getAvailability() {
    Set<MeasurementDefinition> mds = this.definitions;
    if (!mds.isEmpty()) {
        MeasurementDefinition md = mds.iterator().next();
        OID oid = index.getNameRecord(md.getName()).getOid0();
        try {
            Variable variable = snmp.get(oid);
            if (variable.isException())
                return DOWN;
        } catch (IOException e) {
            return DOWN;
        }
    }
    return UP;
}
 
开发者ID:genman,项目名称:rhq-plugins,代码行数:20,代码来源:MibComponent.java


示例14: getAvailability

import org.rhq.core.domain.measurement.AvailabilityType; //导入依赖的package包/类
/**
 * Returns DOWN if the table row no longer exists or can be read.
 */
@Override
public AvailabilityType getAvailability() {
    Set<MeasurementDefinition> mds = this.definitions;
    if (!mds.isEmpty()) {
        MeasurementDefinition md = mds.iterator().next();
        OID oid = oid(md.getName());
        try {
            Variable variable = snmp.get(oid);
            if (variable.isException())
                return DOWN;
        } catch (IOException e) {
            return DOWN;
        }
    }
    return UP;
}
 
开发者ID:genman,项目名称:rhq-plugins,代码行数:20,代码来源:MibTableComponent.java


示例15: getAvailability

import org.rhq.core.domain.measurement.AvailabilityType; //导入依赖的package包/类
@Override
public AvailabilityType getAvailability() {

    final AvailabilityType availability = super.getAvailability();

    if (availability == AvailabilityType.UP && statsObjectName != null) {
        try {
            if (isMBeanAvailable(getStatsBean())) {
                return AvailabilityType.UP;
            } else {
                return AvailabilityType.DOWN;
            }
        } catch (RuntimeException e) {
            if (this.statsBean != null) {
                // Retry by connecting to a new parent connection (this bean might have been connected to by an old
                // provider that's since been recreated).
                this.statsBean = null;
                if (isMBeanAvailable(getStatsBean())) {
                    return AvailabilityType.UP;
                } else {
                    return AvailabilityType.DOWN;
                }
            } else {
                throw e;
            }
        }
    }
    
    return availability;
}
 
开发者ID:rh-messaging,项目名称:Artemis-JON-plugin,代码行数:31,代码来源:ArtemisMBeanResourceComponent.java


示例16: getAvailability

import org.rhq.core.domain.measurement.AvailabilityType; //导入依赖的package包/类
public AvailabilityType getAvailability() {
    if ((connectionProvider) == null || !connectionProvider.isConnected()) {
        try {
            internalStart();
        } catch (Exception e) {
            log.debug("Still unable to reconnect to " + context.getResourceType() + "[" + context.getResourceKey()
                + "] due to error: " + e);
        }
    }

    return ((connectionProvider != null) && connectionProvider.isConnected()) ? AvailabilityType.UP
        : AvailabilityType.DOWN;
}
 
开发者ID:rh-messaging,项目名称:Artemis-JON-plugin,代码行数:14,代码来源:ArtemisServerComponent.java


示例17: doGetAvailability

import org.rhq.core.domain.measurement.AvailabilityType; //导入依赖的package包/类
@Override
protected AvailabilityType doGetAvailability() {
    try {
        getContext().testConnection();
        return AvailabilityType.UP;
    } catch (Exception ex) {
        if (log.isDebugEnabled()) {
            log.debug("Test connection failed ==> availability = DOWN", ex);
        }
        return AvailabilityType.DOWN;
    }
}
 
开发者ID:kszbcss,项目名称:rhq-websphere-plugin,代码行数:13,代码来源:DB2MonitorComponent.java


示例18: getAvailability

import org.rhq.core.domain.measurement.AvailabilityType; //导入依赖的package包/类
@Override
public final AvailabilityType getAvailability() {
       try {
           if (!isConfigured()) {
			log.debug("isConfigured=false => availability == MISSING");
			return AvailabilityType.MISSING;
           } else {
               log.debug("isConfigured=true; continue with checking the runtime state");
           }
       } catch (Exception ex) {
		log.warn("Caught exception thrown by isConfigured => availability == UNKNOWN", ex);
		return AvailabilityType.UNKNOWN;
       }
       return doGetAvailability();
   }
 
开发者ID:kszbcss,项目名称:rhq-websphere-plugin,代码行数:16,代码来源:WebSphereComponent.java


示例19: doGetAvailability

import org.rhq.core.domain.measurement.AvailabilityType; //导入依赖的package包/类
protected AvailabilityType doGetAvailability() {
    if (log.isDebugEnabled()) {
        log.debug("Starting to determine availability of " + jndiName);
    }
    try {
        mbean.getObjectName(true);
        log.debug("MBean found => availability == UP");
        return AvailabilityType.UP;
    } catch (Exception ex) {
        log.debug("MBean not found => availability == DOWN", ex);
        return AvailabilityType.DOWN;
    }
}
 
开发者ID:kszbcss,项目名称:rhq-websphere-plugin,代码行数:14,代码来源:ConnectionFactoryComponent.java


示例20: doGetAvailability

import org.rhq.core.domain.measurement.AvailabilityType; //导入依赖的package包/类
@Override
protected AvailabilityType doGetAvailability() {
    try {
        if (getParent().isActive()) {
            return gatewayLink.isActive() ? AvailabilityType.UP : AvailabilityType.DOWN;
        } else {
            log.debug("Message engine not started ==> availability = UP");
            return AvailabilityType.UP;
        }
    } catch (Exception ex) {
        log.debug("Call to isActive failed ==> availability = DOWN", ex);
        return AvailabilityType.DOWN;
    }
}
 
开发者ID:kszbcss,项目名称:rhq-websphere-plugin,代码行数:15,代码来源:SIBGatewayLinkComponent.java



注:本文中的org.rhq.core.domain.measurement.AvailabilityType类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java TransactionalState类代码示例发布时间:2022-05-23
下一篇:
Java BetterCharacterControl类代码示例发布时间:2022-05-23
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap