当前位置: 首页>>代码示例>>Java>>正文


Java Builder.status方法代码示例

本文整理汇总了Java中org.springframework.boot.actuate.health.Health.Builder.status方法的典型用法代码示例。如果您正苦于以下问题:Java Builder.status方法的具体用法?Java Builder.status怎么用?Java Builder.status使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.springframework.boot.actuate.health.Health.Builder的用法示例。


在下文中一共展示了Builder.status方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: doHealthCheck

import org.springframework.boot.actuate.health.Health.Builder; //导入方法依赖的package包/类
@Override
protected void doHealthCheck(Builder builder) throws Exception {
   	log.info("Test geolocation service health - start.");
	long startTime = System.currentTimeMillis();
	Mentor mentor = mentorRepository.findAll().iterator().next();
	Point point = mentorUtils.getLocationOfMentor(mentor);
	if (point.getLatitude() != 0) {
		builder.withDetail("handle", point.toString()).up();
	} else {
		builder.status("GeocodingError");
	}
	log.info("Test geolocation service health - end. Duration: " + Long.toString(System.currentTimeMillis() - startTime) + "ms");
}
 
开发者ID:sapmentors,项目名称:lemonaid,代码行数:14,代码来源:LocationHealthIndicator.java

示例2: doHealthCheck

import org.springframework.boot.actuate.health.Health.Builder; //导入方法依赖的package包/类
@Override
protected void doHealthCheck(Builder builder) throws Exception {
	if (twitter.isAuthenticated()) {
		builder.withDetail("handle", twitter.getScreenName()).up();
	} else {
		builder.status("NotAuthenticated");
	}
}
 
开发者ID:sapmentors,项目名称:lemonaid,代码行数:9,代码来源:TwitterHealthIndicator.java

示例3: doHealthCheck

import org.springframework.boot.actuate.health.Health.Builder; //导入方法依赖的package包/类
@Override
protected void doHealthCheck(Builder builder) throws Exception
{
    final MBeanServer server = getMBeanServer();

    if (server != null)
    {
        final ObjectName on = new ObjectName("Q2:type=qbean,service=*");
        final Set<ObjectName> names = server.queryNames(on, null);
        final Stream<ObjectName> s = names.stream();

        final long muxInTransitCount = getMuxInTransitCount(server, names);
        final long tmInTransitCount = getTmInTransitCount(server, names);

        builder.withDetail("mux.in-transit", String.valueOf(muxInTransitCount));
        builder.withDetail("tm.in-transit", String.valueOf(tmInTransitCount));
        builder.withDetail("in-transit", String.valueOf(Math.max(muxInTransitCount, tmInTransitCount)));

        if (s.allMatch(name -> getStatus(server, name) == QBean.STARTED))
        {
            builder.up();
        }
        else if (s.anyMatch(name -> getStatus(server, name) == QBean.FAILED))
        {
            long cnt = s.filter(name -> getStatus(server, name) == QBean.FAILED).count();

            Set<String> objs = s.filter(name -> getStatus(server, name) == QBean.FAILED)
                .map(ObjectName::getCanonicalName)
                .collect(Collectors.toSet());

            String failedServices = StringUtils.collectionToCommaDelimitedString(objs);
            builder.withDetail("failed-count", String.valueOf(cnt));
            builder.withDetail("failed-services", failedServices);
            builder.status("failed");
        }
        else if (s.allMatch(name -> getStatus(server, name) == QBean.DESTROYED))
        {
            builder.outOfService();
        }
        else if (s.allMatch(name -> getStatus(server, name) == QBean.STOPPED))
        {
            builder.down();
        }
        else
        {
            builder.unknown();
        }
    }
    else
    {
        builder.unknown();
    }
}
 
开发者ID:vmantek,项目名称:chimera,代码行数:54,代码来源:Q2DeploymentsHealthIndicator.java

示例4: doHealthCheck

import org.springframework.boot.actuate.health.Health.Builder; //导入方法依赖的package包/类
@Override
protected void doHealthCheck(Builder builder) throws Exception {
	builder.status(this.up ? Status.UP : Status.DOWN);
}
 
开发者ID:livelessons-spring,项目名称:building-microservices,代码行数:5,代码来源:ExampleHealthIndicator.java


注:本文中的org.springframework.boot.actuate.health.Health.Builder.status方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。