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


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

Re: thread pool

From Eric Sosman <esosman@comcast-dot-net.invalid>
Newsgroups comp.lang.java.programmer
Subject Re: thread pool
Date 2014-07-22 17:14 -0400
Organization A noiseless patient Spider
Message-ID <lqmk8d$e3m$1@dont-email.me> (permalink)
References <lqlna0$23fm$1@ariadne.rz.tu-clausthal.de> <lqlntl$gcc$1@dont-email.me> <lqmekf$mh1$1@online.de> <lqmhk2$pnm$1@dont-email.me> <lqmjf2$656$1@online.de>

Show all headers | View raw


On 7/22/2014 5:01 PM, Philipp Kraus wrote:
>[... ugly double-spaced Googlejunk snipped ...]
> My solution seems to be similar, but if I run your startThreads again
> thet.start();
>
> throws the InterruptedException directly, so I do
>
> main()
> {
> Master x = new Master();
>
> x.startThreads(5);
> x.stopThreads();
> x.startThreads(5); <= this does not work because the exception is thrown
> }

     Are you sure startThreads() is creating and starting brand-
new Threads each time it's called, not re-using old Threads?
To put it another way, are you sure stopThreads() actually stops
all the old Threads and waits for them to finish stopping (and
then clears its "running workers" list)?

     I cannot imagine how a newly-created Thread would find itself
in the interrupted state before anything interrupts it.  Is there
some other part of your program that interrupts Threads when it
shouldn't?

-- 
esosman@comcast-dot-net.invalid

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


Thread

thread pool Philipp Kraus <philipp.kraus@flashpixx.de> - 2014-07-22 15:00 +0200
  Re: thread pool Eric Sosman <esosman@comcast-dot-net.invalid> - 2014-07-22 09:11 -0400
    Re: thread pool Philipp Kraus <philipp.kraus@flashpixx.de> - 2014-07-22 16:32 +0200
    Re: thread pool Philipp Kraus <philipp.kraus@flashpixx.de> - 2014-07-22 21:38 +0200
      Re: thread pool Eric Sosman <esosman@comcast-dot-net.invalid> - 2014-07-22 16:29 -0400
        Re: thread pool Philipp Kraus <philipp.kraus@flashpixx.de> - 2014-07-22 23:01 +0200
          Re: thread pool Eric Sosman <esosman@comcast-dot-net.invalid> - 2014-07-22 17:14 -0400
            Re: thread pool Philipp Kraus <philipp.kraus@flashpixx.de> - 2014-07-23 08:11 +0200
              Re: thread pool Eric Sosman <esosman@comcast-dot-net.invalid> - 2014-07-23 07:24 -0400
                Re: thread pool Philipp Kraus <philipp.kraus@flashpixx.de> - 2014-07-23 15:57 +0200
                Re: thread pool Eric Sosman <esosman@comcast-dot-net.invalid> - 2014-07-23 11:41 -0400
                Re: thread pool Philipp Kraus <philipp.kraus@flashpixx.de> - 2014-07-24 09:55 +0200
                Re: thread pool Eric Sosman <esosman@comcast-dot-net.invalid> - 2014-07-24 08:39 -0400
  Re: thread pool Kevin McMurtrie <mcmurtrie@pixelmemory.us> - 2014-07-24 20:50 -0700

csiph-web