All Downloads are FREE. Search and download functionalities are using the official Maven repository.

cn.dustlight.jobless.service.health.ProviderChecker Maven / Gradle / Ivy

The newest version!
package cn.dustlight.jobless.service.health;

import lombok.AllArgsConstructor;
import lombok.Getter;
import org.springframework.boot.actuate.health.Health;
import org.springframework.boot.actuate.health.HealthIndicator;
import cn.dustlight.jobless.core.JobHandlerProvider;

@AllArgsConstructor
@Getter
public class ProviderChecker implements HealthIndicator {

    private JobHandlerProvider provider;

    @Override
    public Health health() {
        return (provider == null ?
                Health.down().withDetail("message", "Provider is null.") :
                (provider.isClosed() ?
                        Health.down().withDetail("message", "Provider is closed.") :
                        Health.up())).build();
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy