presto-main/src/main/java/io/prestosql/operator/exchange/LocalExchangeSource.java/LocalExchangeSource/finish
class LocalExchangeSource:    public void finish()
    {
        checkNotHoldsLock();

        SettableFuture<?> notEmptyFuture;
        synchronized (lock) {
            if (finishing) {
                return;
            }
            finishing = true;

            notEmptyFuture = this.notEmptyFuture;
            this.notEmptyFuture = NOT_EMPTY;
        }

        // notify readers outside of lock since this may result in a callback
        notEmptyFuture.set(null);

        checkFinished();
    }