Switch to Reactor snapshots and remove workaround
Following the 5.2 M1 release we can switch back to Reactor snapshots and remove the workaround for a fix coming in Reactor Core 3.2.9.
This commit is contained in:
@@ -238,9 +238,10 @@ public class RSocketBufferLeakTests {
|
||||
|
||||
|
||||
/**
|
||||
* Similar {@link org.springframework.core.io.buffer.LeakAwareDataBufferFactory}
|
||||
* but extends {@link NettyDataBufferFactory} rather than rely on
|
||||
* decoration, since {@link PayloadUtils} does instanceof checks.
|
||||
* Unlike {@link org.springframework.core.io.buffer.LeakAwareDataBufferFactory}
|
||||
* this one is an instance of {@link NettyDataBufferFactory} which is necessary
|
||||
* since {@link PayloadUtils} does instanceof checks, and that also allows
|
||||
* intercepting {@link NettyDataBufferFactory#wrap(ByteBuf)}.
|
||||
*/
|
||||
private static class LeakAwareNettyDataBufferFactory extends NettyDataBufferFactory {
|
||||
|
||||
@@ -277,32 +278,33 @@ public class RSocketBufferLeakTests {
|
||||
|
||||
@Override
|
||||
public NettyDataBuffer allocateBuffer() {
|
||||
return (NettyDataBuffer) record(super.allocateBuffer());
|
||||
return (NettyDataBuffer) recordHint(super.allocateBuffer());
|
||||
}
|
||||
|
||||
@Override
|
||||
public NettyDataBuffer allocateBuffer(int initialCapacity) {
|
||||
return (NettyDataBuffer) record(super.allocateBuffer(initialCapacity));
|
||||
return (NettyDataBuffer) recordHint(super.allocateBuffer(initialCapacity));
|
||||
}
|
||||
|
||||
@Override
|
||||
public NettyDataBuffer wrap(ByteBuf byteBuf) {
|
||||
NettyDataBuffer dataBuffer = super.wrap(byteBuf);
|
||||
if (byteBuf != Unpooled.EMPTY_BUFFER) {
|
||||
record(dataBuffer);
|
||||
recordHint(dataBuffer);
|
||||
}
|
||||
return dataBuffer;
|
||||
}
|
||||
|
||||
@Override
|
||||
public DataBuffer join(List<? extends DataBuffer> dataBuffers) {
|
||||
return record(super.join(dataBuffers));
|
||||
return recordHint(super.join(dataBuffers));
|
||||
}
|
||||
|
||||
private DataBuffer record(DataBuffer buffer) {
|
||||
this.created.add(new DataBufferLeakInfo(buffer, new AssertionError(String.format(
|
||||
private DataBuffer recordHint(DataBuffer buffer) {
|
||||
AssertionError error = new AssertionError(String.format(
|
||||
"DataBuffer leak: {%s} {%s} not released.%nStacktrace at buffer creation: ", buffer,
|
||||
ObjectUtils.getIdentityHexString(((NettyDataBuffer) buffer).getNativeBuffer())))));
|
||||
ObjectUtils.getIdentityHexString(((NettyDataBuffer) buffer).getNativeBuffer())));
|
||||
this.created.add(new DataBufferLeakInfo(buffer, error));
|
||||
return buffer;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user