public boolean startSpilling(CompletableFuture<Void> spilledFuture) {
        if (isReleased() || isSpillStarted()) {
            return false;
        }
        spillStarted = true;
        this.spilledFuture = spilledFuture;
        // increase ref count when buffer is decided to spill.
        buffer.retainBuffer();
        // decrease ref count when buffer spilling is finished.
        spilledFuture.thenRun(buffer::recycleBuffer);
        return true;
    }
@Test
    void testBufferStartSpillingRepeatedly() {
        assertThat(bufferContext.startSpilling(new CompletableFuture<>())).isTrue();
        assertThat(bufferContext.startSpilling(new CompletableFuture<>())).isFalse();
    }