本文整理了Java中org.xnio.IoUtils.safeShutdownReads()
方法的一些代码示例,展示了IoUtils.safeShutdownReads()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。IoUtils.safeShutdownReads()
方法的具体详情如下:
包路径:org.xnio.IoUtils
类名称:IoUtils
方法名:safeShutdownReads
[英]Safely shutdown reads on the given channel.
[中]安全关闭给定通道上的读取。
代码示例来源:origin: wildfly/wildfly
public void handleEvent(final T channel) {
try {
long count = this.count;
try {
long res;
for (;;) {
res = Channels.drain(channel, count);
if (res == -1 || res == count) {
this.count = 0L;
invokeChannelListener(channel, finishListener);
return;
} else if (res == 0) {
return;
} else if (count < Long.MAX_VALUE) {
// MAX_VALUE means drain to EOF
count -= res;
}
}
} finally {
this.count = count;
}
} catch (IOException e) {
this.count = 0L;
if (exceptionHandler != null) {
invokeChannelExceptionHandler(channel, exceptionHandler, e);
} else {
IoUtils.safeShutdownReads(channel);
}
}
}
代码示例来源:origin: org.jboss.eap/wildfly-client-all
public void handleEvent(final T channel) {
try {
long count = this.count;
try {
long res;
for (;;) {
res = Channels.drain(channel, count);
if (res == -1 || res == count) {
this.count = 0L;
invokeChannelListener(channel, finishListener);
return;
} else if (res == 0) {
return;
} else if (count < Long.MAX_VALUE) {
// MAX_VALUE means drain to EOF
count -= res;
}
}
} finally {
this.count = count;
}
} catch (IOException e) {
this.count = 0L;
if (exceptionHandler != null) {
invokeChannelExceptionHandler(channel, exceptionHandler, e);
} else {
IoUtils.safeShutdownReads(channel);
}
}
}
代码示例来源:origin: org.jboss.remoting3/jboss-remoting
protected void closeAction() throws IOException {
sendCloseRequest();
IoUtils.safeShutdownReads(remoteConnection.getChannel());
remoteConnection.shutdownWrites();
// now these guys can't send useless messages
closePendingChannels();
closeAllChannels();
remoteConnection.getRemoteConnectionProvider().removeConnectionHandler(this);
}
内容来源于网络,如有侵权,请联系作者删除!