ReferenceCountException -> IllegalReferenceCountException
This commit is contained in:
parent
7eb0f6105d
commit
6d1cd0d0cd
@ -15,7 +15,7 @@
|
||||
*/
|
||||
package io.netty.buffer;
|
||||
|
||||
import io.netty.util.ReferenceCountException;
|
||||
import io.netty.util.IllegalReferenceCountException;
|
||||
import io.netty.util.ResourceLeakDetector;
|
||||
|
||||
import java.io.IOException;
|
||||
@ -1134,7 +1134,7 @@ public abstract class AbstractByteBuf implements ByteBuf {
|
||||
*/
|
||||
protected final void ensureAccessible() {
|
||||
if (refCnt() == 0) {
|
||||
throw new ReferenceCountException(0);
|
||||
throw new IllegalReferenceCountException(0);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -16,7 +16,7 @@
|
||||
|
||||
package io.netty.buffer;
|
||||
|
||||
import io.netty.util.ReferenceCountException;
|
||||
import io.netty.util.IllegalReferenceCountException;
|
||||
import io.netty.util.internal.PlatformDependent;
|
||||
|
||||
import java.util.concurrent.atomic.AtomicIntegerFieldUpdater;
|
||||
@ -74,10 +74,10 @@ public abstract class AbstractReferenceCountedByteBuf extends AbstractByteBuf {
|
||||
for (;;) {
|
||||
int refCnt = this.refCnt;
|
||||
if (refCnt == 0) {
|
||||
throw new ReferenceCountException(0, 1);
|
||||
throw new IllegalReferenceCountException(0, 1);
|
||||
}
|
||||
if (refCnt == Integer.MAX_VALUE) {
|
||||
throw new ReferenceCountException(Integer.MAX_VALUE, 1);
|
||||
throw new IllegalReferenceCountException(Integer.MAX_VALUE, 1);
|
||||
}
|
||||
if (refCntUpdater.compareAndSet(this, refCnt, refCnt + 1)) {
|
||||
break;
|
||||
@ -95,10 +95,10 @@ public abstract class AbstractReferenceCountedByteBuf extends AbstractByteBuf {
|
||||
for (;;) {
|
||||
int refCnt = this.refCnt;
|
||||
if (refCnt == 0) {
|
||||
throw new ReferenceCountException(0, increment);
|
||||
throw new IllegalReferenceCountException(0, increment);
|
||||
}
|
||||
if (refCnt > Integer.MAX_VALUE - increment) {
|
||||
throw new ReferenceCountException(refCnt, increment);
|
||||
throw new IllegalReferenceCountException(refCnt, increment);
|
||||
}
|
||||
if (refCntUpdater.compareAndSet(this, refCnt, refCnt + increment)) {
|
||||
break;
|
||||
@ -112,7 +112,7 @@ public abstract class AbstractReferenceCountedByteBuf extends AbstractByteBuf {
|
||||
for (;;) {
|
||||
int refCnt = this.refCnt;
|
||||
if (refCnt == 0) {
|
||||
throw new ReferenceCountException(0, -1);
|
||||
throw new IllegalReferenceCountException(0, -1);
|
||||
}
|
||||
|
||||
if (refCntUpdater.compareAndSet(this, refCnt, refCnt - 1)) {
|
||||
@ -134,7 +134,7 @@ public abstract class AbstractReferenceCountedByteBuf extends AbstractByteBuf {
|
||||
for (;;) {
|
||||
int refCnt = this.refCnt;
|
||||
if (refCnt < decrement) {
|
||||
throw new ReferenceCountException(refCnt, -decrement);
|
||||
throw new IllegalReferenceCountException(refCnt, -decrement);
|
||||
}
|
||||
|
||||
if (refCntUpdater.compareAndSet(this, refCnt, refCnt - decrement)) {
|
||||
|
@ -15,7 +15,7 @@
|
||||
*/
|
||||
package io.netty.buffer;
|
||||
|
||||
import io.netty.util.ReferenceCountException;
|
||||
import io.netty.util.IllegalReferenceCountException;
|
||||
|
||||
/**
|
||||
* Default implementation of a {@link ByteBufHolder} that holds it's data in a {@link ByteBuf}.
|
||||
@ -35,7 +35,7 @@ public class DefaultByteBufHolder implements ByteBufHolder {
|
||||
@Override
|
||||
public ByteBuf content() {
|
||||
if (data.refCnt() <= 0) {
|
||||
throw new ReferenceCountException(data.refCnt());
|
||||
throw new IllegalReferenceCountException(data.refCnt());
|
||||
}
|
||||
return data;
|
||||
}
|
||||
|
@ -17,7 +17,7 @@ package io.netty.handler.codec.spdy;
|
||||
|
||||
import io.netty.buffer.ByteBuf;
|
||||
import io.netty.buffer.Unpooled;
|
||||
import io.netty.util.ReferenceCountException;
|
||||
import io.netty.util.IllegalReferenceCountException;
|
||||
import io.netty.util.internal.StringUtil;
|
||||
|
||||
/**
|
||||
@ -73,7 +73,7 @@ public class DefaultSpdyDataFrame extends DefaultSpdyStreamFrame implements Spdy
|
||||
@Override
|
||||
public ByteBuf content() {
|
||||
if (data.refCnt() <= 0) {
|
||||
throw new ReferenceCountException(data.refCnt());
|
||||
throw new IllegalReferenceCountException(data.refCnt());
|
||||
}
|
||||
return data;
|
||||
}
|
||||
|
@ -16,7 +16,6 @@
|
||||
package io.netty.handler.codec.frame;
|
||||
|
||||
import io.netty.buffer.ByteBuf;
|
||||
import io.netty.channel.IncompleteFlushException;
|
||||
import io.netty.channel.embedded.EmbeddedChannel;
|
||||
import io.netty.handler.codec.EncoderException;
|
||||
import io.netty.handler.codec.LengthFieldPrepender;
|
||||
|
@ -68,10 +68,10 @@ public abstract class AbstractReferenceCounted implements ReferenceCounted {
|
||||
for (;;) {
|
||||
int refCnt = this.refCnt;
|
||||
if (refCnt == 0) {
|
||||
throw new ReferenceCountException(0, 1);
|
||||
throw new IllegalReferenceCountException(0, 1);
|
||||
}
|
||||
if (refCnt == Integer.MAX_VALUE) {
|
||||
throw new ReferenceCountException(Integer.MAX_VALUE, 1);
|
||||
throw new IllegalReferenceCountException(Integer.MAX_VALUE, 1);
|
||||
}
|
||||
if (refCntUpdater.compareAndSet(this, refCnt, refCnt + 1)) {
|
||||
break;
|
||||
@ -89,10 +89,10 @@ public abstract class AbstractReferenceCounted implements ReferenceCounted {
|
||||
for (;;) {
|
||||
int refCnt = this.refCnt;
|
||||
if (refCnt == 0) {
|
||||
throw new ReferenceCountException(0, 1);
|
||||
throw new IllegalReferenceCountException(0, 1);
|
||||
}
|
||||
if (refCnt > Integer.MAX_VALUE - increment) {
|
||||
throw new ReferenceCountException(refCnt, increment);
|
||||
throw new IllegalReferenceCountException(refCnt, increment);
|
||||
}
|
||||
if (refCntUpdater.compareAndSet(this, refCnt, refCnt + increment)) {
|
||||
break;
|
||||
@ -106,7 +106,7 @@ public abstract class AbstractReferenceCounted implements ReferenceCounted {
|
||||
for (;;) {
|
||||
int refCnt = this.refCnt;
|
||||
if (refCnt == 0) {
|
||||
throw new ReferenceCountException(0, -1);
|
||||
throw new IllegalReferenceCountException(0, -1);
|
||||
}
|
||||
|
||||
if (refCntUpdater.compareAndSet(this, refCnt, refCnt - 1)) {
|
||||
@ -128,7 +128,7 @@ public abstract class AbstractReferenceCounted implements ReferenceCounted {
|
||||
for (;;) {
|
||||
int refCnt = this.refCnt;
|
||||
if (refCnt < decrement) {
|
||||
throw new ReferenceCountException(refCnt, -decrement);
|
||||
throw new IllegalReferenceCountException(refCnt, -decrement);
|
||||
}
|
||||
|
||||
if (refCntUpdater.compareAndSet(this, refCnt, refCnt - decrement)) {
|
||||
|
@ -20,29 +20,29 @@ package io.netty.util;
|
||||
* An {@link IllegalStateException} which is raised when a user attempts to access a {@link ReferenceCounted} whose
|
||||
* reference count has been decreased to 0 (and consequently freed).
|
||||
*/
|
||||
public class ReferenceCountException extends IllegalStateException {
|
||||
public class IllegalReferenceCountException extends IllegalStateException {
|
||||
|
||||
private static final long serialVersionUID = -2507492394288153468L;
|
||||
|
||||
public ReferenceCountException() { }
|
||||
public IllegalReferenceCountException() { }
|
||||
|
||||
public ReferenceCountException(int refCnt) {
|
||||
public IllegalReferenceCountException(int refCnt) {
|
||||
this("refCnt: " + refCnt);
|
||||
}
|
||||
|
||||
public ReferenceCountException(int refCnt, int increment) {
|
||||
public IllegalReferenceCountException(int refCnt, int increment) {
|
||||
this("refCnt: " + refCnt + ", " + (increment > 0? "increment: " + increment : "decrement: " + -increment));
|
||||
}
|
||||
|
||||
public ReferenceCountException(String message) {
|
||||
public IllegalReferenceCountException(String message) {
|
||||
super(message);
|
||||
}
|
||||
|
||||
public ReferenceCountException(String message, Throwable cause) {
|
||||
public IllegalReferenceCountException(String message, Throwable cause) {
|
||||
super(message, cause);
|
||||
}
|
||||
|
||||
public ReferenceCountException(Throwable cause) {
|
||||
public IllegalReferenceCountException(Throwable cause) {
|
||||
super(cause);
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue
Block a user