Article View: borland.public.jbuilder.java.api
Article #1404Re: Detecting when a process is finished
From: John Baker
Date: Thu, 03 Jan 2002 13:34
Date: Thu, 03 Jan 2002 13:34
13 lines
1644 bytes
1644 bytes
If you want a more event based system you can create a ProcessManager which keeps a pool of threads and uses one of these threads to call .waitFor() and fire an event when the block is released and then put the thread back in the pool. Your client code can just ask the processmanager to delegate resonsibility. This is good for swing GUI apps. You don't really want to call .waitFor() from the gui event thread or you will tie things up. > > I would like to run an external process using Runtime > > class (exec method) and get notification when it is done > > (by blocking or callback). > > The exec() method returns a Process object. Calling waitFor() on > this object will block until it completes and return the exit status.
Technical Details
Message-ID:
<3c345e2e$1_2@dnews>Path:
arc1-ca.pugleaf.net!archiver1.google.com!news1.google.com!sn-xit-02!supernews.com!newsfeed.direct.ca!look.ca!news.maxwell.syr.edu!newsfeed.wirehub.nl!PeerFeed.KWeb.on.ca!dnewsReferences:
<3c300794_1@dnews> <MPG.169a3ee7677bcbe398af6b@forums.borland.com>Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 1089d0,70f9914a267a876b X-Google-Attributes: gid1089d0,public X-Google-ArrivalTime: 2002-01-03 05:36:45 PST From: "John Baker" <jbaker@SoftComms.com> Newsgroups: borland.public.jbuilder.java.api References: <3c300794_1@dnews> <MPG.169a3ee7677bcbe398af6b@forums.borland.com> Subject: Re: Detecting when a process is finished Date: Thu, 3 Jan 2002 13:34:44 -0000 Lines: 16 X-Priority: 3 X-MSMail-Priority: Normal X-Newsreader: Microsoft Outlook Express 5.00.2314.1300 X-MimeOLE: Produced By Microsoft MimeOLE V5.00.2314.1300 NNTP-Posting-Host: 217.135.229.231 Message-ID: <3c345e2e$1_2@dnews> X-Trace: dnews 1010064942 217.135.229.231 (3 Jan 2002 05:35:42 -0800) Path: arc1-ca.pugleaf.net!archiver1.google.com!news1.google.com!sn-xit-02!supernews.com!newsfeed.direct.ca!look.ca!news.maxwell.syr.edu!newsfeed.wirehub.nl!PeerFeed.KWeb.on.ca!dnews