當前位置: 首頁>>代碼示例>>Java>>正文


Java Health.up方法代碼示例

本文整理匯總了Java中org.springframework.boot.actuate.health.Health.up方法的典型用法代碼示例。如果您正苦於以下問題:Java Health.up方法的具體用法?Java Health.up怎麽用?Java Health.up使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在org.springframework.boot.actuate.health.Health的用法示例。


在下文中一共展示了Health.up方法的5個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: getHealthBuilder

import org.springframework.boot.actuate.health.Health; //導入方法依賴的package包/類
private Builder getHealthBuilder(VaultHealth vaultHealthResponse) {

		if (!vaultHealthResponse.isInitialized()) {
			return Health.down().withDetail("state", "Vault uninitialized");
		}

		if (vaultHealthResponse.isSealed()) {
			return Health.down().withDetail("state", "Vault sealed");
		}

		if (vaultHealthResponse.isStandby()) {
			return Health.up().withDetail("state", "Vault in standby");
		}

		return Health.up();
	}
 
開發者ID:spring-cloud,項目名稱:spring-cloud-vault,代碼行數:17,代碼來源:VaultHealthIndicator.java

示例2: health

import org.springframework.boot.actuate.health.Health; //導入方法依賴的package包/類
@Override
public Health health() {
    /*
    Perform a series of checks:
    - Servers must be up (0 < delay < 1000 and State == GOOD)
    - Servers must have the latest version
    - Servers must have a valid RCON password (non-null)
     */
    Map<String, Object> details = new LinkedHashMap<>();
    List<GameServer> unresponsive = gameServerService.findUnhealthyServers();
    if (!unresponsive.isEmpty()) {
        details.put("unresponsive", unresponsive.stream()
            .map(GameServer::toString)
            .collect(Collectors.toList()));
    }
    List<GameServer> outdated = gameServerService.findOutdatedServers();
    if (!outdated.isEmpty()) {
        details.put("outdated", outdated.stream()
            .map(GameServer::toString)
            .collect(Collectors.toList()));
    }
    List<GameServer> missingRcon = gameServerService.findServersWithoutRcon();
    if (!missingRcon.isEmpty()) {
        details.put("missingRcon", missingRcon.stream()
            .map(GameServer::toString)
            .collect(Collectors.toList()));
    }
    Health.Builder builder;
    if (details.isEmpty()) {
        builder = Health.up();
        gameServerService.getSummary().forEach(builder::withDetail);
    } else {
        builder = Health.outOfService();
        details.forEach(builder::withDetail);
    }
    return builder.build();
}
 
開發者ID:quanticc,項目名稱:sentry,代碼行數:38,代碼來源:GameServerHealthIndicator.java

示例3: health

import org.springframework.boot.actuate.health.Health; //導入方法依賴的package包/類
@Override
public Health health() {
    int count = 0;
    int ready = 0;
    Map<String, Object> details = new LinkedHashMap<>();
    for (Map.Entry<Bot, IDiscordClient> entry : clientRegistry.getClients().entrySet()) {
        count++;
        Map<String, Object> bot = new LinkedHashMap<>();
        IDiscordClient client = entry.getValue();
        if (client.isReady()) {
            ready++;
            bot.put("status", "UP");
            bot.put("id", client.getOurUser().getStringID());
            bot.put("name", client.getOurUser().getName());
            bot.put("shards", client.getShardCount());
            bot.put("guilds", client.getGuilds().size());
            bot.put("channels", client.getChannels().size());
            bot.put("users", client.getUsers().size());
            bot.put("roles", client.getRoles().size());
        } else if (client.isLoggedIn()) {
            bot.put("status", "OUT_OF_SERVICE");
        } else {
            bot.put("status", "DOWN");
        }
        details.put(entry.getKey().getName(), bot);
    }
    Health.Builder builder = count == 0 ? Health.unknown() : (count == ready ? Health.up() : Health.outOfService());
    details.put("count", count);
    details.put("ready", ready);
    details.forEach(builder::withDetail);
    return builder.build();
}
 
開發者ID:quanticc,項目名稱:sentry,代碼行數:33,代碼來源:BotHealthIndicator.java

示例4: health

import org.springframework.boot.actuate.health.Health; //導入方法依賴的package包/類
/**
 * {@inheritDoc}
 */
@Override
public Health health() {
    // If catalogs are loaded we'll just report up
    final Health.Builder builder = this.catalogsLoaded.get() ? Health.up() : Health.outOfService();

    for (final Map.Entry<String, MetacatCatalogConfig> entry : this.connectorManager.getCatalogs().entrySet()) {
        builder.withDetail(entry.getKey(), entry.getValue().getType());
    }

    return builder.build();
}
 
開發者ID:Netflix,項目名稱:metacat,代碼行數:15,代碼來源:CatalogManager.java

示例5: health

import org.springframework.boot.actuate.health.Health; //導入方法依賴的package包/類
/**
 * {@inheritDoc}
 */
@Override
public Health health() {
    final boolean plugins = this.pluginsLoaded.get();
    final boolean catalogs = this.catalogsLoaded.get();
    final boolean thrift = this.thriftStarted.get();

    final Health.Builder builder = plugins && catalogs && thrift ? Health.up() : Health.outOfService();

    builder.withDetail(PLUGIN_KEY, plugins);
    builder.withDetail(CATALOG_KEY, catalogs);
    builder.withDetail(THRIFT_KEY, thrift);

    return builder.build();
}
 
開發者ID:Netflix,項目名稱:metacat,代碼行數:18,代碼來源:MetacatInitializationService.java


注:本文中的org.springframework.boot.actuate.health.Health.up方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。