Re: parallel processes and thread.sleep
Monique Maker <[email protected]> Wed, 17 Aug 2005 13:00:39 +0300
| Newsgroups | gmane.comp.java.enhydra.shark |
|---|---|
| Message-ID | <[email protected]> |
Hello He Wei, Probably your processes are "too fast" (as they should be according to Shark documentation) and each process manages to run in a single thread "switch", i.e. before the JVM manages to give execution time to another thread. Please explain why do you need to run several processes in parralel. Please note that (almost) any solution will be similar to Java execution of one and the same code in non-synchronized threads - you never know what part of the code is executed in each thread. Best Regards, Monique He Wei wrote: > 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
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