On Thu, 2011-11-24 at 15:38 -0800, richev wrote:
> Okay. Can you tell me how I code the client so that it does timeout after x
> seconds? I assumed that was what I was doing with the timeout options in my
> code that I posted.
>
Are you talking about connect timeout or socket timeout? If you mean the
latter, most likely your expectation is simply wrong. Please look up a
definition of the socket timeout and what exactly it signifies.
Oleg
>
> olegk wrote:
> >
> > On Thu, Nov 24, 2011 at 12:42:35PM -0800, richevo wrote:
> >>
> >> I hope this makes it clear. Apologies for the 4 posts with the same
> >> question,
> >> don't know what happened!
> >>
> >>
> >> java.util.logging.Logger.getLogger("org.apache.http.wire").setLevel(java.util.logging.Level.FINEST);
> >> java.util.logging.Logger.getLogger("org.apache.http.headers").setLevel(java.util.logging.Level.FINEST);
> >> System.setProperty("org.apache.commons.logging.Log",
> >> "org.apache.commons.logging.impl.SimpleLog");
> >> System.setProperty("org.apache.commons.logging.simplelog.showdatetime",
> >> "true");
> >> System.setProperty("org.apache.commons.logging.simplelog.log.httpclient.wire",
> >> "debug");
> >> System.setProperty("org.apache.commons.logging.simplelog.log.org.apache.http",
> >> "debug");
> >> System.setProperty("org.apache.commons.logging.simplelog.log.org.apache.http.headers",
> >> "debug");
> >>
> >> HttpClient setup ->
> >> HttpAsyncClient httpclient = new DefaultHttpAsyncClient();
> >> httpclient.getParams()
> >> .setIntParameter(CoreConnectionPNames.SO_TIMEOUT, 3000)
> >> .setIntParameter(CoreConnectionPNames.CONNECTION_TIMEOUT,
> >> 3000)
> >> .setIntParameter(CoreConnectionPNames.SOCKET_BUFFER_SIZE, 8 *
> >> 1024)
> >> .setBooleanParameter(CoreConnectionPNames.TCP_NODELAY, true);
> >>
> >> Wire log->
> >>
> >> 2011/11/24 20:37:21:885 GMT [DEBUG] PoolingAsyncClientConnectionManager -
> >> Connection request: [route: HttpRoute[{}->http://localhost:8080]][total
> >> kept
> >> alive: 0; route allocated: 0 of 2; total allocated: 0 of 20]
> >> 2011/11/24 20:37:21:930 GMT [DEBUG] PoolingAsyncClientConnectionManager -
> >> Connection leased: [id: 0][route:
> >> HttpRoute[{}->http://localhost:8080]][total kept alive: 0; route
> >> allocated:
> >> 1 of 2; total allocated: 0 of 20]
> >> 2011/11/24 20:37:21:936 GMT [DEBUG] DefaultHttpAsyncClient - Connection
> >> request suceeded:
> >> [id:0][route:HttpRoute[{}->http://localhost:8080]][state:null]
> >> 2011/11/24 20:37:21:981 GMT [DEBUG] IOSessionImpl - http-outgoing-0
> >> 127.0.0.1:61717<->127.0.0.1:8080[ACTIVE][rw:]: Event set [w]
> >> 2011/11/24 20:37:21:982 GMT [DEBUG] HttpAsyncClientProtocolHandler -
> >> http-outgoing-0 [ACTIVE]: Connected
> >> 2011/11/24 20:37:21:984 GMT [DEBUG] HttpAsyncClientProtocolHandler -
> >> http-outgoing-0 [ACTIVE] Request ready
> >> 2011/11/24 20:37:21:987 GMT [DEBUG] RequestAddCookies - CookieSpec
> >> selected:
> >> best-match
> >> 2011/11/24 20:37:22:006 GMT [DEBUG] RequestAuthCache - Auth cache not set
> >> in
> >> the context
> >> 2011/11/24 20:37:22:006 GMT [DEBUG] DefaultHttpAsyncClient - Attempt 1 to
> >> execute request
> >> 2011/11/24 20:37:22:006 GMT [DEBUG] headers - http-outgoing-0 >> GET
> >> /Test2/rest/world HTTP/1.1
> >> 2011/11/24 20:37:22:007 GMT [DEBUG] headers - http-outgoing-0 >> Host:
> >> localhost:8080
> >> 2011/11/24 20:37:22:007 GMT [DEBUG] headers - http-outgoing-0 >>
> >> Connection:
> >> Keep-Alive
> >> 2011/11/24 20:37:22:007 GMT [DEBUG] headers - http-outgoing-0 >>
> >> User-Agent:
> >> Apache-HttpAsyncClient/4.0-alpha3 (java 1.5)
> >> 2011/11/24 20:37:22:009 GMT [DEBUG] IOSessionImpl - http-outgoing-0
> >> 127.0.0.1:61717<->127.0.0.1:8080[ACTIVE][rw:]: Event set [w]
> >> 2011/11/24 20:37:22:014 GMT [DEBUG] IOSessionImpl - http-outgoing-0
> >> 127.0.0.1:61717<->127.0.0.1:8080[ACTIVE][rw:w]: 138 bytes written
> >> 2011/11/24 20:37:22:014 GMT [DEBUG] wire - http-outgoing-0 >> "GET
> >> /Test2/rest/world HTTP/1.1[\r][\n]"
> >> 2011/11/24 20:37:22:014 GMT [DEBUG] wire - http-outgoing-0 >> "Host:
> >> localhost:8080[\r][\n]"
> >> 2011/11/24 20:37:22:014 GMT [DEBUG] wire - http-outgoing-0 >>
> >> "Connection:
> >> Keep-Alive[\r][\n]"
> >> 2011/11/24 20:37:22:015 GMT [DEBUG] wire - http-outgoing-0 >>
> >> "User-Agent:
> >> Apache-HttpAsyncClient/4.0-alpha3 (java 1.5)[\r][\n]"
> >> 2011/11/24 20:37:22:015 GMT [DEBUG] wire - http-outgoing-0 >> "[\r][\n]"
> >> 2011/11/24 20:37:22:015 GMT [DEBUG] IOSessionImpl - http-outgoing-0
> >> 127.0.0.1:61717<->127.0.0.1:8080[ACTIVE][r:w]: Event cleared [w]
> >> 2011/11/24 20:37:22:015 GMT [DEBUG] HttpAsyncClientProtocolHandler -
> >> http-outgoing-0 [ACTIVE] Request ready
> >> 2011/11/24 20:37:46:720 GMT [DEBUG] IOSessionImpl - http-outgoing-0
> >> 127.0.0.1:61717<->127.0.0.1:8080[ACTIVE][r:r]: 439 bytes read
> >> 2011/11/24 20:37:46:720 GMT [DEBUG] wire - http-outgoing-0 << "HTTP/1.1
> >> 200
> >> OK[\r][\n]"
> >> 2011/11/24 20:37:46:720 GMT [DEBUG] wire - http-outgoing-0 << "Server:
> >> Apache-Coyote/1.1[\r][\n]"
> >> 2011/11/24 20:37:46:720 GMT [DEBUG] wire - http-outgoing-0 <<
> >> "Content-Type:
> >> application/atom+xml[\r][\n]"
> >> 2011/11/24 20:37:46:721 GMT [DEBUG] wire - http-outgoing-0 <<
> >> "Content-Length: 299[\r][\n]"
> >> 2011/11/24 20:37:46:721 GMT [DEBUG] wire - http-outgoing-0 << "Date: Thu,
> >> 24
> >> Nov 2011 20:37:46 GMT[\r][\n]"
> >> 2011/11/24 20:37:46:721 GMT [DEBUG] wire - http-outgoing-0 << "[\r][\n]"
> >> 2011/11/24 20:37:46:722 GMT [DEBUG] wire - http-outgoing-0 << "<?xml
> >> version="1.0" encoding="UTF-8" standalone="yes"?><entry
> >> xmlns="http://www.w3.org/2005/Atom"
> >> xmlns:ns2="http://a9.com/-/spec/opensearch/1.1/"
> >> xmlns:ns3="http://www.w3.org/1999/xhtml"><id>helloworld:1</id><updated>2011-11-24T20:37:46.708Z</updated><title
> >> type="text">Hello World!</title></entry>"
> >> 2011/11/24 20:37:46:732 GMT [DEBUG] headers - http-outgoing-0 << HTTP/1.1
> >> 200 OK
> >> 2011/11/24 20:37:46:732 GMT [DEBUG] headers - http-outgoing-0 << Server:
> >> Apache-Coyote/1.1
> >> 2011/11/24 20:37:46:732 GMT [DEBUG] headers - http-outgoing-0 <<
> >> Content-Type: application/atom+xml
> >> 2011/11/24 20:37:46:732 GMT [DEBUG] headers - http-outgoing-0 <<
> >> Content-Length: 299
> >> 2011/11/24 20:37:46:732 GMT [DEBUG] headers - http-outgoing-0 << Date:
> >> Thu,
> >> 24 Nov 2011 20:37:46 GMT
> >> 2011/11/24 20:37:46:737 GMT [DEBUG] HttpAsyncClientProtocolHandler -
> >> http-outgoing-0 [ACTIVE] Response received
> >> 2011/11/24 20:37:46:737 GMT [DEBUG] DefaultHttpAsyncClient - Response:
> >> HTTP/1.1 200 OK
> >> 2011/11/24 20:37:46:742 GMT [DEBUG] HttpAsyncClientProtocolHandler -
> >> http-outgoing-0 [ACTIVE] Input ready [content length: 299; pos: 0;
> >> completed: false]
> >> 2011/11/24 20:37:46:742 GMT [DEBUG] DefaultHttpAsyncClient - Response
> >> fully
> >> read
> >> GET http://localhost:8080/Test2/rest/world HTTP/1.1->HTTP/1.1 200 OK
> >> 2011/11/24 20:37:46:749 GMT [DEBUG] DefaultHttpAsyncClient - Connection
> >> can
> >> be kept alive indefinitely
> >> 2011/11/24 20:37:46:749 GMT [DEBUG] DefaultHttpAsyncClient - Response
> >> processed
> >> 2011/11/24 20:37:46:750 GMT [DEBUG] PoolingAsyncClientConnectionManager -
> >> Connection [id: 0][route: HttpRoute[{}->http://localhost:8080]] can be
> >> kept
> >> alive indefinitely
> >> 2011/11/24 20:37:46:750 GMT [DEBUG] PoolingAsyncClientConnectionManager -
> >> Connection released: [id: 0][route:
> >> HttpRoute[{}->http://localhost:8080]][total kept alive: 1; route
> >> allocated:
> >> 1 of 2; total allocated: 1 of 20]
> >> 2011/11/24 20:37:46:751 GMT [DEBUG] PoolingAsyncClientConnectionManager -
> >> Connection manager is shutting down
> >> 2011/11/24 20:37:46:751 GMT [DEBUG] IOSessionImpl - http-outgoing-0
> >> 127.0.0.1:61717<->127.0.0.1:8080[ACTIVE][r:r]: Shutdown
> >> 2011/11/24 20:37:46:753 GMT [DEBUG] IOSessionImpl - http-outgoing-0
> >> 127.0.0.1:61717<->127.0.0.1:8080[CLOSED][]: Shutdown
> >> Done
> >> 2011/11/24 20:37:46:754 GMT [DEBUG] HttpAsyncClientProtocolHandler -
> >> http-outgoing-0 [CLOSED]: Disconnected
> >> 2011/11/24 20:37:46:756 GMT [DEBUG] PoolingAsyncClientConnectionManager -
> >> Connection manager shut down
> >>
> >>
> >
> > And what exactly is the problem here? I see nothing wrong here. I see no
> > reason why the connection should time out.
> >
> > Oleg
> >
> >>
> >>
> >>
> >>
> >>
> >>
> >> olegk wrote:
> >> >
> >> > On Wed, Nov 23, 2011 at 03:19:16PM -0800, richevo wrote:
> >> >>
> >> >> I am using the latest HttpAsync library 4. alpha3
> >> >>
> >> >> Is there an issue where the timeout for the connection is not
> >> respected?
> >> >> I
> >> >> have set the timeout to 10 seconds and call a web service that takes a
> >> >> minute to respond. I never experience a timeout. The AsyncHttpClient
> >> >> waits
> >> >> forever.
> >> >>
> >> >> I've configured the timeouts as per the example code in Async.
> >> >>
> >> >> Is it obvious what I'm doing wrong?
> >> >
> >> > Please post a wire / context log of the session.
> >> >
> >> > Oleg
> >> >
> >> > ---------------------------------------------------------------------
> >> > To unsubscribe, e-mail: [email protected]
> >> > For additional commands, e-mail: [email protected]
> >> >
> >> >
> >> >
> >>
> >> --
> >> View this message in context:
> >> http://old.nabble.com/HttpAsyncClient-4.0-alpha3-and-timeouts-tp32874649p32875604.html
> >> Sent from the HttpClient-User mailing list archive at Nabble.com.
> >>
> >>
> >> ---------------------------------------------------------------------
> >> To unsubscribe, e-mail: [email protected]
> >> For additional commands, e-mail: [email protected]
> >>
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: [email protected]
> > For additional commands, e-mail: [email protected]
> >
> >
> >
>
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]