The feeder code is from grizzly-http-client (aka async-http-client 1.8.15)
and jersey-grizzly-connector
/**
* Utility OutputStream implementation that can feed Grizzly
chunk-encoded body generator.
*/
private class FeederAdapter extends OutputStream {
final FeedableBodyGenerator.Feeder delegate;
/**
* Get me a new adapter for given feeder.
*
* @param bodyFeeder adaptee to get fed as an output stream.
*/
FeederAdapter(FeedableBodyGenerator.Feeder bodyFeeder) {
this.delegate = bodyFeeder;
}
@Override
public void write(int b) throws IOException {
final byte[] buffer = new byte[1];
buffer[0] = (byte) b;
delegate.feed(Buffers.wrap(MemoryManager.DEFAULT_MEMORY_MANAGER,
buffer), false);
}
@Override
public void write(byte[] b) throws IOException {
delegate.feed(Buffers.wrap(MemoryManager.DEFAULT_MEMORY_MANAGER,
b), false);
}
@Override
public void write(byte[] b, int off, int len) throws IOException {
delegate.feed(Buffers.wrap(MemoryManager.DEFAULT_MEMORY_MANAGER,
b, off, len), false);
}
@Override
public void close() throws IOException {
delegate.feed(Buffers.EMPTY_BUFFER, true);
}
}
--
View this message in context: http://grizzly.1045725.n5.nabble.com/Grizzly-http-client-race-condition-tp5710847p5710901.html
Sent from the Grizzly - Users mailing list archive at Nabble.com.