use of org.neo4j.bolt.transport.TransportThrottleException in project neo4j by neo4j.
the class ChunkedOutput method flush.
@Override
public PackOutput flush() throws IOException {
if (buffer != null && buffer.readableBytes() > 0) {
closeChunkIfOpen();
// check for and apply write throttles
try {
throttleGroup.writeThrottle().acquire(channel);
} catch (TransportThrottleException ex) {
throw new BoltIOException(Status.Request.InvalidUsage, ex.getMessage(), ex);
}
// Local copy and clear the buffer field. This ensures that the buffer is not re-released if the flush call fails
ByteBuf out = this.buffer;
this.buffer = null;
channel.writeAndFlush(out, channel.voidPromise());
buffer = allocateBuffer();
}
return this;
}
Aggregations