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

io.quarkus.smallrye.health.runtime.ShutdownReadinessCheck Maven / Gradle / Ivy

There is a newer version: 3.17.0.CR1
Show newest version
package io.quarkus.smallrye.health.runtime;

import jakarta.inject.Singleton;

import org.eclipse.microprofile.health.HealthCheck;
import org.eclipse.microprofile.health.HealthCheckResponse;
import org.eclipse.microprofile.health.Readiness;

@Singleton
@Readiness
public class ShutdownReadinessCheck implements HealthCheck {

    protected static final String GRACEFUL_SHUTDOWN = "Graceful Shutdown";
    private volatile boolean shuttingDown;

    public void shutdown() {
        shuttingDown = true;
    }

    @Override
    public HealthCheckResponse call() {
        if (shuttingDown) {
            return HealthCheckResponse.down(GRACEFUL_SHUTDOWN);
        }
        return HealthCheckResponse.up(GRACEFUL_SHUTDOWN);
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy