Delay in thread startup?

Discussion in 'Java' started by Tim Ward, Oct 16, 2003.

  1. Tim Ward

    Tim Ward Guest

    [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, Oct 16, 2003
    #1
    1. Advertising

  2. Tim Ward

    Tim Ward Guest

    "Tim Ward" <> wrote in message
    news:bmlqaj$ogvs7$-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
    Tim Ward, Oct 16, 2003
    #2
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Wally

    Startup key

    Wally, Oct 19, 2004, in forum: ASP .Net
    Replies:
    2
    Views:
    650
    Jeff Johnson [MVP: VB]
    Oct 19, 2004
  2. Chris Zopers

    Startup delay due to compiling

    Chris Zopers, Jun 23, 2008, in forum: ASP .Net
    Replies:
    4
    Views:
    265
  3. David J. Berman

    Web Services client software has substantial delay on startup

    David J. Berman, Aug 2, 2007, in forum: ASP .Net Web Services
    Replies:
    9
    Views:
    285
  4. chris guenther
    Replies:
    0
    Views:
    105
    chris guenther
    Apr 10, 2005
  5. jvivenot
    Replies:
    1
    Views:
    82
    jvivenot
    Jun 17, 2006
Loading...

Share This Page