Hi guys,
I'm using ThreadSafeClientConnManager from HttpComponents library for
multithreaded post requests and I'm running into the following exception.
java.io.InterruptedIOException: Connection has been shut down
at
org.apache.http.impl.client.DefaultRequestDirector.execute(DefaultRequestDirector.java:543)
at
org.apache.http.impl.client.AbstractHttpClient.execute(AbstractHttpClient.java:820)
at some.package.SomeClass.execute(SomeClass.java:123)
Caused by: org.apache.http.impl.conn.ConnectionShutdownException
at
org.apache.http.impl.conn.AbstractClientConnAdapter.assertValid(AbstractClientConnAdapter.java:154)
at
org.apache.http.impl.conn.AbstractClientConnAdapter.getSSLSession(AbstractClientConnAdapter.java:270)
at
org.apache.http.impl.client.DefaultUserTokenHandler.getUserToken(DefaultUserTokenHandler.java:80)
at
org.apache.http.impl.client.DefaultRequestDirector.execute(DefaultRequestDirector.java:516)
Here's the DEBUG output before the exception which looks fine.
[org.apache.http.impl.conn.tsccm.ConnPoolByRoute][DEBUG]
[HttpRoute[{}->http://localhost:8080]] total kept alive: 2, total issued: 0,
total allocated: 2 out of 20
[org.apache.http.impl.conn.tsccm.ThreadSafeClientConnManager][DEBUG] Get
connection: HttpRoute[{}->http://localhost:8080], timeout = 0
[org.apache.http.impl.conn.tsccm.ConnPoolByRoute][DEBUG] Getting free
connection [HttpRoute[{}->http://localhost:8080]][null]
[org.apache.http.impl.conn.tsccm.ConnPoolByRoute][DEBUG]
[HttpRoute[{}->http://localhost:8080]] total kept alive: 1, total issued: 1,
total allocated: 2 out of 20
[org.apache.http.impl.conn.tsccm.ConnPoolByRoute][DEBUG] Getting free
connection [HttpRoute[{}->http://localhost:8080]][null]
[org.apache.http.impl.conn.tsccm.ThreadSafeClientConnManager][DEBUG] Released
connection is reusable.
[org.apache.http.impl.conn.tsccm.ThreadSafeClientConnManager][DEBUG] Released
connection is not reusable.
[org.apache.http.impl.conn.tsccm.ConnPoolByRoute][DEBUG] Releasing connection
[HttpRoute[{}->http://localhost:8080]][null]
[org.apache.http.impl.conn.tsccm.ConnPoolByRoute][DEBUG] Pooling connection
[HttpRoute[{}->http://localhost:8080]][null]; keep alive indefinitely
[org.apache.http.impl.conn.tsccm.ConnPoolByRoute][DEBUG] Releasing connection
[HttpRoute[{}->http://localhost:8080]][null]
[org.apache.http.impl.conn.tsccm.ConnPoolByRoute][DEBUG] Notifying no-one,
there are no waiting threads
[org.apache.http.impl.conn.tsccm.ConnPoolByRoute][DEBUG] Notifying no-one,
there are no waiting threads
Any ideas what might be the problem? Looking at the source
code(DefaultRequestDirector.java), if a connection is not reusable, why does it
still try to get the user token to set into connection?
Thanks,
Cory