RE: parallel processes and thread.sleep

"He Wei" <[email protected]> Wed, 17 Aug 2005 17:22:43 +0800
Newsgroups gmane.comp.java.enhydra.shark
Message-ID <20050817092246.HJQI1195.morpheus2.pacific.net.sg@weihenb>
Hello Vlada,

I have tested according to what you suggested to start a new thread for each
process instance. However the results show they are still running in
sequence based on the sequence to run them, but not in parallel. Could you
please kindly advice further? Thank you very much.
(pl. my process contains only automatic activities.)
Best Regards,
He Wei

-----Original Message-----
From: Vladimir Puskas [mailto:[email protected]] 
Sent: Wednesday, August 17, 2005 3:54 PM
To: [email protected]
Subject: Re: [shark] parallel processes and thread.sleep

Hello He Wei

you wrote:
> Dear Vlada,
> 
> Regarding to the question in the email below, could you please kindly
> explain more how to "let your application start a new Thread for those 5
> instances" to make it *really* parallel?

Since Shark does not start a new thread, your application must, for 
scenario you described.

       //final SharkConnection sc;
       //final Map workflowRelevantData;
       for (int i = 0; i < 5; i++) {
          new Thread() {
             public void run() {
                try {
                   WfProcess theProcess = sc.createProcess("pkg","pdef");
                   theProcess.set_process_context(workflowRelevantData);
                   theProcess.start();
                } catch (RootException e) {
                   e.printStackTrace();
                }
             }
          }.start();
       }


> Thank you very much.
> Best Regards,
> He Wei
> 
> -----Original Message-----
> From: Vladimir Puskas [mailto:[email protected]] 
> Sent: Wednesday, July 20, 2005 4:55 PM
> To: [email protected]
> Subject: Re: [shark] parallel processes and thread.sleep
> 
> Hello Sebastian
> 
> you wrote:
> 
>>hi list,
>> 
>>i try to realise some parallel processes (instances) and each of them
>>uses the javascript-agent with java.lang.thread.sleep(20000). after that
>>break, the process sends an email. now, i have the following problem:
>>i start 5 processes at the same time.
>>the first process starts, waits 20 seconds and sends an email.
>>then, after that 20 seconds, the second process waits 20 seconds and
>>sends an email.
>>then, after 40 seconds, the thrid process waits 20 seconds and sends an
>>email.
>>...
>>is it possible, that all the processes start at the same time, wait 20
>>seconds and send then an email? i tried the beer pause example too -
>>same result.
> 
> 
> POJO Shark is library, so it won't open a new thread to execute process.
> If your tool-agent says sleep 20sec Shark will obey, and your
> application will too, that's why these process instances were executed 
> in sequence :-)
> 
> To make it *really* parallel let your application start a new Thread for
> those 5 instances, or use Scheduler tool-agent in your xpdl (like
> test-Scheduler.xpdl).

hope this helps
-- 
Vlada
message-footer.txt (text/plain, 271 B)
--
You receive this message as a subscriber of the [email protected] mailing list.
To unsubscribe: mailto:[email protected]
For general help: mailto:[email protected]?subject=help
ObjectWeb mailing lists service home page: http://www.objectweb.org/wws