Github user rschmitt commented on the issue:
https://github.com/apache/httpcomponents-core/pull/91
@ok2c That's an improvement, but I still don't think we've gotten at the
root of the problem yet. I don't think that a hardcoded capacity increment of
`Integer.MAX_VALUE` is an appropriate way of signaling unlimited capacity, but
it's much more difficult under the current design to do the right thing.
Shouldn't it be simple for a consumer to signal `Integer.MAX_VALUE` (or some
more reasonable value) as the *initial* capacity, and thereafter to signal
capacity increments at the end of every `consume` call? (Another subtlety: when
you think about it, claiming that you have an infinite buffer is not the same
thing as claiming to always process consumed data instantaneously.)
I think a few interface changes could simplify things quite a bit:
1. The `CapacityChannel` should be supplied exactly once, before the
`consume` and `streamEnd` methods are ever called; this could be an `init`
method, which also returns the initial capacity of the consumer.
2. The consumer should always signal capacity increments by calling
`CapacityChannel`; the consumer's caller should never ask for an increment
directly.
I'll see how difficult it is to implement these changes.
---
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]