public boolean shutdown()

in remote/src/main/java/com/spotify/metrics/remote/OkRemote.java [109:123]


    public boolean shutdown(long timeout, TimeUnit timeUnit) throws InterruptedException {
        synchronized (this) {
            closed = true;
        }
        Dispatcher dispatcher = client.dispatcher();
        long millis = timeUnit.toMillis(timeout);
        long expirationTime = System.currentTimeMillis() + millis;
        while (dispatcher.queuedCallsCount() != 0 || dispatcher.runningCallsCount() != 0) {
            if (System.currentTimeMillis() > expirationTime) {
                return false;
            }
            Thread.sleep(100);
        }
        return true;
    }