Wrox Home  
Search P2P Archive for: Go

  Return to Index  

j2ee thread: RE: Skipping a task


Message #1 by Chanoch Wiggers <ChanochW@w...> on Thu, 24 May 2001 10:43:01 +0100
you need to make your application threaded. Look up any tutorials on
threading and they will show you how to skip a "site" if it is taking too
long. I am not sure what to do about the errors - are they coming up as
exceptions?

-----Original Message-----
From: Handy Mulia [mailto:handymulia@h...]
Sent: 06 April 2001 08:45
To: Java 2 Enterprise Edition
Subject: [j2ee] Skipping a task


Dear java friends, 

I have a small problem here...please help me 

I use Runtime to execute MS-DOS command (in while loop), 
it works well. 
The problem is sometimes a task is :
1. Too long to wait   OR
2. Returns error
for these problems, I need to skip and go to Next execution.


this is the important part of the code:
Runtime rt = Runtime.getRuntime(); 
Process proc;

  while(j<sites.length) {

                 proc = rt.exec(sitesparts);
                 proc.waitFor(); 
        j++;
  }/////////////////WHILE SITES




Does anybody know how to solve these 2 elementary problems ?


Thanks alot!


  Return to Index