use of com.generallycloud.baseio.protocol.ProtocolEncoder in project baseio by generallycloud.
the class AbstractSocketChannel method flush.
@Override
public void flush(ChannelFuture future) {
if (future == null || future.flushed()) {
return;
}
future.flush();
if (!isOpened()) {
exceptionCaught(getContext().getIoEventHandleAdaptor(), future, new ClosedChannelException(toString()));
return;
}
try {
ProtocolEncoder encoder = getProtocolEncoder();
// 请勿将future.flush()移到getProtocolEncoder()之前,
// 有些情况下如协议切换的时候可能需要将此future使用
// 切换前的协议flush
encoder.encode(this, future);
doFlush(future);
} catch (Exception e) {
exceptionCaught(getContext().getIoEventHandleAdaptor(), future, e);
}
}
Aggregations