🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: borland.public.jbuilder.java.language
Article #8625

Re: Killing a blocked thread...

#8625
From: Joi Ellis [TeamB]
Date: Mon, 12 Mar 2001 17:29
30 lines
2156 bytes
Kashif Dastgir <kdastgir@yahoo.com> wrote:
> Thanks Torsten,

> Atleast it'll help me to handle the situations where i do have access to I/O
> device of the input class, if not everywhere. However, it seems to be a very
> trivial and common thing, and i'm rather surprised that there doesn't seem
> to be a way out.

> Thanks anyways... and regards!
> Kashif

Here's some info that you might be able to reuse:

http://developer.java.sun.com/developer/technicalArticles/Networking/timeouts/index.html

Pages 79 through 85 of O'Reilly's "Java Threads" book discusses interrupting
blocked I/O threads.  To Summarize, the ability to use Thread.interrupt() on
a thread in an I/O block is JVM-dependent.  It works on Solaris native threads,
but not at all on Windows.

The book says the best way to terminate a blocked thread is to close the
I/O stream/socket/whatever it's blocking on.  That should send an exception
through the I/O class.  The exception you'll get varies with the JVM, it
might be a SocketException, an InterruptedIOException, or something else.

-- 
Joi Ellis (TeamB) 
No direct email, please.
For best results, post on news server newsgroups.borland.com!
Newsgroup Info: http://www.borland.com/newsgroups/guide.html
Technical Details
Message-ID: <98j119$f739@bornews.inprise.com>
Path: arc1-ca.pugleaf.net!supernews.google.com!sn-xit-03!supernews.com!news-out.usenetserver.com!news-out-sjo.usenetserver.com!newsfeed.direct.ca!look.ca!newsfeed.icl.net!newsfeed.icl.net!skynet.be!newsfeed01.tsnz.net!bornews.borland.com!not-for-mail
References: <98gdng$3s62@bornews.inprise.com> <3aabe6be_1@dnews> <98iq5v$bdc6@bornews.inprise.com>

Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit
X-Google-Thread: f74b3,ce7e5a0605d83b15
X-Google-Attributes: gidf74b3,public
X-Google-ArrivalTime: 2001-03-12 09:36:02 PST
Path: arc1-ca.pugleaf.net!supernews.google.com!sn-xit-03!supernews.com!news-out.usenetserver.com!news-out-sjo.usenetserver.com!newsfeed.direct.ca!look.ca!newsfeed.icl.net!newsfeed.icl.net!skynet.be!newsfeed01.tsnz.net!bornews.borland.com!not-for-mail
From: "Joi Ellis [TeamB]" <joi@aravox.com>
Newsgroups: borland.public.jbuilder.java.language
Subject: Re: Killing a blocked thread...
Date: 12 Mar 2001 17:29:13 GMT
Organization: Another Netscape Collabra Server User
Lines: 30
Message-ID: <98j119$f739@bornews.inprise.com>
References: <98gdng$3s62@bornews.inprise.com> <3aabe6be_1@dnews> <98iq5v$bdc6@bornews.inprise.com>
NNTP-Posting-Host: linux.aravox.com
User-Agent: tin/1.4.2-20000205 ("Possession") (UNIX) (Linux/2.2.16-3 (i686))