public synchronized boolean close(final Duration timeout) throws IllegalArgumentException {
        final String msgPrefix = prepareMillisCheckFailMsgPrefix(timeout, "timeout");
        final long timeoutMs = validateMillisecondDuration(timeout, msgPrefix);
        if (timeoutMs < 0) {
            throw new IllegalArgumentException("Timeout can't be negative.");
        }

        log.debug("Stopping Streams client with timeoutMillis = {} ms.", timeoutMs);

        return close(timeoutMs, false);
    }
Shutdown this {@code KafkaStreams} by signaling all the threads to stop, and then wait up to the timeout for the
threads to join.
A {@code timeout} of Duration.ZERO (or any other zero duration) makes the close operation asynchronous.
Negative-duration timeouts are rejected.

@param timeout  how long to wait for the threads to shutdown
@return {@code true} if all threads were successfully stopped&mdash;{@code false} if the timeout was reached
before all threads stopped
Note that this method must not be called in the {@link StateListener#onChange(KafkaStreams.State, KafkaStreams.State)} callback of {@link StateListener}.
@throws IllegalArgumentException if {@code timeout} can't be represented as {@code long milliseconds}
streams/src/main/java/org/apache/kafka/streams/KafkaStreams.java