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


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

Re: thread pool with waiting option

Path csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!feeder.erje.net!eu.feeder.erje.net!eternal-september.org!feeder.eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail
From markspace <markspace@nospam.nospam>
Newsgroups comp.lang.java.programmer
Subject Re: thread pool with waiting option
Date Thu, 10 Apr 2014 08:36:07 -0700
Organization A noiseless patient Spider
Lines 53
Message-ID <li6dpb$35o$1@dont-email.me> (permalink)
References <li63ac$1dqe$1@ariadne.rz.tu-clausthal.de>
Mime-Version 1.0
Content-Type text/plain; charset=ISO-8859-1; format=flowed
Content-Transfer-Encoding 7bit
Injection-Date Thu, 10 Apr 2014 15:36:11 +0000 (UTC)
Injection-Info mx05.eternal-september.org; posting-host="9358cda03e1e0dfd3c4b757daa608707"; logging-data="3256"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX185DxEQTAOqlQ7In0WRn16Rw3/A9C0DB+w="
User-Agent Mozilla/5.0 (Windows NT 6.1; WOW64; rv:24.0) Gecko/20100101 Thunderbird/24.4.0
In-Reply-To <li63ac$1dqe$1@ariadne.rz.tu-clausthal.de>
Cancel-Lock sha1:IzRdBwlbQtxEkrQh8e4WeBY4UfA=
Xref csiph.com comp.lang.java.programmer:28016

Show key headers only | View raw


What's your goal here?  What are you actually trying to accomplish or 
simulate?

It looks to me like you want something similar to fork/join, but your 
question only has a single implementation and no other clues as to what 
is going on.

Random comments inline:

On 4/10/2014 5:37 AM, Philipp Kraus wrote:
>
> while (true)
> {
>      each thread in thread pool
>      {
>          get object from working list
>          object.run
>          push object into finished list
>      }

This appears to run each task sequentially.  Not much "multi-threading" 
happening.

>      wait for all threads are finished
>      swap finished list with working list

?? Once a thread is finished, you want to run it again?  I don't think 
this will work like you expect.

>
>      if user sends a wait signal
>         wait
>      if user sends a stop signal

Use Thread.interrupt() to stop a thread.  If you don't do any IO you'll 
have to poll it yourself.

>      {
>          clear working list
>          clear finish list
>          remove all threads
>          break
>     }
> }
>
> Which datastructures can be used in Java for this structure? IMHO I

Your ideas are funky and I doubt there's one that can be used directly. 
  You may have to extend AbstractExecutor and just roll your own.


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