@Override
    public CompletableFuture<Void> whenComplete() {
        final StreamMessage<StreamMessage<HttpData>> emitter = this.emitter;
        if (emitter != null) {
            return emitter.whenComplete();
        }

        final CompletableFuture<Void> completionFuture = new CompletableFuture<>();
        if (completionFutureUpdater.compareAndSet(this, null, completionFuture)) {
            return completionFuture;
        } else {
            final CompletableFuture<Void> oldFuture = this.completionFuture;
            assert oldFuture != null;
            return oldFuture;
        }
    }
Reactive processor that encodes a stream of {@link BodyPart}s into an HTTP payload.
core/src/main/java/com/linecorp/armeria/common/multipart/MultipartEncoder.java