LeakAwareDataBuffer related fixes

Following on 3ebbfa2191 where the local
refCount was removed in favor of using the internal refCount of the
native data buffer, this commit ensures that LeakAwareDataBufferFactory
uses a PooledDataBufferFactory delegate by default.

There are also fixes for test issues with eager allocation uncovered by
these changes in StringDecoder and ResourceDecoder.
This commit is contained in:
Rossen Stoyanchev
2019-04-16 20:51:40 -04:00
parent 0109231d8e
commit 375090bb7c
8 changed files with 62 additions and 121 deletions

View File

@@ -17,7 +17,6 @@ package org.springframework.web.reactive.result.view;
import java.util.function.Supplier;
import io.netty.buffer.PooledByteBufAllocator;
import org.reactivestreams.Publisher;
import org.reactivestreams.Subscription;
import reactor.core.publisher.BaseSubscriber;
@@ -26,7 +25,6 @@ import reactor.core.publisher.Mono;
import org.springframework.core.io.buffer.DataBuffer;
import org.springframework.core.io.buffer.DataBufferFactory;
import org.springframework.core.io.buffer.LeakAwareDataBufferFactory;
import org.springframework.core.io.buffer.NettyDataBufferFactory;
import org.springframework.http.HttpHeaders;
import org.springframework.http.HttpStatus;
import org.springframework.http.ResponseCookie;
@@ -47,8 +45,7 @@ public class ZeroDemandResponse implements ServerHttpResponse {
public ZeroDemandResponse() {
NettyDataBufferFactory delegate = new NettyDataBufferFactory(PooledByteBufAllocator.DEFAULT);
this.bufferFactory = new LeakAwareDataBufferFactory(delegate);
this.bufferFactory = new LeakAwareDataBufferFactory();
}