本文整理汇总了Java中io.netty.channel.ChannelHandlerContext.flush方法的典型用法代码示例。如果您正苦于以下问题:Java ChannelHandlerContext.flush方法的具体用法?Java ChannelHandlerContext.flush怎么用?Java ChannelHandlerContext.flush使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类io.netty.channel.ChannelHandlerContext
的用法示例。
在下文中一共展示了ChannelHandlerContext.flush方法的13个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: processInformationTransfer
import io.netty.channel.ChannelHandlerContext; //导入方法依赖的package包/类
private void processInformationTransfer ( final ChannelHandlerContext ctx, final Object msg )
{
final List<Object> out = new LinkedList<> ();
logger.trace ( "Passing to manager: {}", msg );
final ByteBuf errorData = this.manager.receiveMessage ( (InformationTransfer)msg, out );
if ( errorData != null )
{
logger.debug ( "Write error reply" );
writeMessageToChannel ( ctx, errorData, null );
ctx.flush ();
}
for ( final Object newMsg : out )
{
logger.trace ( "Passing message: {}", newMsg );
ctx.fireChannelRead ( newMsg );
}
}
示例2: handleAck
import io.netty.channel.ChannelHandlerContext; //导入方法依赖的package包/类
protected synchronized void handleAck ( final ChannelHandlerContext ctx, final int receiveSequenceNumber )
{
logger.trace ( "Received ACK up to: {}", receiveSequenceNumber );
// handle ack
this.ackBuffer.gotAck ( receiveSequenceNumber );
// now try to flush messages from the buffer
sendFromBuffer ();
// try to send from sources
sendFromSources ();
ctx.flush ();
}
示例3: onDataRead
import io.netty.channel.ChannelHandlerContext; //导入方法依赖的package包/类
int onDataRead(ChannelHandlerContext ctx, int streamId, ByteBuf data, int padding,
boolean endOfStream) {
int processed = data.readableBytes() + padding;
encoder().writeData(ctx, streamId, data.retain(), 0, true, ctx.newPromise());
ctx.flush();
return processed;
}
示例4: onHeadersRead
import io.netty.channel.ChannelHandlerContext; //导入方法依赖的package包/类
@Override
void onHeadersRead(ChannelHandlerContext ctx, int streamId, boolean endOfStream,
Http2Headers headers) {
encoder().writeHeaders(
ctx, streamId, createDefaultResponseHeaders(), 0, false, ctx.newPromise());
encoder().writeData(
ctx, streamId, RESPONSE_BYTES.duplicate(), 0, false, ctx.newPromise());
Http2Headers responseTrailers = createResponseHeadersFromRequestHeaders(headers).add(
"trailer", "value1", "Value2");
encoder().writeHeaders(ctx, streamId, responseTrailers, 0, true, ctx.newPromise());
ctx.flush();
}
示例5: sendTransmissionSimpleReply
import io.netty.channel.ChannelHandlerContext; //导入方法依赖的package包/类
private void sendTransmissionSimpleReply(ChannelHandlerContext ctx, int error, long handle, ByteBuf data) {
synchronized (this) {
ByteBuf bbr = ctx.alloc().buffer(16);
bbr.writeInt(Protocol.REPLY_MAGIC);
bbr.writeInt(error); // zero for okay
bbr.writeLong(handle);
ctx.write(bbr);
if (data != null) {
ctx.write(data);
}
}
ctx.flush();
logPendingOperations();
}
示例6: write
import io.netty.channel.ChannelHandlerContext; //导入方法依赖的package包/类
@Override
public void write(ChannelHandlerContext ctx, Object msg, ChannelPromise promise) throws Exception {
synchronized (pendings) {
pendings.add(msg);
}
if (ctx.isRemoved()) {
flushPendings(ctx);
ctx.flush();
}
}
示例7: sendResponseString
import io.netty.channel.ChannelHandlerContext; //导入方法依赖的package包/类
void sendResponseString(ChannelHandlerContext ctx, int streamId, String responseString) {
ByteBuf content = ctx.alloc().buffer();
ByteBufUtil.writeAscii(content, responseString);
encoder().writeHeaders(
ctx, streamId, createDefaultResponseHeaders(), 0, false, ctx.newPromise());
encoder().writeData(ctx, streamId, content, 0, true, ctx.newPromise());
ctx.flush();
}
示例8: channelReadComplete
import io.netty.channel.ChannelHandlerContext; //导入方法依赖的package包/类
@Override
public void channelReadComplete(ChannelHandlerContext ctx) {
ctx.flush();
}
示例9: channelReadComplete
import io.netty.channel.ChannelHandlerContext; //导入方法依赖的package包/类
@Override
public void channelReadComplete(ChannelHandlerContext ctx) {
ctx.flush();
}
示例10: channelReadComplete
import io.netty.channel.ChannelHandlerContext; //导入方法依赖的package包/类
@Override
public void channelReadComplete(ChannelHandlerContext ctx) throws Exception {
ctx.flush();
}
示例11: channelReadComplete
import io.netty.channel.ChannelHandlerContext; //导入方法依赖的package包/类
@Override
public void channelReadComplete(ChannelHandlerContext ctx) throws Exception {
ctx.flush();
}
示例12: channelReadComplete
import io.netty.channel.ChannelHandlerContext; //导入方法依赖的package包/类
@Override
public void channelReadComplete(ChannelHandlerContext ctx) throws Exception {
ctx.flush();
}
示例13: channelReadComplete
import io.netty.channel.ChannelHandlerContext; //导入方法依赖的package包/类
@Override
public void channelReadComplete(ChannelHandlerContext ctx) {
ctx.flush();
}