presto-hive/src/main/java/io/prestosql/plugin/hive/util/AsyncQueue.java/AsyncQueue/signalIfFinishing
class AsyncQueue:    private synchronized void signalIfFinishing()
    {
        if (finishing && borrowerCount == 0) {
            if (elements.size() == 0) {
                completeAsync(executor, notEmptySignal);
                notEmptySignal = SettableFuture.create();
            }
            else if (elements.size() >= targetQueueSize) {
                completeAsync(executor, notFullSignal);
                notFullSignal = SettableFuture.create();
            }
        }
    }