public boolean await(long timeout, TimeUnit unit) throws InterruptedException {
        final long start = clock.milliseconds();
        final long end = start + unit.toMillis(timeout);
        if (!startLatch.await(end - start, TimeUnit.MILLISECONDS)) {
            return false;
        }
        if (!stopLatch.await(end - clock.milliseconds(), TimeUnit.MILLISECONDS)) {
            return false;
        }

        if (dependents != null) {
            for (StartAndStopLatch dependent : dependents) {
                if (!dependent.await(end - clock.milliseconds(), TimeUnit.MILLISECONDS)) {
                    return false;
                }
            }
        }
        if (uponCompletion != null) {
            uponCompletion.accept(this);
        }
        return true;
    }
Causes the current thread to wait until the latch has counted down the starts and
stops to zero, unless the thread is {@linkplain Thread#interrupt interrupted},
or the specified waiting time elapses.

<p>If the current counts are zero then this method returns immediately
with the value {@code true}.

<p>If the current count is greater than zero then the current
thread becomes disabled for thread scheduling purposes and lies
dormant until one of three things happen:
<ul>
<li>The counts reach zero due to invocations of the {@link #recordStart()} and
{@link #recordStop()} methods; or
<li>Some other thread {@linkplain Thread#interrupt interrupts}
the current thread; or
<li>The specified waiting time elapses.
</ul>

<p>If the count reaches zero then the method returns with the
value {@code true}.

<p>If the current thread:
<ul>
<li>has its interrupted status set on entry to this method; or
<li>is {@linkplain Thread#interrupt interrupted} while waiting,
</ul>
then {@link InterruptedException} is thrown and the current thread's
interrupted status is cleared.

<p>If the specified waiting time elapses then the value {@code false}
is returned.  If the time is less than or equal to zero, the method
will not wait at all.

@param timeout the maximum time to wait
@param unit    the time unit of the {@code timeout} argument
@return {@code true} if the counts reached zero and {@code false}
        if the waiting time elapsed before the counts reached zero
@throws InterruptedException if the current thread is interrupted
        while waiting
connect/runtime/src/test/java/org/apache/kafka/connect/integration/StartAndStopLatch.java