• Post Reply Bookmark Topic Watch Topic
  • New Topic

running process in thread??  RSS feed

 
Amit Da
Greenhorn
Posts: 16
  • Mark post as helpful
  • send pies
  • 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
  • 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
 
Stan James
(instanceof Sidekick)
Ranch Hand
Posts: 8791
  • Mark post as helpful
  • send pies
  • 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.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!