ocjp 6 — Feeding a person with food is a great thing in this world. Feeding the same person by transferring the knowledge is far more better thing. The reason is the amount of satisfaction which we get through food is of only one minute or two. But the satisfaction which we can get through the knowledge is of life long.

In addition to showing what you have tried and where you have problems, consider this:

You have two actions that need to run sequentially, and whose results need to be shared. Threads are about running code concurrently, which you don't need. Sharing results between threads requires synchronization, which can be complicated. So why are you considering using Threads for this application when you don't need them for what they do and only complicate matters? Why not just run task 1 to completion, then run task 2 to completiion in the same code stream?

Steve

mark smith
Ranch Hand

Joined: Apr 05, 2005
Posts: 250

posted Apr 27, 2012 13:41:06

0

why to use thread to do 2 actions in same time? hum performance?

i think a solution would be to start 2 thread and use join on them to start another operation