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


Java AbstractHealthIndicator类代码示例

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


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

示例1: taskHealthIndicator

import org.springframework.boot.actuate.health.AbstractHealthIndicator; //导入依赖的package包/类
@Bean
public HealthIndicator taskHealthIndicator() {
    return new AbstractHealthIndicator() {
        @Override
        protected void doHealthCheck(Health.Builder builder) throws Exception {
            if (correctNumberOfInstances()) {
                builder.up();
            } else {
                builder.down();
            }
            builder.withDetail("mesos.resources.count", instanceCount.getCount());
            builder.withDetail("instances", stateRepository.allTaskInfos().size());

            for (Protos.TaskState taskState : Protos.TaskState.values()) {
                Map<String, Protos.TaskStatus> state = getTasksForState(taskState);
                builder.withDetail(taskState.name(), state.size());
            }
        }
    };
}
 
开发者ID:ContainerSolutions,项目名称:mesosframework,代码行数:21,代码来源:TaskActuatorConfiguration.java

示例2: dataSourceHealth

import org.springframework.boot.actuate.health.AbstractHealthIndicator; //导入依赖的package包/类
@Bean
public HealthIndicator dataSourceHealth(DataSource dataSource) {
    if (dataSource instanceof org.apache.tomcat.jdbc.pool.DataSource) {
        org.apache.tomcat.jdbc.pool.DataSource tcDataSource =
                (org.apache.tomcat.jdbc.pool.DataSource) dataSource;
        return new AbstractHealthIndicator() {
            @Override
            protected void doHealthCheck(Health.Builder healthBuilder) throws Exception {
                healthBuilder.up().withDetail("active", tcDataSource.getActive())
                        .withDetail("max_active", tcDataSource.getMaxActive())
                        .withDetail("idle", tcDataSource.getIdle())
                        .withDetail("max_idle", tcDataSource.getMaxIdle())
                        .withDetail("min_idle", tcDataSource.getMinIdle())
                        .withDetail("wait_count", tcDataSource.getWaitCount())
                        .withDetail("max_wait", tcDataSource.getMaxWait());
            }
        };
    }
    return null;
}
 
开发者ID:spring-io,项目名称:sagan,代码行数:21,代码来源:SiteApplication.java

示例3: healthIndicator

import org.springframework.boot.actuate.health.AbstractHealthIndicator; //导入依赖的package包/类
@Bean
public HealthIndicator healthIndicator() {
	return new AbstractHealthIndicator() {
		@Override
		protected void doHealthCheck(Health.Builder builder) throws Exception {
		   builder.up();
		}
	};
}
 
开发者ID:spring-cloud,项目名称:spring-cloud-netflix,代码行数:10,代码来源:EurekaHealthCheckHandlerTests.java


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