本文整理汇总了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");
}
示例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");
}
}
示例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();
}
}
示例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);
}