Netflix / netflix-commons

Common utilities for Netflix OSS projects
Apache License 2.0
162 stars 81 forks source link

IllegalStateException thrown when ribbonRestClient gets destroyed #22

Open akefirad opened 7 years ago

akefirad commented 7 years ago

It's been discussed at spring-cloud-commons but I couldn't find any history here.
Does it help to add a simple check at least to get fewer exceptions:


public static boolean isShutdownInProgress() {
    try {
        Thread thread = new Thread();    
        Runtime.getRuntime().addShutdownHook(thread);
        Runtime.getRuntime().removeShutdownHook(thread);
        return false;
    } catch (IllegalStateException e) {
        return true;
    }
}