Thread execution monitoring

M

mark

Hello,

I just want to create an app which would create a few threads (number
specified during the execution of main app). In addition I would like
to create JFrame with JProgressBar just to monitor online its execution
(i.e. when I create 5 threads, when first one finished then the
progress bar will go to 20%, after second to 40%, up to 100%). Is it
possible to do it easily in Java??

Regards, mark
 
M

Manish Pandit

The quick and easy way to achieve this IMO would be to implement a
lightweight ThreadManager, which every thread registers with upon
instantiation (run), and when it completes, it sends a message
(Callback) to this ThreadManager. That way, at any given point in time
the ThreadManager knows how many threads were spawned, completed, and
are under progress. The progressbar can listen to the ThreadManager via
publish/subscribe and render itself accordingly.

-cheers,
Manish
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,995
Messages
2,570,226
Members
46,815
Latest member
treekmostly22

Latest Threads

Top