class CircuitBreaker {

    private Supplier<CompletableFuture<ClientResponse>> supplier;
    private static AtomicInteger timeoutCount;
    private long lastErrorTime;

    public CircuitBreaker(Supplier<CompletableFuture<ClientResponse>> supplier) {
        this.supplier = supplier;
        this.timeoutCount = new AtomicInteger(0);
    }

    public ClientResponse call() throws TimeoutException, ExecutionException, InterruptedException {<FILL_FUNCTION_BODY>}

    private State checkState() {
        ClientConfig clientConfig = ClientConfig.get();

        boolean isExtrapolatedResetTimeout = Instant.now().toEpochMilli() - lastErrorTime > clientConfig.getResetTimeout();
        boolean isExtrapolatedErrorThreshold = timeoutCount.get() >= clientConfig.getErrorThreshold();
        if (isExtrapolatedErrorThreshold && isExtrapolatedResetTimeout) {
            return State.HALF_OPEN;
        }
        if (timeoutCount.get() >= clientConfig.getErrorThreshold()) {
            return State.OPEN;
        }
        return State.CLOSE;
    }

    private void recordTimeout() {
        timeoutCount.getAndIncrement();
        lastErrorTime = Instant.now().toEpochMilli();
    }
}

        State state = checkState();

        try {
            if (State.OPEN == state) {
                throw new IllegalStateException("circuit is opened.");
            }

            ClientResponse clientResponse = supplier.get().get(ClientConfig.get().getTimeout(), TimeUnit.MILLISECONDS);
            timeoutCount = new AtomicInteger(0);

            return clientResponse;
        } catch (InterruptedException | ExecutionException e) {
            throw e;
        } catch (TimeoutException e) {
            recordTimeout();
            throw e;
        }
    
<no_super_class>