Hi Oleg,
thank you for that hint, but I think this it not, what I am looking
for.
Is there really nothing like "setReadTimeout(long timeout)?
Christian
Friday, July 29, 2005, 3:46:06 PM, you wrote:
> HttpMethod#abort() may be what you want. This method is threading safe,
> so it can be safely called from an observer thread that aborts the
> worker thread if it fails to terminate wintin the desired period of time
> Hope this helps
> Oleg
> On Fri, Jul 29, 2005 at 03:38:57PM +0200, Christian Hufgard wrote:
>> Hi,
>>
>> to prevent our application from suffering when dealing with slow systems, we
>> are using HttpClient.setTimeout() and
>> HttpClient.setConnectionTimeout().
>> Till today I tought, this would be enough.
>>
>> Now, during some testing, I found out, that we have a legacy system that
>> sometime tends to be really slow. We have data transfer rates below 1kB at
>> documentsizes more then 60k.
>>
>> Is there any way, to define an abort time? E.g. "read 20 seconds, if data is
>> still missing forget about it"?.
>>
>> At the moment I tend to use something like this:
>>
>> long start = System.currentTimeMillis();
>> int readTimeout = 20000;
>>
>> ByteArrayOutputStream dataStream = new ByteArrayOutputStream();
>> BufferedInputStream in = new
>> BufferedInputStream(s.getInputStream());
>> byte[] data = new byte[1024];
>> int avail;
>> while ((avail = in.read(data, 0, 1024)) != -1) {
>> dataStream.write(data, 0, avail);
>> long now = System.currentTimeMillis();
>> if (now - start > readTimeout) {
>> throw new IOException("Read timeout!");
>> }
>> }
>>
>> Is there any smarter way, that I just did not find?
>>
>>
>>
>> Christian
>>
>> --
>> GMX DSL = Maximale Leistung zum minimalen Preis!
>> 2000 MB nur 2,99, Flatrate ab 4,99 Euro/Monat: http://www.gmx.net/de/go/dsl
>>
>> ---------------------------------------------------------------------
>> 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]
--
Best regards,
Christian mailto:[EMAIL PROTECTED]
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]