Merge branch '5.1.x'

This commit is contained in:
Rossen Stoyanchev 2019-04-03 16:29:28 -04:00
commit 2c28e4e972
3 changed files with 6 additions and 12 deletions

View File

@ -40,7 +40,7 @@ ext {
log4jVersion = "2.11.2"
nettyVersion = "4.1.34.Final"
quartzVersion = "2.3.0"
reactorVersion = "Californium-SR6"
reactorVersion = "Californium-BUILD-SNAPSHOT"
rxjavaVersion = "1.3.8"
rxjavaAdapterVersion = "1.2.1"
rxjava2Version = "2.2.8"

View File

@ -57,12 +57,6 @@ public abstract class DataBufferUtils {
private static final Consumer<DataBuffer> RELEASE_CONSUMER = DataBufferUtils::release;
/**
* Workaround to disable use of pooled buffers:
* https://github.com/reactor/reactor-core/issues/1634.
*/
private static final DataBufferFactory defaultDataBufferFactory = new DefaultDataBufferFactory();
//---------------------------------------------------------------------
// Reading
@ -141,14 +135,12 @@ public abstract class DataBufferUtils {
Assert.isTrue(position >= 0, "'position' must be >= 0");
Assert.isTrue(bufferSize > 0, "'bufferSize' must be > 0");
DataBufferFactory bufferFactoryToUse = defaultDataBufferFactory;
Flux<DataBuffer> flux = Flux.using(channelSupplier,
channel -> Flux.create(sink -> {
ReadCompletionHandler handler =
new ReadCompletionHandler(channel, sink, position, bufferFactoryToUse, bufferSize);
new ReadCompletionHandler(channel, sink, position, bufferFactory, bufferSize);
sink.onDispose(handler::dispose);
DataBuffer dataBuffer = bufferFactoryToUse.allocateBuffer(bufferSize);
DataBuffer dataBuffer = bufferFactory.allocateBuffer(bufferSize);
ByteBuffer byteBuffer = dataBuffer.asByteBuffer(0, bufferSize);
channel.read(byteBuffer, position, dataBuffer, handler);
}),

View File

@ -49,7 +49,9 @@ import org.springframework.core.io.Resource;
import org.springframework.core.io.buffer.support.DataBufferTestUtils;
import static org.junit.Assert.*;
import static org.mockito.ArgumentMatchers.any;
import static org.mockito.ArgumentMatchers.*;
import static org.mockito.Mockito.anyLong;
import static org.mockito.Mockito.isA;
import static org.mockito.Mockito.*;
/**