本文整理匯總了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();
}
示例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();
}
示例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();
}
示例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();
}
示例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();
}