当前位置: 首页>>代码示例>>Java>>正文


Java IllegalReferenceCountException类代码示例

本文整理汇总了Java中io.netty.util.IllegalReferenceCountException的典型用法代码示例。如果您正苦于以下问题:Java IllegalReferenceCountException类的具体用法?Java IllegalReferenceCountException怎么用?Java IllegalReferenceCountException使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


IllegalReferenceCountException类属于io.netty.util包,在下文中一共展示了IllegalReferenceCountException类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: release0

import io.netty.util.IllegalReferenceCountException; //导入依赖的package包/类
private boolean release0(int decrement) {
	for (;;) {
		int refCnt = this.refCnt;
		if (refCnt < decrement) {
			throw new IllegalReferenceCountException(refCnt, -decrement);
		}

		if (refCntUpdater.compareAndSet(this, refCnt, refCnt - decrement)) {
			if (refCnt == decrement) {
				deallocate();
				return true;
			}
			return false;
		}
	}
}
 
开发者ID:spccold,项目名称:sailfish,代码行数:17,代码来源:ReferenceCountedServerExchangeChannelGroup.java

示例2: release

import io.netty.util.IllegalReferenceCountException; //导入依赖的package包/类
@Override
public final boolean release(int decrement) {
    if (decrement <= 0) {
        throw new IllegalArgumentException("decrement: " + decrement + " (expected: > 0)");
    }

    for (;;) {
        int refCnt = this.refCnt;
        if (refCnt < decrement) {
            throw new IllegalReferenceCountException(refCnt, -decrement);
        }

        if (refCntUpdater.compareAndSet(this, refCnt, refCnt - decrement)) {
            if (refCnt == decrement) {
                deallocate();
                return true;
            }
            return false;
        }
    }
}
 
开发者ID:wuyinxian124,项目名称:netty4.0.27Learn,代码行数:22,代码来源:AbstractReferenceCountedByteBuf.java

示例3: content

import io.netty.util.IllegalReferenceCountException; //导入依赖的package包/类
@Override
public ByteBuf content() {
    final ByteBuf data = (ByteBuf) super.payload();
    if (data.refCnt() <= 0) {
        throw new IllegalReferenceCountException(data.refCnt());
    }
    return data;
}
 
开发者ID:12315jack,项目名称:j1st-mqtt,代码行数:9,代码来源:MqttPublishMessage.java

示例4: exceptionCaught

import io.netty.util.IllegalReferenceCountException; //导入依赖的package包/类
/**
 * {@inheritDoc}
 * @see io.netty.channel.ChannelInboundHandlerAdapter#exceptionCaught(io.netty.channel.ChannelHandlerContext, java.lang.Throwable)
 */
@Override
public void exceptionCaught(final ChannelHandlerContext ctx, final Throwable cause) throws Exception {
	final Channel chan = ctx.channel();
	if (cause instanceof ClosedChannelException) {
		exceptions_closed.inc();
		log.warn("Attempt to write to closed channel " + chan);
		return;
	} else if(cause instanceof IllegalReferenceCountException) {
		log.warn("BadRefCount: [{}]", cause.getMessage());
	} else if (cause instanceof IOException) {
		final String message = cause.getMessage();
		if ("Connection reset by peer".equals(message)) {
			exceptions_reset.inc();
			return;
		} else if ("Connection timed out".equals(message)) {
			exceptions_timeout.inc();
			// Do nothing.  A client disconnecting isn't really our problem.  Oh,
			// and I'm not kidding you, there's no better way to detect ECONNRESET
			// in Java.  Like, people have been bitching about errno for years,
			// and Java managed to do something *far* worse.  That's quite a feat.
			return;
		}
	}
	// FIXME: not sure what the netty 4 is for this
	//if (cause instanceof CodecEmbedderException) {
	//	// payload was not compressed as it was announced to be
	//	log.warn("Http codec error : " + cause.getMessage());
	//	e.getChannel().close();
	//	return;
	//}
	exceptions_unknown.inc();
	log.error("Unexpected exception from downstream for " + chan, cause);
	chan.close();
}
 
开发者ID:nickman,项目名称:HeliosStreams,代码行数:39,代码来源:ConnectionManager.java

示例5: content

import io.netty.util.IllegalReferenceCountException; //导入依赖的package包/类
@Override
public ByteBuf content() {
    if (data.refCnt() <= 0) {
        throw new IllegalReferenceCountException(data.refCnt());
    }
    return data;
}
 
开发者ID:wuyinxian124,项目名称:netty4.0.27Learn,代码行数:8,代码来源:DefaultByteBufHolder.java

示例6: testArrayAfterRelease

import io.netty.util.IllegalReferenceCountException; //导入依赖的package包/类
@Test
public void testArrayAfterRelease() {
    ByteBuf buf = releasedBuffer();
    if (buf.hasArray()) {
        try {
            buf.array();
            fail();
        } catch (IllegalReferenceCountException e) {
            // expected
        }
    }
}
 
开发者ID:wuyinxian124,项目名称:netty4.0.27Learn,代码行数:13,代码来源:AbstractByteBufTest.java

示例7: testMemoryAddressAfterRelease

import io.netty.util.IllegalReferenceCountException; //导入依赖的package包/类
@Test
public void testMemoryAddressAfterRelease() {
    ByteBuf buf = releasedBuffer();
    if (buf.hasMemoryAddress()) {
        try {
            buf.memoryAddress();
            fail();
        } catch (IllegalReferenceCountException e) {
            // expected
        }
    }
}
 
开发者ID:wuyinxian124,项目名称:netty4.0.27Learn,代码行数:13,代码来源:AbstractByteBufTest.java

示例8: assertAccessible

import io.netty.util.IllegalReferenceCountException; //导入依赖的package包/类
private void assertAccessible() {
    if (refCnt() == 0) throw new IllegalReferenceCountException(0);
}
 
开发者ID:SpudCompat,项目名称:SpudCompat,代码行数:4,代码来源:SimpleNBT.java

示例9: assertValid

import io.netty.util.IllegalReferenceCountException; //导入依赖的package包/类
private void assertValid() {
    if (refCnt() <= 0) throw new IllegalReferenceCountException("Packet deallocated");
}
 
开发者ID:SpudCompat,项目名称:SpudCompat,代码行数:4,代码来源:RawPacket.java

示例10: testGetBytesAfterRelease7

import io.netty.util.IllegalReferenceCountException; //导入依赖的package包/类
@Test(expected = IllegalReferenceCountException.class)
public void testGetBytesAfterRelease7() throws IOException {
    releasedBuffer().getBytes(0, new ByteArrayOutputStream(), 1);
}
 
开发者ID:krisjey,项目名称:netty.book.kor,代码行数:5,代码来源:AbstractByteBufTest.java

示例11: testReadUnsignedMediumAfterRelease

import io.netty.util.IllegalReferenceCountException; //导入依赖的package包/类
@Test(expected = IllegalReferenceCountException.class)
public void testReadUnsignedMediumAfterRelease() {
    releasedBuffer().readUnsignedMedium();
}
 
开发者ID:krisjey,项目名称:netty.book.kor,代码行数:5,代码来源:AbstractByteBufTest.java

示例12: testEnsureWritableAfterRelease

import io.netty.util.IllegalReferenceCountException; //导入依赖的package包/类
@Test(expected = IllegalReferenceCountException.class)
public void testEnsureWritableAfterRelease() {
    releasedBuffer().ensureWritable(16);
}
 
开发者ID:krisjey,项目名称:netty.book.kor,代码行数:5,代码来源:AbstractByteBufTest.java

示例13: testSetBytesAfterRelease

import io.netty.util.IllegalReferenceCountException; //导入依赖的package包/类
@Test(expected = IllegalReferenceCountException.class)
public void testSetBytesAfterRelease() {
    releasedBuffer().setBytes(0, releaseLater(buffer()));
}
 
开发者ID:krisjey,项目名称:netty.book.kor,代码行数:5,代码来源:AbstractByteBufTest.java

示例14: testWriteFloatAfterRelease

import io.netty.util.IllegalReferenceCountException; //导入依赖的package包/类
@Test(expected = IllegalReferenceCountException.class)
public void testWriteFloatAfterRelease() {
    releasedBuffer().writeFloat(1);
}
 
开发者ID:krisjey,项目名称:netty.book.kor,代码行数:5,代码来源:AbstractByteBufTest.java

示例15: testGetUnsignedByteAfterRelease

import io.netty.util.IllegalReferenceCountException; //导入依赖的package包/类
@Test(expected = IllegalReferenceCountException.class)
public void testGetUnsignedByteAfterRelease() {
    releasedBuffer().getUnsignedByte(0);
}
 
开发者ID:krisjey,项目名称:netty.book.kor,代码行数:5,代码来源:AbstractByteBufTest.java


注:本文中的io.netty.util.IllegalReferenceCountException类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。