hc-httpclient-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Farzad Mahdikhani <f.mahdikh...@dotin.ir>
Subject Side effects of ignoring JSESSIONID in a multi-threaded application
Date Sat, 18 Mar 2017 14:58:13 GMT
I am using a CloseableHttpClient which uses a PoolingHttpClientConnectionManager in a web application,
I mean a multi-threaded application with different users, in a state-less way or request-response
way. The server at the other hand, a load balancer in front of 10 servers which I don’t
have control over it, sends a JSESSIONID in response. Now, the problem is that the JSESSIONID
sent by the server is kept by HttpClient and used at the future requests. When this happens,
the load balancer redirects every request to the first server, i.e., the creator of the session
id which is not appropriate for me and I want other servers to be used by the load balancer
for other requests (balance the load among the servers).

I could ignore JSESSIONID sent in response by disabling cookies using setCookieSpec(CookieSpecs.IGNORE_COOKIES)
when creating RequestConfig object but I don’t know the side effects of this. Actually I
am afraid of messing responses for the requests in different threads of application when ignoring
JSESSIONID. In other words, is it guaranteed that when I execute for example httpclient.execute(httpPost,
responseHandler) in a thread, the response is returned to that thread/user?

I am using HttpClient 4.5.2 and as I mentioned above I don’t need JSESSIONID sent by the
server as I want a state-less request-response behavior here.

---------------------------------------------------------------------
To unsubscribe, e-mail: httpclient-users-unsubscribe@hc.apache.org
For additional commands, e-mail: httpclient-users-help@hc.apache.org


Mime
View raw message