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


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

Re: thread pool with waiting option

From markspace <markspace@nospam.nospam>
Newsgroups comp.lang.java.programmer
Subject Re: thread pool with waiting option
Date 2014-04-10 08:36 -0700
Organization A noiseless patient Spider
Message-ID <li6dpb$35o$1@dont-email.me> (permalink)
References <li63ac$1dqe$1@ariadne.rz.tu-clausthal.de>

Show all headers | 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