Add ReferenceCounted.touch() / Add missing retain() overrides
- Fixes #2163 - Inspector warnings
This commit is contained in:
parent
928901c593
commit
b887e35ac2
@ -45,6 +45,12 @@ public abstract class AbstractDerivedByteBuf extends AbstractByteBuf {
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public final ByteBuf touch() {
|
||||
unwrap().touch();
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public final boolean release() {
|
||||
return unwrap().release();
|
||||
|
@ -107,6 +107,11 @@ public abstract class AbstractReferenceCountedByteBuf extends AbstractByteBuf {
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public final ByteBuf touch() {
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public final boolean release() {
|
||||
for (;;) {
|
||||
|
@ -716,6 +716,12 @@ final class AdvancedLeakAwareByteBuf extends WrappedByteBuf {
|
||||
return super.retain(increment);
|
||||
}
|
||||
|
||||
@Override
|
||||
public ByteBuf touch() {
|
||||
leak.record();
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ByteBuf capacity(int newCapacity) {
|
||||
leak.record();
|
||||
|
@ -1877,4 +1877,7 @@ public abstract class ByteBuf implements ReferenceCounted, Comparable<ByteBuf> {
|
||||
|
||||
@Override
|
||||
public abstract ByteBuf retain();
|
||||
|
||||
@Override
|
||||
public abstract ByteBuf touch();
|
||||
}
|
||||
|
@ -42,4 +42,7 @@ public interface ByteBufHolder extends ReferenceCounted {
|
||||
|
||||
@Override
|
||||
ByteBufHolder retain(int increment);
|
||||
|
||||
@Override
|
||||
ByteBufHolder touch();
|
||||
}
|
||||
|
@ -68,6 +68,12 @@ public class DefaultByteBufHolder implements ByteBufHolder {
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ByteBufHolder touch() {
|
||||
data.touch();
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean release() {
|
||||
return data.release();
|
||||
|
@ -831,6 +831,11 @@ public final class EmptyByteBuf extends ByteBuf {
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ByteBuf touch() {
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean release() {
|
||||
return false;
|
||||
|
@ -29,6 +29,11 @@ final class SimpleLeakAwareByteBuf extends WrappedByteBuf {
|
||||
this.leak = leak;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ByteBuf touch() {
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean release() {
|
||||
boolean deallocated = super.release();
|
||||
|
@ -814,6 +814,12 @@ public final class SwappedByteBuf extends ByteBuf {
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ByteBuf touch() {
|
||||
buf.touch();
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean release() {
|
||||
return buf.release();
|
||||
@ -847,6 +853,6 @@ public final class SwappedByteBuf extends ByteBuf {
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "Swapped(" + buf.toString() + ')';
|
||||
return "Swapped(" + buf + ')';
|
||||
}
|
||||
}
|
||||
|
@ -75,6 +75,11 @@ final class UnreleasableByteBuf extends WrappedByteBuf {
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ByteBuf touch() {
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean release() {
|
||||
return false;
|
||||
|
@ -799,6 +799,12 @@ public class WrappedByteBuf extends ByteBuf {
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ByteBuf touch() {
|
||||
buf.touch();
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isReadable(int size) {
|
||||
return buf.isReadable(size);
|
||||
|
@ -49,6 +49,11 @@ final class ComposedLastHttpContent implements LastHttpContent {
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public LastHttpContent touch() {
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public LastHttpContent duplicate() {
|
||||
return copy();
|
||||
|
@ -72,6 +72,12 @@ public class DefaultFullHttpRequest extends DefaultHttpRequest implements FullHt
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public FullHttpRequest touch() {
|
||||
content.touch();
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean release() {
|
||||
return content.release();
|
||||
|
@ -75,6 +75,12 @@ public class DefaultFullHttpResponse extends DefaultHttpResponse implements Full
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public FullHttpResponse touch() {
|
||||
content.touch();
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean release() {
|
||||
return content.release();
|
||||
|
@ -67,6 +67,12 @@ public class DefaultHttpContent extends DefaultHttpObject implements HttpContent
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public HttpContent touch() {
|
||||
content.touch();
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean release() {
|
||||
return content.release();
|
||||
|
@ -69,6 +69,12 @@ public class DefaultLastHttpContent extends DefaultHttpContent implements LastHt
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public LastHttpContent touch() {
|
||||
super.touch();
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public HttpHeaders trailingHeaders() {
|
||||
return trailingHeaders;
|
||||
|
@ -29,6 +29,9 @@ public interface FullHttpMessage extends HttpMessage, LastHttpContent {
|
||||
@Override
|
||||
FullHttpMessage retain();
|
||||
|
||||
@Override
|
||||
FullHttpMessage touch();
|
||||
|
||||
@Override
|
||||
FullHttpMessage duplicate();
|
||||
}
|
||||
|
@ -29,6 +29,9 @@ public interface FullHttpRequest extends HttpRequest, FullHttpMessage {
|
||||
@Override
|
||||
FullHttpRequest retain();
|
||||
|
||||
@Override
|
||||
FullHttpRequest touch();
|
||||
|
||||
@Override
|
||||
FullHttpRequest duplicate();
|
||||
|
||||
|
@ -29,6 +29,9 @@ public interface FullHttpResponse extends HttpResponse, FullHttpMessage {
|
||||
@Override
|
||||
FullHttpResponse retain();
|
||||
|
||||
@Override
|
||||
FullHttpResponse touch();
|
||||
|
||||
@Override
|
||||
FullHttpResponse duplicate();
|
||||
|
||||
|
@ -38,4 +38,7 @@ public interface HttpContent extends HttpObject, ByteBufHolder {
|
||||
|
||||
@Override
|
||||
HttpContent retain(int increment);
|
||||
|
||||
@Override
|
||||
HttpContent touch();
|
||||
}
|
||||
|
@ -74,6 +74,11 @@ public interface LastHttpContent extends HttpContent {
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public LastHttpContent touch() {
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean release() {
|
||||
return false;
|
||||
@ -101,6 +106,9 @@ public interface LastHttpContent extends HttpContent {
|
||||
@Override
|
||||
LastHttpContent retain();
|
||||
|
||||
@Override
|
||||
LastHttpContent touch();
|
||||
|
||||
@Override
|
||||
LastHttpContent duplicate();
|
||||
}
|
||||
|
@ -396,4 +396,9 @@ public abstract class AbstractDiskHttpData extends AbstractHttpData {
|
||||
public File getFile() throws IOException {
|
||||
return file;
|
||||
}
|
||||
|
||||
@Override
|
||||
public HttpData touch() {
|
||||
return this;
|
||||
}
|
||||
}
|
||||
|
@ -130,4 +130,7 @@ public abstract class AbstractHttpData extends AbstractReferenceCounted implemen
|
||||
super.retain(increment);
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public abstract HttpData touch();
|
||||
}
|
||||
|
@ -257,4 +257,12 @@ public abstract class AbstractMemoryHttpData extends AbstractHttpData {
|
||||
public File getFile() throws IOException {
|
||||
throw new IOException("Not represented by a file");
|
||||
}
|
||||
|
||||
@Override
|
||||
public HttpData touch() {
|
||||
if (byteBuf != null) {
|
||||
byteBuf.touch();
|
||||
}
|
||||
return this;
|
||||
}
|
||||
}
|
||||
|
@ -42,4 +42,7 @@ public interface Attribute extends HttpData {
|
||||
|
||||
@Override
|
||||
Attribute retain(int increment);
|
||||
|
||||
@Override
|
||||
Attribute touch();
|
||||
}
|
||||
|
@ -122,7 +122,7 @@ public class DiskAttribute extends AbstractDiskHttpData implements Attribute {
|
||||
try {
|
||||
return getName() + '=' + getValue();
|
||||
} catch (IOException e) {
|
||||
return getName() + "=IoException";
|
||||
return getName() + '=' + e;
|
||||
}
|
||||
}
|
||||
|
||||
@ -192,4 +192,10 @@ public class DiskAttribute extends AbstractDiskHttpData implements Attribute {
|
||||
super.retain();
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Attribute touch() {
|
||||
super.touch();
|
||||
return this;
|
||||
}
|
||||
}
|
||||
|
@ -211,4 +211,10 @@ public class DiskFileUpload extends AbstractDiskHttpData implements FileUpload {
|
||||
super.retain();
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public FileUpload touch() {
|
||||
super.touch();
|
||||
return this;
|
||||
}
|
||||
}
|
||||
|
@ -67,4 +67,7 @@ public interface FileUpload extends HttpData {
|
||||
|
||||
@Override
|
||||
FileUpload retain(int increment);
|
||||
|
||||
@Override
|
||||
FileUpload touch();
|
||||
}
|
||||
|
@ -208,4 +208,7 @@ public interface HttpData extends InterfaceHttpData, ByteBufHolder {
|
||||
|
||||
@Override
|
||||
HttpData retain(int increment);
|
||||
|
||||
@Override
|
||||
HttpData touch();
|
||||
}
|
||||
|
@ -1161,6 +1161,7 @@ public class HttpPostRequestEncoder implements ChunkedInput<HttpContent> {
|
||||
|
||||
private static final class WrappedFullHttpRequest extends WrappedHttpRequest implements FullHttpRequest {
|
||||
private final HttpContent content;
|
||||
|
||||
private WrappedFullHttpRequest(HttpRequest request, HttpContent content) {
|
||||
super(request);
|
||||
this.content = content;
|
||||
@ -1214,6 +1215,12 @@ public class HttpPostRequestEncoder implements ChunkedInput<HttpContent> {
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public FullHttpRequest touch() {
|
||||
content.touch();
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ByteBuf content() {
|
||||
return content.content();
|
||||
|
@ -35,4 +35,13 @@ public interface InterfaceHttpData extends Comparable<InterfaceHttpData>, Refere
|
||||
* @return The HttpDataType
|
||||
*/
|
||||
HttpDataType getHttpDataType();
|
||||
|
||||
@Override
|
||||
InterfaceHttpData retain();
|
||||
|
||||
@Override
|
||||
InterfaceHttpData retain(int increment);
|
||||
|
||||
@Override
|
||||
InterfaceHttpData touch();
|
||||
}
|
||||
|
@ -125,4 +125,28 @@ final class InternalAttribute extends AbstractReferenceCounted implements Interf
|
||||
protected void deallocate() {
|
||||
// Do nothing
|
||||
}
|
||||
|
||||
@Override
|
||||
public InterfaceHttpData retain() {
|
||||
for (ByteBuf buf: value) {
|
||||
buf.retain();
|
||||
}
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public InterfaceHttpData retain(int increment) {
|
||||
for (ByteBuf buf: value) {
|
||||
buf.retain(increment);
|
||||
}
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public InterfaceHttpData touch() {
|
||||
for (ByteBuf buf: value) {
|
||||
buf.touch();
|
||||
}
|
||||
return this;
|
||||
}
|
||||
}
|
||||
|
@ -153,4 +153,10 @@ public class MemoryAttribute extends AbstractMemoryHttpData implements Attribute
|
||||
super.retain(increment);
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Attribute touch() {
|
||||
super.touch();
|
||||
return this;
|
||||
}
|
||||
}
|
||||
|
@ -171,4 +171,10 @@ public class MemoryFileUpload extends AbstractMemoryHttpData implements FileUplo
|
||||
super.retain(increment);
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public FileUpload touch() {
|
||||
super.touch();
|
||||
return this;
|
||||
}
|
||||
}
|
||||
|
@ -54,7 +54,7 @@ public class MixedAttribute implements Attribute {
|
||||
// revert to Memory mode
|
||||
try {
|
||||
attribute = new MemoryAttribute(name, value, charset);
|
||||
} catch (IOException e1) {
|
||||
} catch (IOException ignore) {
|
||||
throw new IllegalArgumentException(e);
|
||||
}
|
||||
}
|
||||
@ -221,7 +221,7 @@ public class MixedAttribute implements Attribute {
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "Mixed: " + attribute.toString();
|
||||
return "Mixed: " + attribute;
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -279,6 +279,12 @@ public class MixedAttribute implements Attribute {
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Attribute touch() {
|
||||
attribute.touch();
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean release() {
|
||||
return attribute.release();
|
||||
|
@ -265,7 +265,7 @@ public class MixedFileUpload implements FileUpload {
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "Mixed: " + fileUpload.toString();
|
||||
return "Mixed: " + fileUpload;
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -310,6 +310,12 @@ public class MixedFileUpload implements FileUpload {
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public FileUpload touch() {
|
||||
fileUpload.touch();
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean release() {
|
||||
return fileUpload.release();
|
||||
|
@ -75,4 +75,10 @@ public class BinaryWebSocketFrame extends WebSocketFrame {
|
||||
super.retain(increment);
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public BinaryWebSocketFrame touch() {
|
||||
super.touch();
|
||||
return this;
|
||||
}
|
||||
}
|
||||
|
@ -159,4 +159,10 @@ public class CloseWebSocketFrame extends WebSocketFrame {
|
||||
super.retain(increment);
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public CloseWebSocketFrame touch() {
|
||||
super.touch();
|
||||
return this;
|
||||
}
|
||||
}
|
||||
|
@ -140,4 +140,10 @@ public class ContinuationWebSocketFrame extends WebSocketFrame {
|
||||
super.retain(increment);
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ContinuationWebSocketFrame touch() {
|
||||
super.touch();
|
||||
return this;
|
||||
}
|
||||
}
|
||||
|
@ -75,4 +75,10 @@ public class PingWebSocketFrame extends WebSocketFrame {
|
||||
super.retain(increment);
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public PingWebSocketFrame touch() {
|
||||
super.touch();
|
||||
return this;
|
||||
}
|
||||
}
|
||||
|
@ -75,4 +75,10 @@ public class PongWebSocketFrame extends WebSocketFrame {
|
||||
super.retain(increment);
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public PongWebSocketFrame touch() {
|
||||
super.touch();
|
||||
return this;
|
||||
}
|
||||
}
|
||||
|
@ -115,4 +115,10 @@ public class TextWebSocketFrame extends WebSocketFrame {
|
||||
super.retain(increment);
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public TextWebSocketFrame touch() {
|
||||
super.touch();
|
||||
return this;
|
||||
}
|
||||
}
|
||||
|
@ -68,7 +68,7 @@ public abstract class WebSocketFrame extends DefaultByteBufHolder {
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return StringUtil.simpleClassName(this) + "(data: " + content().toString() + ')';
|
||||
return StringUtil.simpleClassName(this) + "(data: " + content() + ')';
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -82,4 +82,10 @@ public abstract class WebSocketFrame extends DefaultByteBufHolder {
|
||||
super.retain(increment);
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public WebSocketFrame touch() {
|
||||
super.touch();
|
||||
return this;
|
||||
}
|
||||
}
|
||||
|
@ -109,6 +109,12 @@ public class DefaultSpdyDataFrame extends DefaultSpdyStreamFrame implements Spdy
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public SpdyDataFrame touch() {
|
||||
data.touch();
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean release() {
|
||||
return data.release();
|
||||
|
@ -50,4 +50,7 @@ public interface SpdyDataFrame extends ByteBufHolder, SpdyStreamFrame {
|
||||
|
||||
@Override
|
||||
SpdyDataFrame retain(int increment);
|
||||
|
||||
@Override
|
||||
SpdyDataFrame touch();
|
||||
}
|
||||
|
@ -68,7 +68,7 @@ public class AbstractMemoryHttpDataTest {
|
||||
* @param charset Used charset for data decoding.
|
||||
* @param size Expected data block size.
|
||||
*/
|
||||
protected TestHttpData(String name, Charset charset, long size) {
|
||||
private TestHttpData(String name, Charset charset, long size) {
|
||||
super(name, charset, size);
|
||||
}
|
||||
|
||||
|
@ -44,6 +44,12 @@ public class DefaultLastMemcacheContent extends DefaultMemcacheContent implement
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public LastMemcacheContent touch() {
|
||||
super.touch();
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public LastMemcacheContent copy() {
|
||||
return new DefaultLastMemcacheContent(content().copy());
|
||||
@ -53,5 +59,4 @@ public class DefaultLastMemcacheContent extends DefaultMemcacheContent implement
|
||||
public LastMemcacheContent duplicate() {
|
||||
return new DefaultLastMemcacheContent(content().duplicate());
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -67,6 +67,12 @@ public class DefaultMemcacheContent extends AbstractMemcacheObject implements Me
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public MemcacheContent touch() {
|
||||
content.touch();
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean release() {
|
||||
return content.release();
|
||||
@ -82,5 +88,4 @@ public class DefaultMemcacheContent extends AbstractMemcacheObject implements Me
|
||||
return StringUtil.simpleClassName(this) +
|
||||
"(data: " + content() + ", getDecoderResult: " + getDecoderResult() + ')';
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -31,6 +31,8 @@ public interface FullMemcacheMessage extends MemcacheMessage, LastMemcacheConten
|
||||
FullMemcacheMessage retain();
|
||||
|
||||
@Override
|
||||
FullMemcacheMessage duplicate();
|
||||
FullMemcacheMessage touch();
|
||||
|
||||
@Override
|
||||
FullMemcacheMessage duplicate();
|
||||
}
|
||||
|
@ -45,6 +45,11 @@ public interface LastMemcacheContent extends MemcacheContent {
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public LastMemcacheContent touch() {
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public LastMemcacheContent duplicate() {
|
||||
return this;
|
||||
@ -90,6 +95,9 @@ public interface LastMemcacheContent extends MemcacheContent {
|
||||
@Override
|
||||
LastMemcacheContent retain();
|
||||
|
||||
@Override
|
||||
LastMemcacheContent touch();
|
||||
|
||||
@Override
|
||||
LastMemcacheContent duplicate();
|
||||
}
|
||||
|
@ -40,4 +40,6 @@ public interface MemcacheContent extends MemcacheObject, ByteBufHolder {
|
||||
@Override
|
||||
MemcacheContent retain(int increment);
|
||||
|
||||
@Override
|
||||
MemcacheContent touch();
|
||||
}
|
||||
|
@ -34,4 +34,6 @@ public interface MemcacheMessage extends MemcacheObject, ReferenceCounted {
|
||||
@Override
|
||||
MemcacheMessage retain(int increment);
|
||||
|
||||
@Override
|
||||
MemcacheMessage touch();
|
||||
}
|
||||
|
@ -107,4 +107,12 @@ public abstract class AbstractBinaryMemcacheMessage<H extends BinaryMemcacheMess
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public BinaryMemcacheMessage<H> touch() {
|
||||
if (extras != null) {
|
||||
extras.touch();
|
||||
}
|
||||
return this;
|
||||
}
|
||||
}
|
||||
|
@ -64,4 +64,6 @@ public interface BinaryMemcacheMessage<H extends BinaryMemcacheMessageHeader> ex
|
||||
@Override
|
||||
BinaryMemcacheMessage<H> retain(int increment);
|
||||
|
||||
@Override
|
||||
BinaryMemcacheMessage<H> touch();
|
||||
}
|
||||
|
@ -28,4 +28,12 @@ public interface BinaryMemcacheRequest extends BinaryMemcacheMessage<BinaryMemca
|
||||
@Override
|
||||
BinaryMemcacheRequestHeader getHeader();
|
||||
|
||||
@Override
|
||||
BinaryMemcacheRequest retain();
|
||||
|
||||
@Override
|
||||
BinaryMemcacheRequest retain(int increment);
|
||||
|
||||
@Override
|
||||
BinaryMemcacheRequest touch();
|
||||
}
|
||||
|
@ -28,4 +28,12 @@ public interface BinaryMemcacheResponse extends BinaryMemcacheMessage<BinaryMemc
|
||||
@Override
|
||||
BinaryMemcacheResponseHeader getHeader();
|
||||
|
||||
@Override
|
||||
BinaryMemcacheResponse retain();
|
||||
|
||||
@Override
|
||||
BinaryMemcacheResponse retain(int increment);
|
||||
|
||||
@Override
|
||||
BinaryMemcacheResponse touch();
|
||||
}
|
||||
|
@ -16,7 +16,6 @@
|
||||
package io.netty.handler.codec.memcache.binary;
|
||||
|
||||
import io.netty.buffer.ByteBuf;
|
||||
import io.netty.buffer.Unpooled;
|
||||
|
||||
/**
|
||||
* The default implementation of the {@link BinaryMemcacheRequest}.
|
||||
@ -64,4 +63,21 @@ public class DefaultBinaryMemcacheRequest extends AbstractBinaryMemcacheMessage<
|
||||
super(header, key, extras);
|
||||
}
|
||||
|
||||
@Override
|
||||
public BinaryMemcacheRequest retain() {
|
||||
super.retain();
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public BinaryMemcacheRequest retain(int increment) {
|
||||
super.retain(increment);
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public BinaryMemcacheRequest touch() {
|
||||
super.touch();
|
||||
return this;
|
||||
}
|
||||
}
|
||||
|
@ -16,7 +16,6 @@
|
||||
package io.netty.handler.codec.memcache.binary;
|
||||
|
||||
import io.netty.buffer.ByteBuf;
|
||||
import io.netty.buffer.Unpooled;
|
||||
|
||||
/**
|
||||
* The default implementation of the {@link BinaryMemcacheResponse}.
|
||||
@ -64,4 +63,21 @@ public class DefaultBinaryMemcacheResponse extends AbstractBinaryMemcacheMessage
|
||||
super(header, key, extras);
|
||||
}
|
||||
|
||||
@Override
|
||||
public BinaryMemcacheResponse retain() {
|
||||
super.retain();
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public BinaryMemcacheResponse retain(int increment) {
|
||||
super.retain(increment);
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public BinaryMemcacheResponse touch() {
|
||||
super.touch();
|
||||
return this;
|
||||
}
|
||||
}
|
||||
|
@ -77,6 +77,12 @@ public class DefaultFullBinaryMemcacheRequest extends DefaultBinaryMemcacheReque
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public FullBinaryMemcacheRequest touch() {
|
||||
content.touch();
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean release() {
|
||||
return content.release();
|
||||
@ -96,5 +102,4 @@ public class DefaultFullBinaryMemcacheRequest extends DefaultBinaryMemcacheReque
|
||||
public FullBinaryMemcacheRequest duplicate() {
|
||||
return new DefaultFullBinaryMemcacheRequest(getHeader(), getKey(), getExtras(), content().duplicate());
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -77,6 +77,12 @@ public class DefaultFullBinaryMemcacheResponse extends DefaultBinaryMemcacheResp
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public FullBinaryMemcacheResponse touch() {
|
||||
content.touch();
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean release() {
|
||||
return content.release();
|
||||
@ -96,5 +102,4 @@ public class DefaultFullBinaryMemcacheResponse extends DefaultBinaryMemcacheResp
|
||||
public FullBinaryMemcacheResponse duplicate() {
|
||||
return new DefaultFullBinaryMemcacheResponse(getHeader(), getKey(), getExtras(), content().duplicate());
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -32,6 +32,8 @@ public interface FullBinaryMemcacheRequest extends BinaryMemcacheRequest, FullMe
|
||||
FullBinaryMemcacheRequest retain();
|
||||
|
||||
@Override
|
||||
FullBinaryMemcacheRequest duplicate();
|
||||
FullBinaryMemcacheRequest touch();
|
||||
|
||||
@Override
|
||||
FullBinaryMemcacheRequest duplicate();
|
||||
}
|
||||
|
@ -32,6 +32,8 @@ public interface FullBinaryMemcacheResponse extends BinaryMemcacheResponse, Full
|
||||
FullBinaryMemcacheResponse retain();
|
||||
|
||||
@Override
|
||||
FullBinaryMemcacheResponse duplicate();
|
||||
FullBinaryMemcacheResponse touch();
|
||||
|
||||
@Override
|
||||
FullBinaryMemcacheResponse duplicate();
|
||||
}
|
||||
|
@ -972,6 +972,12 @@ final class ReplayingDecoderBuffer extends ByteBuf {
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ByteBuf touch() {
|
||||
buffer.touch();
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean release() {
|
||||
reject();
|
||||
|
@ -59,6 +59,18 @@ public final class ReferenceCountUtil {
|
||||
return msg;
|
||||
}
|
||||
|
||||
/**
|
||||
* Tries to call {@link ReferenceCounted#touch()} if the specified message implements {@link ReferenceCounted}.
|
||||
* If the specified message doesn't implement {@link ReferenceCounted}, this method does nothing.
|
||||
*/
|
||||
@SuppressWarnings("unchecked")
|
||||
public static <T> T touch(T msg) {
|
||||
if (msg instanceof ReferenceCounted) {
|
||||
return (T) ((ReferenceCounted) msg).touch();
|
||||
}
|
||||
return msg;
|
||||
}
|
||||
|
||||
/**
|
||||
* Try to call {@link ReferenceCounted#release()} if the specified message implements {@link ReferenceCounted}.
|
||||
* If the specified message doesn't implement {@link ReferenceCounted}, this method does nothing.
|
||||
|
@ -45,6 +45,13 @@ public interface ReferenceCounted {
|
||||
*/
|
||||
ReferenceCounted retain(int increment);
|
||||
|
||||
/**
|
||||
* Records the current access location of this object for debugging purposes.
|
||||
* If this object is determined to be leaked, the information recorded by this operation will be provided to you
|
||||
* via {@link ResourceLeakDetector}.
|
||||
*/
|
||||
ReferenceCounted touch();
|
||||
|
||||
/**
|
||||
* Decreases the reference count by {@code 1} and deallocates this object if the reference count reaches at
|
||||
* {@code 0}.
|
||||
|
@ -111,11 +111,7 @@ public final class SctpMessage extends DefaultByteBufHolder {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!content().equals(sctpFrame.content())) {
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
return content().equals(sctpFrame.content());
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -156,6 +152,12 @@ public final class SctpMessage extends DefaultByteBufHolder {
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public SctpMessage touch() {
|
||||
super.touch();
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
if (refCnt() == 0) {
|
||||
|
@ -52,4 +52,10 @@ public final class UdtMessage extends DefaultByteBufHolder {
|
||||
super.retain(increment);
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public UdtMessage touch() {
|
||||
super.touch();
|
||||
return this;
|
||||
}
|
||||
}
|
||||
|
@ -102,6 +102,12 @@ public class DefaultAddressedEnvelope<M, A extends SocketAddress> implements Add
|
||||
return ReferenceCountUtil.release(message, decrement);
|
||||
}
|
||||
|
||||
@Override
|
||||
public AddressedEnvelope<M, A> touch() {
|
||||
ReferenceCountUtil.touch(message);
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
if (sender != null) {
|
||||
|
@ -104,4 +104,21 @@ public class DefaultFileRegion extends AbstractReferenceCounted implements FileR
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public FileRegion retain() {
|
||||
super.retain();
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public FileRegion retain(int increment) {
|
||||
super.retain(increment);
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public FileRegion touch() {
|
||||
return this;
|
||||
}
|
||||
}
|
||||
|
@ -80,4 +80,13 @@ public interface FileRegion extends ReferenceCounted {
|
||||
* byte of the region transferred.
|
||||
*/
|
||||
long transferTo(WritableByteChannel target, long position) throws IOException;
|
||||
|
||||
@Override
|
||||
FileRegion retain();
|
||||
|
||||
@Override
|
||||
FileRegion retain(int increment);
|
||||
|
||||
@Override
|
||||
FileRegion touch();
|
||||
}
|
||||
|
@ -63,4 +63,10 @@ public final class DatagramPacket
|
||||
super.retain(increment);
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public DatagramPacket touch() {
|
||||
super.touch();
|
||||
return this;
|
||||
}
|
||||
}
|
||||
|
@ -105,6 +105,11 @@ public class DefaultChannelPipelineTest {
|
||||
protected void deallocate() {
|
||||
free.countDown();
|
||||
}
|
||||
|
||||
@Override
|
||||
public ReferenceCounted touch() {
|
||||
return this;
|
||||
}
|
||||
};
|
||||
|
||||
StringInboundHandler handler = new StringInboundHandler();
|
||||
|
Loading…
Reference in New Issue
Block a user