private void writeInEventLoop(ActiveMQBuffer buffer, final boolean flush, final boolean batched, final ChannelFutureListener futureListener) { //no need to lock because the Netty's channel is thread-safe //and the order of write is ensured by the order of the write calls final ChannelPromise promise; if (futureListener != null) { promise = channel.newPromise(); } else { promise = channel.voidPromise(); } final ChannelFuture future; final ByteBuf bytes = buffer.byteBuf(); final int readableBytes = bytes.readableBytes(); final int writeBatchSize = this.batchLimit; if (this.batchingEnabled && batched && !flush && readableBytes < writeBatchSize) { future = writeBatch(bytes, readableBytes, promise); } else { future = channel.writeAndFlush(bytes, promise); } if (futureListener != null) { future.addListener(futureListener); } }
private void writeNotInEventLoop(ActiveMQBuffer buffer, final boolean flush, final boolean batched, final ChannelFutureListener futureListener) { final Channel channel = this.channel; final ChannelPromise promise; if (flush || (futureListener != null)) { promise = channel.newPromise(); } else { promise = channel.voidPromise(); } final ChannelFuture future; final ByteBuf bytes = buffer.byteBuf(); final int readableBytes = bytes.readableBytes(); assert readableBytes >= 0; final int writeBatchSize = this.batchLimit; final boolean batchingEnabled = this.batchingEnabled; if (batchingEnabled && batched && !flush && readableBytes < writeBatchSize) { future = writeBatch(bytes, readableBytes, promise); } else { future = channel.writeAndFlush(bytes, promise); } if (futureListener != null) { future.addListener(futureListener); } if (flush) { //NOTE: this code path seems used only on RemotingConnection::disconnect waitFor(promise, DEFAULT_WAIT_MILLIS); } }
private void writeInEventLoop(ActiveMQBuffer buffer, final boolean flush, final boolean batched, final ChannelFutureListener futureListener) { //no need to lock because the Netty's channel is thread-safe //and the order of write is ensured by the order of the write calls final ChannelPromise promise; if (futureListener != null) { promise = channel.newPromise(); } else { promise = channel.voidPromise(); } final ChannelFuture future; final ByteBuf bytes = buffer.byteBuf(); final int readableBytes = bytes.readableBytes(); final int writeBatchSize = this.batchLimit; if (this.batchingEnabled && batched && !flush && readableBytes < writeBatchSize) { future = writeBatch(bytes, readableBytes, promise); } else { future = channel.writeAndFlush(bytes, promise); } if (futureListener != null) { future.addListener(futureListener); } }
private void writeInEventLoop(ActiveMQBuffer buffer, final boolean flush, final boolean batched, final ChannelFutureListener futureListener) { //no need to lock because the Netty's channel is thread-safe //and the order of write is ensured by the order of the write calls final ChannelPromise promise; if (futureListener != null) { promise = channel.newPromise(); } else { promise = channel.voidPromise(); } final ChannelFuture future; final ByteBuf bytes = buffer.byteBuf(); final int readableBytes = bytes.readableBytes(); final int writeBatchSize = this.batchLimit; if (this.batchingEnabled && batched && !flush && readableBytes < writeBatchSize) { future = writeBatch(bytes, readableBytes, promise); } else { future = channel.writeAndFlush(bytes, promise); } if (futureListener != null) { future.addListener(futureListener); } }
private void writeInEventLoop(ActiveMQBuffer buffer, final boolean flush, final boolean batched, final ChannelFutureListener futureListener) { //no need to lock because the Netty's channel is thread-safe //and the order of write is ensured by the order of the write calls final ChannelPromise promise; if (futureListener != null) { promise = channel.newPromise(); } else { promise = channel.voidPromise(); } final ChannelFuture future; final ByteBuf bytes = buffer.byteBuf(); final int readableBytes = bytes.readableBytes(); final int writeBatchSize = this.batchLimit; if (this.batchingEnabled && batched && !flush && readableBytes < writeBatchSize) { future = writeBatch(bytes, readableBytes, promise); } else { future = channel.writeAndFlush(bytes, promise); } if (futureListener != null) { future.addListener(futureListener); } }
private void writeNotInEventLoop(ActiveMQBuffer buffer, final boolean flush, final boolean batched, final ChannelFutureListener futureListener) { final Channel channel = this.channel; final ChannelPromise promise; if (flush || (futureListener != null)) { promise = channel.newPromise(); } else { promise = channel.voidPromise(); } final ChannelFuture future; final ByteBuf bytes = buffer.byteBuf(); final int readableBytes = bytes.readableBytes(); assert readableBytes >= 0; final int writeBatchSize = this.batchLimit; final boolean batchingEnabled = this.batchingEnabled; if (batchingEnabled && batched && !flush && readableBytes < writeBatchSize) { future = writeBatch(bytes, readableBytes, promise); } else { future = channel.writeAndFlush(bytes, promise); } if (futureListener != null) { future.addListener(futureListener); } if (flush) { //NOTE: this code path seems used only on RemotingConnection::disconnect waitFor(promise, DEFAULT_WAIT_MILLIS); } }
private void writeNotInEventLoop(ActiveMQBuffer buffer, final boolean flush, final boolean batched, final ChannelFutureListener futureListener) { final Channel channel = this.channel; final ChannelPromise promise; if (flush || (futureListener != null)) { promise = channel.newPromise(); } else { promise = channel.voidPromise(); } final ChannelFuture future; final ByteBuf bytes = buffer.byteBuf(); final int readableBytes = bytes.readableBytes(); assert readableBytes >= 0; final int writeBatchSize = this.batchLimit; final boolean batchingEnabled = this.batchingEnabled; if (batchingEnabled && batched && !flush && readableBytes < writeBatchSize) { future = writeBatch(bytes, readableBytes, promise); } else { future = channel.writeAndFlush(bytes, promise); } if (futureListener != null) { future.addListener(futureListener); } if (flush) { //NOTE: this code path seems used only on RemotingConnection::disconnect waitFor(promise, DEFAULT_WAIT_MILLIS); } }
private void writeNotInEventLoop(ActiveMQBuffer buffer, final boolean flush, final boolean batched, final ChannelFutureListener futureListener) { final Channel channel = this.channel; final ChannelPromise promise; if (flush || (futureListener != null)) { promise = channel.newPromise(); } else { promise = channel.voidPromise(); } final ChannelFuture future; final ByteBuf bytes = buffer.byteBuf(); final int readableBytes = bytes.readableBytes(); assert readableBytes >= 0; final int writeBatchSize = this.batchLimit; final boolean batchingEnabled = this.batchingEnabled; if (batchingEnabled && batched && !flush && readableBytes < writeBatchSize) { future = writeBatch(bytes, readableBytes, promise); } else { future = channel.writeAndFlush(bytes, promise); } if (futureListener != null) { future.addListener(futureListener); } if (flush) { //NOTE: this code path seems used only on RemotingConnection::disconnect waitFor(promise, DEFAULT_WAIT_MILLIS); } }
final boolean batchingEnabled = this.batchingEnabled; if (batchingEnabled && batched && !flush && readableBytes < writeBatchSize) { future = writeBatch(bytes, readableBytes, promise); } else { future = channel.writeAndFlush(bytes, promise);
final boolean batchingEnabled = this.batchingEnabled; if (batchingEnabled && batched && !flush && readableBytes < writeBatchSize) { future = writeBatch(bytes, readableBytes, promise); } else { future = channel.writeAndFlush(bytes, promise);
final boolean batchingEnabled = this.batchingEnabled; if (batchingEnabled && batched && !flush && readableBytes < writeBatchSize) { future = writeBatch(bytes, readableBytes, promise); } else { future = channel.writeAndFlush(bytes, promise);