本文整理汇总了Java中org.xnio.channels.StreamSourceChannel.suspendReads方法的典型用法代码示例。如果您正苦于以下问题:Java StreamSourceChannel.suspendReads方法的具体用法?Java StreamSourceChannel.suspendReads怎么用?Java StreamSourceChannel.suspendReads使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.xnio.channels.StreamSourceChannel
的用法示例。
在下文中一共展示了StreamSourceChannel.suspendReads方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: handleEvent
import org.xnio.channels.StreamSourceChannel; //导入方法依赖的package包/类
@SuppressWarnings({"unchecked", "rawtypes"})
@Override
public void handleEvent(final StreamSourceChannel channel) {
final R receiver = AbstractFramedChannel.this.receiver;
if ((isLastFrameReceived() || receivesSuspended) && receiver == null) {
channel.suspendReads();
return;
} else {
final ChannelListener listener = receiveSetter.get();
if (listener != null) {
WebSocketLogger.REQUEST_LOGGER.debugf("Invoking receive listener", receiver);
ChannelListeners.invokeChannelListener(AbstractFramedChannel.this, listener);
} else {
channel.suspendReads();
}
}
if (readData != null && channel.isOpen()) {
ChannelListeners.invokeChannelListener(channel.getIoThread(), channel, this);
}
}
示例2: handleEvent
import org.xnio.channels.StreamSourceChannel; //导入方法依赖的package包/类
public void handleEvent(final StreamSourceChannel channel) {
ChannelListener<? super StreamSourceChannel> channelListener = setter.get();
if(channelListener != null) {
ChannelListeners.invokeChannelListener(this.channel, channelListener);
} else {
UndertowLogger.REQUEST_LOGGER.debugf("suspending reads on %s to prevent listener runaway", channel);
channel.suspendReads();
}
}
示例3: setup
import org.xnio.channels.StreamSourceChannel; //导入方法依赖的package包/类
public void setup(StreamSourceChannel channel) {
channel.suspendReads();
channel.getReadSetter().set(this);
channel.resumeReads();
}