presto-main/src/main/java/io/prestosql/execution/buffer/BroadcastOutputBuffer.java/BroadcastOutputBuffer/checkFlushComplete
class BroadcastOutputBuffer:    private void checkFlushComplete()
    {
        if (state.get() != FLUSHING && state.get() != NO_MORE_BUFFERS) {
            return;
        }

        if (safeGetBuffersSnapshot().stream().allMatch(ClientBuffer::isDestroyed)) {
            destroy();
        }
    }