Also record retain() and release()

This commit is contained in:
Trustin Lee 2013-12-06 13:44:59 +09:00
parent 0ff98c98e2
commit 26fc84529f

View File

@ -36,28 +36,6 @@ final class AdvancedLeakAwareByteBuf extends WrappedByteBuf {
this.leak = leak;
}
@Override
public boolean release() {
boolean deallocated = super.release();
if (deallocated) {
leak.close();
} else {
leak.record();
}
return deallocated;
}
@Override
public boolean release(int decrement) {
boolean deallocated = super.release(decrement);
if (deallocated) {
leak.close();
} else {
leak.record();
}
return deallocated;
}
@Override
public ByteBuf order(ByteOrder endianness) {
leak.record();
@ -704,6 +682,12 @@ final class AdvancedLeakAwareByteBuf extends WrappedByteBuf {
return super.toString(index, length, charset);
}
@Override
public ByteBuf capacity(int newCapacity) {
leak.record();
return super.capacity(newCapacity);
}
@Override
public ByteBuf retain() {
leak.record();
@ -717,8 +701,24 @@ final class AdvancedLeakAwareByteBuf extends WrappedByteBuf {
}
@Override
public ByteBuf capacity(int newCapacity) {
leak.record();
return super.capacity(newCapacity);
public boolean release() {
boolean deallocated = super.release();
if (deallocated) {
leak.close();
} else{
leak.record();
}
return deallocated;
}
@Override
public boolean release(int decrement) {
boolean deallocated = super.release(decrement);
if (deallocated) {
leak.close();
} else {
leak.record();
}
return deallocated;
}
}