bigdata-mx / j-calais

j-calais a Java RESTful interface to the http://www.opencalais.com/ API
Apache License 2.0
0 stars 2 forks source link

Set timeout in connection method #5

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
Hi!
We are using j-calais in development and experiencing some issue I wanted to 
ask you about.
We have 10 threads sending text for analysis in OpenCalais.
After running happily for some time they seem to get stuck on socket read (see 
exception below).
I looked at the source code, and it seems you don't define timeout on the 
connection open in the post method.
Can it be the case?
Thanks,

java.lang.Thread.State: RUNNABLE
   at java.net.SocketInputStream.socketRead0(Native Method)
   at java.net.SocketInputStream.read(SocketInputStream.java:150)
   at java.net.SocketInputStream.read(SocketInputStream.java:121)
   at java.io.BufferedInputStream.read1(BufferedInputStream.java:273)
   at java.io.BufferedInputStream.read(BufferedInputStream.java:334)
   - locked <0x0a24bb50> (a java.io.BufferedInputStream)
   at sun.net.www.MeteredStream.read(MeteredStream.java:134)
   - locked <0x0a2ce0e0> (a sun.net.www.http.KeepAliveStream)
   at java.io.FilterInputStream.read(FilterInputStream.java:133)
   at sun.net.www.protocol.http.HttpURLConnection$HttpInputStream.read(HttpURLConnection.java:2959)
   at sun.nio.cs.StreamDecoder.readBytes(StreamDecoder.java:283)
   at sun.nio.cs.StreamDecoder.implRead(StreamDecoder.java:325)
   at sun.nio.cs.StreamDecoder.read(StreamDecoder.java:177)
   - locked <0x0a24bc60> (a java.io.InputStreamReader)
   at java.io.InputStreamReader.read(InputStreamReader.java:184)
   at java.io.Reader.read(Reader.java:100)
   at com.google.common.io.CharStreams.copy(CharStreams.java:202)
   at com.google.common.io.CharStreams.toStringBuilder(CharStreams.java:248)
   at com.google.common.io.CharStreams.toString(CharStreams.java:222)
   at mx.bigdata.jcalais.rest.CalaisRestClient.post(CalaisRestClient.java:147)
   at mx.bigdata.jcalais.rest.CalaisRestClient.analyze(CalaisRestClient.java:116)

Original issue reported on code.google.com by elmer.garduno@gmail.com on 27 Feb 2012 at 6:20

GoogleCodeExporter commented 9 years ago

Original comment by elmer.garduno@gmail.com on 27 Feb 2012 at 6:21

GoogleCodeExporter commented 9 years ago

Original comment by elmer.garduno@gmail.com on 27 Feb 2012 at 6:22