Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Java > Preventing eternal hang

Reply
Thread Tools

Preventing eternal hang

 
 
Ike
Guest
Posts: n/a
 
      12-20-2004
Is there a way I can wrap the following in such a manner such that if no
value is returned by after X seconds, the method throws an IOException ?

private InputStream getFromServlet( URLConnection uc) throws
java.io.IOException {
return uc.getInputStream();
}

I know in 1.5 this is built into getInputStream, but I need compatibility to
lower-version JVMs. Thanks, Ike


 
Reply With Quote
 
 
 
 
Andrea Desole
Guest
Posts: n/a
 
      12-20-2004
I would put it in a separate thread. You can interrupt this thread after
a timeout. It should work


Ike wrote:
> Is there a way I can wrap the following in such a manner such that if no
> value is returned by after X seconds, the method throws an IOException ?
>
> private InputStream getFromServlet( URLConnection uc) throws
> java.io.IOException {
> return uc.getInputStream();
> }
>
> I know in 1.5 this is built into getInputStream, but I need compatibility to
> lower-version JVMs. Thanks, Ike
>
>

 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Eternal Debate: Cookies vs. Sessions vs. QueryString =?Utf-8?B?UGF1bA==?= ASP .Net 6 12-12-2005 07:43 PM
DVD Verdict reviews: ETERNAL SUNSHINE OF THE SPOTLESS MIND and more! DVD Verdict DVD Video 0 11-15-2004 10:11 AM
New Releases: Cookout, Eternal Sunshine CE & Ice Station Zebra: Updated complete downloadable R1 DVD DB & info lists Doug MacLean DVD Video 0 10-26-2004 04:26 AM
Eternal Sunshine of the Spotless Mind Jeff Jones DVD Video 14 08-24-2004 12:51 AM
New Releases: Dawn of the Dead, Eternal Sunshine & American Dreams: Updated complete downloadable R1 DVD DB & info lists Doug MacLean DVD Video 4 06-17-2004 07:52 PM



Advertisments