Second URL.openstream in second thread causes ProtocolException  
Author Message
jmail





PostPosted: 2007-5-11 7:25:00 Top

java-programmer, Second URL.openstream in second thread causes ProtocolException I have a multi-threaded Java http image proxy service application that
runs fine on Windows 2000. The app retrieves multiple, distinct images
from a webserver with one image retrieval process per thread. The
webserver images change every so often, but each distinct URL used in
my proxy service remains the same. Each thread repeats its image
download every few seconds to retrieve updated images. It all works
great.

I am trying to move this app to a Red Hat Fedora core 4 machine.
Almost everything works except I am getting a protocol exception when
I try to open a second URL stream in a second thread. Within seconds,
one of the threads will throw a ProtocolException error with error
text of '1.1/ 200 OK'. Any one stream/thread combo will work fine.
Trying to start another causes problems.

If I comment out the URL.openStream() call, I can start a dozen
threads, run them for as long as I want and stop them all quite
nicely. Again, all of the code works beautifully on Windows 2000. I'm
not sure if this is a Java problem or, perhaps, a Linux server
configuration problem.

It just seems that the Red Hat server/Java environment is having a
hard time having two http protocol discussions in two threads at the
same time. Occasionally, the threads will both succeed for a few
image revolutions, so there is a little inconsistency in when the
failure occurs.

gdhurst