• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Tim Cooke
  • Campbell Ritchie
  • Ron McLeod
  • Liutauras Vilda
  • Jeanne Boyarsky
Sheriffs:
  • Junilu Lacar
  • Rob Spoor
  • Paul Clapham
Saloon Keepers:
  • Tim Holloway
  • Tim Moores
  • Jesse Silverman
  • Stephan van Hulst
  • Carey Brown
Bartenders:
  • Al Hobbs
  • Piet Souris
  • Frits Walraven

running process in thread??

 
Greenhorn
Posts: 16
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
In my application I kick off a batch file that runs osql commands and executes scripts for our dbas. There are some scripts that I can run in parallel and so I am now creating threads to run those. However I still see a serialized execution of threads one after another.

Is this even possible to kick off processes (using Runtime.exec) in a thread run() method and expect it to run concurrently??
Would my running process be blocking the parent process and so the sibling threads for running at all??

How can I achieve what I am looking for..

please help
 
Amit Da
Greenhorn
Posts: 16
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I found the issue. The code was just not going in right block that would kick off threads but would go in the serialized block.(as I have support for both modes).
With that fixed the processes do INDEED run in parallel, kicked off from threads..wonderful
 
(instanceof Sidekick)
Posts: 8791
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
the exec() method is asynchronous by itself. If you just start a bunch of them they'll run in parallel. Do you waitFor() to know when they're done? That would make you wait until one finishes before starting the next.
 
Don't get me started about those stupid light bulbs.
reply
    Bookmark Topic Watch Topic
  • New Topic