Add advanced leakdetection for methods introduced by [#4842]

Motivation:

[#4842] introduced 4 new methods but missed to implement advanced leak detection for these.

Modifications:

Correctly implement advanced leak detection for these methods.

Result:

Advanced leak detection works for all methods as expected.
This commit is contained in:
Norman Maurer 2016-02-14 20:43:22 -08:00
parent f0f0b69d90
commit 74495fd27f
2 changed files with 50 additions and 0 deletions

View File

@ -27,6 +27,7 @@ import java.io.InputStream;
import java.io.OutputStream;
import java.nio.ByteBuffer;
import java.nio.ByteOrder;
import java.nio.channels.FileChannel;
import java.nio.channels.GatheringByteChannel;
import java.nio.channels.ScatteringByteChannel;
import java.nio.charset.Charset;
@ -843,6 +844,30 @@ final class AdvancedLeakAwareByteBuf extends WrappedByteBuf {
return super.writeLongLE(value);
}
@Override
public int getBytes(int index, FileChannel out, long position, int length) throws IOException {
recordLeakNonRefCountingOperation(leak);
return super.getBytes(index, out, position, length);
}
@Override
public int setBytes(int index, FileChannel in, long position, int length) throws IOException {
recordLeakNonRefCountingOperation(leak);
return super.setBytes(index, in, position, length);
}
@Override
public int readBytes(FileChannel out, long position, int length) throws IOException {
recordLeakNonRefCountingOperation(leak);
return super.readBytes(out, position, length);
}
@Override
public int writeBytes(FileChannel in, long position, int length) throws IOException {
recordLeakNonRefCountingOperation(leak);
return super.writeBytes(in, position, length);
}
@Override
public ByteBuf retain() {
leak.record();

View File

@ -24,6 +24,7 @@ import java.io.InputStream;
import java.io.OutputStream;
import java.nio.ByteBuffer;
import java.nio.ByteOrder;
import java.nio.channels.FileChannel;
import java.nio.channels.GatheringByteChannel;
import java.nio.channels.ScatteringByteChannel;
import java.nio.charset.Charset;
@ -903,6 +904,30 @@ final class AdvancedLeakAwareCompositeByteBuf extends WrappedCompositeByteBuf {
return super.consolidate(cIndex, numComponents);
}
@Override
public int getBytes(int index, FileChannel out, long position, int length) throws IOException {
recordLeakNonRefCountingOperation(leak);
return super.getBytes(index, out, position, length);
}
@Override
public int setBytes(int index, FileChannel in, long position, int length) throws IOException {
recordLeakNonRefCountingOperation(leak);
return super.setBytes(index, in, position, length);
}
@Override
public int readBytes(FileChannel out, long position, int length) throws IOException {
recordLeakNonRefCountingOperation(leak);
return super.readBytes(out, position, length);
}
@Override
public int writeBytes(FileChannel in, long position, int length) throws IOException {
recordLeakNonRefCountingOperation(leak);
return super.writeBytes(in, position, length);
}
@Override
public CompositeByteBuf retain() {
leak.record();