Velocity Reviews

Velocity Reviews (http://www.velocityreviews.com/forums/index.php)
-   Java (http://www.velocityreviews.com/forums/f30-java.html)
-   -   Delay in thread startup? (http://www.velocityreviews.com/forums/t127685-delay-in-thread-startup.html)

Tim Ward 10-16-2003 10:01 AM

Delay in thread startup?
 
[I've tried searching for any previous discussion of this problem but none
of the keywords I can think of are specific enough to turn up anything
useful.]

I'm starting up up 30 threads at once.

Each is started by a Runnable-derived class doing this:

thread = new Thread(this, addr);
thread.start();

I log the time at which control returns from thread.start(); all 30 of them
return very close together.

Next, I'm logging the time at which each thread's run() starts running, the
logger call being the first line in the run().

The run methods are called at intervals of around two seconds, so something
somewhere seems to be serialising thread creation and putting a two second
delay (approx) between each, and I'm pretty sure it isn't any of the Java
code I'm running (some of which is mine and some of which is inherited).

Whilst this is happening CPU loading is quite low, so it's not caused by a
lack of CPU cycles. It's not the logger calls that are doing it either, as
overall behaviour of the application was the same before I added the logger
calls, all the logger calls are doing is telling me where the delay is.

(Of course the application doesn't work, as it's got timeouts way shorter
than the 50 seconds or so it takes for the last thread to start running and
it has long since given up and marked everything as failed.)

Questions:

(1) Am I imagining this delay, or is it really happening?
(2) What and where and why is it?
(3) How do I stop it?

--
Tim Ward
Brett Ward Limited - www.brettward.co.uk



Tim Ward 10-16-2003 12:56 PM

Re: Delay in thread startup?
 
"Tim Ward" <tw2@ipaccess.com> wrote in message
news:bmlqaj$ogvs7$1@ID-154437.news.uni-berlin.de...
>
> The run methods are called at intervals of around two seconds, so

something
> somewhere seems to be serialising thread creation and putting a two second
> delay (approx) between each, and I'm pretty sure it isn't any of the Java
> code I'm running (some of which is mine and some of which is inherited).


Turns out to be the Netbeans debugger that's doing this.

--
Tim Ward
Brett Ward Limited - www.brettward.co.uk




All times are GMT. The time now is 05:30 AM.

Powered by vBulletin®. Copyright ©2000 - 2014, vBulletin Solutions, Inc.
SEO by vBSEO ©2010, Crawlability, Inc.