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


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

Re: thread pool with waiting option

Path csiph.com!usenet.pasdenom.info!weretis.net!feeder1.news.weretis.net!newsfeed.CARNet.hr!gregory.BNet.hr!not-for-mail
From Josip Almasi <joe@vrspace.org>
Newsgroups comp.lang.java.programmer
Subject Re: thread pool with waiting option
Date Sat, 12 Apr 2014 14:00:28 +0200
Organization B.net Hrvatska d.o.o.
Lines 50
Message-ID <53492ADC.8020509@vrspace.org> (permalink)
References <li63ac$1dqe$1@ariadne.rz.tu-clausthal.de>
NNTP-Posting-Host cpe-94-253-156-208.zg.cable.xnet.hr
Mime-Version 1.0
Content-Type text/plain; charset=ISO-8859-1; format=flowed
Content-Transfer-Encoding 7bit
X-Trace gregory.bnet.hr 1397304028 9350 94.253.156.208 (12 Apr 2014 12:00:28 GMT)
X-Complaints-To abuse@globalnet.hr
NNTP-Posting-Date Sat, 12 Apr 2014 12:00:28 +0000 (UTC)
To Philipp Kraus <philipp.kraus@flashpixx.de>
User-Agent Mozilla/5.0 (X11; Linux x86_64; rv:24.0) Gecko/20100101 Thunderbird/24.4.0
In-Reply-To <li63ac$1dqe$1@ariadne.rz.tu-clausthal.de>
Xref csiph.com comp.lang.java.programmer:28041

Show key headers only | View raw


Hi,

think you could use Disruptors.
However, do not think in 'thread' terms, think producer/consumer.
Do not think 'get object from list', think 'receive event'.

HTH;)

Regards...

On 04/10/2014 02:37 PM, Philipp Kraus wrote:
> 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 — Previous in thread | 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