Article View: borland.public.jbuilder.java.api
Article #1523Re: The affect of thread.interupt() ??
From: Dan Tran
Date: Wed, 21 Nov 2001 17:32
Date: Wed, 21 Nov 2001 17:32
58 lines
2302 bytes
2302 bytes
Here is a snippet of my run() method
public void run()
{
while ( !_done )
{
if ( doWork() ) //would an external interupt harm
this task?
continue;
try
{
//waiting for an interrupt to continue
sleep(0x7FFFFFFF);
}
catch (InterruptedException e )
{
}
}
}
Any suggestion?
-D
"Greg Hamer" <ghamer@troikanetworks.com> wrote in message
news:3bfbe126$1_2@dnews...
> Code that can calls methods that can throw this exception have to be in
try
> blocks, so unless the catch does something stupid, you should be okay.
> Normally you just eat this exception. You can tell later if it happened
with
> the isInterrupted() method of Thread. You must be printing a stack trace
in
> your catch.
>
> "Dan Tran" <danttran@hotmail.com> wrote in message
> news:3bfbdd19$1_1@dnews...
> > Hi,
> >
> > I have a running thread (processing some task) and it receives an
external
> > interrupt via Thread.interrupt().
> >
> > I see a java.lang.InterruptedException msg showing my in my Jbuilder
> > console.
> >
> > Would this cause any harm? Would this abort the running task??
> >
> > Any suggestion?
> >
> > -Dan
> >
> >
>
>
Technical Details
Message-ID:
<3bfbe517$1_1@dnews>Path:
arc1-ca.pugleaf.net!archiver1.google.com!news1.google.com!sn-xit-02!sn-xit-04!supernews.com!europa.netcrusader.net!usenetserver.com!4.1.16.34!cpk-news-hub1.bbnplanet.com!lsanca1-snf1!news.gtei.net!enterprise!news.xtra.co.nz!newsfeeds.ihug.co.nz!ihug.co.nz!dnewsReferences:
<3bfbdd19$1_1@dnews> <3bfbe126$1_2@dnews>Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 1089d0,71862bc66236ba1d X-Google-Attributes: gid1089d0,public X-Google-ArrivalTime: 2001-11-21 09:34:14 PST From: "Dan Tran" <danttran@hotmail.com> Newsgroups: borland.public.jbuilder.java.api References: <3bfbdd19$1_1@dnews> <3bfbe126$1_2@dnews> Subject: Re: The affect of thread.interupt() ?? Date: Wed, 21 Nov 2001 09:32:06 -0800 Lines: 60 X-Priority: 3 X-MSMail-Priority: Normal X-Newsreader: Microsoft Outlook Express 6.00.2600.0000 X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2600.0000 NNTP-Posting-Host: 65.113.98.34 Message-ID: <3bfbe517$1_1@dnews> X-Trace: dnews 1006363927 65.113.98.34 (21 Nov 2001 09:32:07 -0800) Path: arc1-ca.pugleaf.net!archiver1.google.com!news1.google.com!sn-xit-02!sn-xit-04!supernews.com!europa.netcrusader.net!usenetserver.com!4.1.16.34!cpk-news-hub1.bbnplanet.com!lsanca1-snf1!news.gtei.net!enterprise!news.xtra.co.nz!newsfeeds.ihug.co.nz!ihug.co.nz!dnews