I read that HttpConnection is *not* thread-safe. While this may seem a minor detail, it makes programming with the blocking model enormously more complex.
For example, I'm trying to write a simple http load balancer which forwards client requests to the next available server from a pool in one direction, and forwards replies from servers to the originating clients in the opposite direction. The idea is to have a task from java.util.concurrent assigned to each client-side connection and a task for each server-side connection. The client-side task blocks on HttpConnection waiting for the next request, forwards the request to a server-side HttpConnection and repeats the iteration by blocking for the next request. The server-side task blocks waiting for the next response, forwards the response to the appropriate originating client-side connection and starts over again waiting for the next response. However, since HttpConnection is not thread-safe and since tasks are executed in independent threads, the above schema does not work safely. If only one thread is allowed per HttpConnection, the client-side one that blocks for reading a request cannot forward any response on behalf of the server-side task. Similarly the server-side thread cannot forward a request on behalf of the client-side when it blocks reading the next response. I don't know of a simple workaround. Any suggestion? Thanks. --------------------------------------------------------------------- To unsubscribe, e-mail: dev-unsubscr...@hc.apache.org For additional commands, e-mail: dev-h...@hc.apache.org