Example usage for io.netty.util IllegalReferenceCountException IllegalReferenceCountException

List of usage examples for io.netty.util IllegalReferenceCountException IllegalReferenceCountException

Introduction

In this page you can find the example usage for io.netty.util IllegalReferenceCountException IllegalReferenceCountException.

Prototype

public IllegalReferenceCountException(Throwable cause) 

Source Link

Usage

From source file:com.addthis.basis.chars.ReadOnlyUtfBuf.java

License:Apache License

@Override
public ByteBuf content() {
    if (data.refCnt() <= 0) {
        throw new IllegalReferenceCountException(data.refCnt());
    }//from   w ww . j  av a2  s.c o  m
    return data;
}

From source file:org.apache.drill.exec.memory.BoundsChecking.java

License:Apache License

private static void checkIndex(DrillBuf buf, int index, int fieldLength) {
    Preconditions.checkNotNull(buf);/*  w ww  . j a  v  a2 s.  c  om*/
    if (checkAccessible && buf.refCnt() == 0) {
        Formatter formatter = new Formatter().format("%s, refCnt: 0", buf);
        if (BaseAllocator.DEBUG) {
            formatter.format("%n%s", buf.toVerboseString());
        }
        throw new IllegalReferenceCountException(formatter.toString());
    }
    if (fieldLength < 0) {
        throw new IllegalArgumentException(String.format("length: %d (expected: >= 0)", fieldLength));
    }
    if (index < 0 || index > buf.capacity() - fieldLength) {
        Formatter formatter = new Formatter().format("%s, index: %d, length: %d (expected: range(0, %d))", buf,
                index, fieldLength, buf.capacity());
        if (BaseAllocator.DEBUG) {
            formatter.format("%n%s", buf.toVerboseString());
        }
        throw new IndexOutOfBoundsException(formatter.toString());
    }
}

From source file:shi.proto.message.MqttPublishMessage.java

License:Apache License

@Override
public ByteBuf content() {
    final ByteBuf data = (ByteBuf) super.payload();
    if (data.refCnt() <= 0) {
        throw new IllegalReferenceCountException(data.refCnt());
    }//from ww  w.  j  a  va2s. c o  m
    return data;
}