public void snapshotState()

in flink-connector-gcp-pubsub/src/main/java/org/apache/flink/streaming/connectors/gcp/pubsub/PubSubSink.java [202:214]


    public void snapshotState(FunctionSnapshotContext context) throws Exception {
        // before checkpoints make sure all the batched / buffered pubsub messages have actually
        // been sent
        publisher.publishAllOutstanding();

        // At this point, no new messages will be published because this thread has successfully
        // acquired
        // the checkpoint lock. So we just wait for all the pending futures to complete.
        waitForFuturesToComplete();
        if (exceptionAtomicReference.get() != null) {
            throw exceptionAtomicReference.get();
        }
    }