Re: Thread-end monitoring



On Sun, 12 Nov 2006 13:58:23 -0000, mark <mkazmierski@xxxxxxxxx> wrote:

Hello,

I have constructed several threads in my application (it is such that
some threads start other threads, etc.). Now I would like to have a
possibility to execute some actions just when all the threads finished
(i.e. go out from the run function). Is there any nice way to do it?

Regards, mark

Depending on how your threads are arranged, you can use a CountdownLatch or a CyclicBarrier from the java.util.concurrent package.

Dan.

--
Daniel Dyer
http://www.uncommons.org
.



Relevant Pages

  • Re: How to override an abstract method returning an interface type
    ... Daniel Dyer wrote: ... > I usually use NotImplementedException() for this purpose. ... the fact it's in the Sun namespace and that the package names imply some connection with reflection and generics would make we shy away from using it. ... I've configured my eclipse to do the same as Oliver's does, only I my config for methods, looks like..... ...
    (comp.lang.java.help)
  • Re: Synchronization Question
    ... such a scenario; specifically, CountDownLatch or CyclicBarrier, both of ... which specifically deal with synchronizing multiple threads once they've ...
    (comp.lang.java.programmer)
  • Re: Thread-end monitoring
    ... or a CyclicBarrier from the java.util.concurrent package. ... again) so using it I think will make java to keep every thread running ... and what I want is just to allow the garbage collector to remove them ...
    (comp.lang.java.programmer)
  • Re: silly Math question from Fortran programmer
    ... since the classes of the java.lang package are imported implicitly. ... functions with "Math." ... Assuming that you are using Java 5 or later, then you can use a static import: ... Daniel Dyer ...
    (comp.lang.java.programmer)
  • Re: How to override an abstract method returning an interface type
    ... the sun.reflect.generics package, and it's not documented AFAIK, so I'm not sure if that's the intended purpose... ... Daniel Dyer ...
    (comp.lang.java.help)