org.zodiac.eureka.client.shutdown.EurekaClientShutdown Maven / Gradle / Ivy
package org.zodiac.eureka.client.shutdown;
import javax.validation.constraints.NotNull;
import org.zodiac.core.application.shutdown.AbstractAppShutdown;
import org.zodiac.core.application.shutdown.AppShutdownConfigInfo;
import org.zodiac.eureka.client.EurekaClientService;
public class EurekaClientShutdown extends AbstractAppShutdown {
private EurekaClientService eurekaClientService;
public EurekaClientShutdown(@NotNull AppShutdownConfigInfo shutdownConfigInfo, @NotNull EurekaClientService eurekaClientService) {
super(shutdownConfigInfo);
this.eurekaClientService = eurekaClientService;
}
@Override
public String id() {
return "EurekaClient";
}
@Override
protected boolean isShutdownAvailable() {
return null != eurekaClientService && getShutdownConfigInfo().isEnabled();
}
@Override
protected void doPause() throws InterruptedException {
eurekaClientService.unregisterClient();
}
@Override
protected void doShutdown(Integer delaySeconds) throws InterruptedException {
eurekaClientService.stopClient();
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy