Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.java.programmer > #28014

thread pool with waiting option

From Philipp Kraus <philipp.kraus@flashpixx.de>
Newsgroups comp.lang.java.programmer
Subject thread pool with waiting option
Date 2014-04-10 14:37 +0200
Organization Clausthal University of Technology
Message-ID <li63ac$1dqe$1@ariadne.rz.tu-clausthal.de> (permalink)

Show all headers | View raw


Hello,

I would like to create a thread pool for a simulation environment. I 
use a pool with objects an each object must be run once in a time step, 
eg in pseudo code:

while (true)
{
     each thread in thread pool
     {
         get object from working list
     	object.run
         push object into finished list
     }
     wait for all threads are finished
     swap finished list with working list

     if user sends a wait signal
        wait
     if user sends a stop signal
     {
         clear working list
         clear finish list
         remove all threads
         break
    }
}

Which datastructures can be used in Java for this structure? IMHO I 
would like to use ExecutorService
but how can I create a pool which can be run again? In which way can I 
create a good and fast solution?

Hope for some ideas for this problem. Thanks a lot

Phil

Back to comp.lang.java.programmer | Previous | Next — Next in thread | Find similar | Unroll thread


Thread

thread pool with waiting option Philipp Kraus <philipp.kraus@flashpixx.de> - 2014-04-10 14:37 +0200
  Re: thread pool with waiting option markspace <markspace@nospam.nospam> - 2014-04-10 08:36 -0700
    Re: thread pool with waiting option Philipp Kraus <philipp.kraus@flashpixx.de> - 2014-04-10 18:06 +0200
      Re: thread pool with waiting option markspace <markspace@nospam.nospam> - 2014-04-10 09:22 -0700
      Re: thread pool with waiting option Jeff Higgins <jeff@invalid.invalid> - 2014-04-11 12:40 -0400
  Re: thread pool with waiting option Jeff Higgins <jeff@invalid.invalid> - 2014-04-10 12:02 -0400
    Re: thread pool with waiting option Jeff Higgins <jeff@invalid.invalid> - 2014-04-10 12:40 -0400
      Re: thread pool with waiting option Jeff Higgins <jeff@invalid.invalid> - 2014-04-10 12:52 -0400
        Re: thread pool with waiting option Jeff Higgins <jeff@invalid.invalid> - 2014-04-10 15:31 -0400
          Re: thread pool with waiting option markspace <markspace@nospam.nospam> - 2014-04-11 08:16 -0700
            Re: thread pool with waiting option Jeff Higgins <jeff@invalid.invalid> - 2014-04-11 12:27 -0400
              Re: thread pool with waiting option markspace <markspace@nospam.nospam> - 2014-04-11 09:58 -0700
                Re: thread pool with waiting option Jeff Higgins <jeff@invalid.invalid> - 2014-04-11 13:17 -0400
                Re: thread pool with waiting option Jeff Higgins <jeff@invalid.invalid> - 2014-04-11 13:33 -0400
                Re: thread pool with waiting option Jeff Higgins <jeff@invalid.invalid> - 2014-04-11 17:23 -0400
                Re: thread pool with waiting option markspace <markspace@nospam.nospam> - 2014-04-12 16:24 -0700
                Re: thread pool with waiting option markspace <markspace@nospam.nospam> - 2014-04-12 16:44 -0700
                Re: thread pool with waiting option Jeff Higgins <jeff@invalid.invalid> - 2014-04-12 21:17 -0400
                Re: thread pool with waiting option markspace <markspace@nospam.nospam> - 2014-04-12 20:12 -0700
  Re: thread pool with waiting option Josip Almasi <joe@vrspace.org> - 2014-04-12 14:00 +0200
    Re: thread pool with waiting option Josip Almasi <joe@vrspace.org> - 2014-04-12 14:01 +0200
      Re: thread pool with waiting option Jeff Higgins <jeff@invalid.invalid> - 2014-04-12 10:38 -0400
        Re: thread pool with waiting option Jeff Higgins <jeff@invalid.invalid> - 2014-04-12 11:48 -0400

csiph-web