Setting a Thread name in a ThreadPool

classic Classic list List threaded Threaded
10 messages Options
Reply | Threaded
Open this post in threaded view
|

Setting a Thread name in a ThreadPool

David Harrigan
Hi,

Previously, if I wanted to set a thread name, I could so something like this:

new Thread(new RunnableTask(), "DoSomethingWonderfulThread").start();

now, if I'm delgating over to an Executors, like Executors.newCachedThreadPool(), and using that to execute my thread:

ExecutorService s = Executors.newCachedThreadPool();
s.execute(new RunnableTask());

The execute method isn't overloaded to provide a name, so, how do I go about setting the Thread name?

-=david=-
Reply | Threaded
Open this post in threaded view
|

Re: Setting a Thread name in a ThreadPool

Mike Quilleash -2
I asked the same question a while back.  The solution for me was to wrap
up whatever you are submitting to the executor with a Runnable.

Something like

Public class ThreadRenameWrapper implements Runnable
{
  private final String name;
  private final Runnable runnable;

  public ThreadRenameWrapper( String name, Runnable runnable )
  {
    this.name = name;
    this.runnable = runnable;
  }

  public void run()
  {
    Thread thread = Thread.currentThread();
    String oldName = thread.getName();

    thread.setName( name );
    try
    {
      runnable.run();
    }
    finally
    {
      thread.setName( oldName );
    }
  }
}

HTH.

-----Original Message-----
From: [hidden email]
[mailto:[hidden email]] On Behalf Of David
Harrigan
Sent: 26 October 2006 13:13
To: [hidden email]
Subject: [concurrency-interest] Setting a Thread name in a ThreadPool


Hi,

Previously, if I wanted to set a thread name, I could so something like
this:

new Thread(new RunnableTask(), "DoSomethingWonderfulThread").start();

now, if I'm delgating over to an Executors, like
Executors.newCachedThreadPool(), and using that to execute my thread:

ExecutorService s = Executors.newCachedThreadPool(); s.execute(new
RunnableTask());

The execute method isn't overloaded to provide a name, so, how do I go
about setting the Thread name?

-=david=-
--
View this message in context:
http://www.nabble.com/Setting-a-Thread-name-in-a-ThreadPool-tf2513566.ht
ml#a7009924
Sent from the JSR166 Concurrency mailing list archive at Nabble.com.

_______________________________________________
Concurrency-interest mailing list
[hidden email]
http://altair.cs.oswego.edu/mailman/listinfo/concurrency-interest


 This e-mail is bound by the terms and conditions described at http://www.subexazure.com/mail-disclaimer.html


_______________________________________________
Concurrency-interest mailing list
[hidden email]
http://altair.cs.oswego.edu/mailman/listinfo/concurrency-interest
Reply | Threaded
Open this post in threaded view
|

Re: Setting a Thread name in a ThreadPool

Holger Hoffstätte-2
In reply to this post by David Harrigan
David Harrigan wrote:

> Previously, if I wanted to set a thread name, I could so something like
> this:
>
> new Thread(new RunnableTask(), "DoSomethingWonderfulThread").start();
>
> now, if I'm delgating over to an Executors, like
> Executors.newCachedThreadPool(), and using that to execute my thread:
>
> ExecutorService s = Executors.newCachedThreadPool();
> s.execute(new RunnableTask());
>
> The execute method isn't overloaded to provide a name, so, how do I go about
> setting the Thread name?

You implement the ThreadFactory interface to generate named threads and
plug that into the ExecutorService via setThreadFactory().

public class NamedThreadFactory implements ThreadFactory
{
..
    public Thread newThread(Runnable runnable)
    {
        return new Thread(runnable, this.createNewName());
    }
..
}

-h
_______________________________________________
Concurrency-interest mailing list
[hidden email]
http://altair.cs.oswego.edu/mailman/listinfo/concurrency-interest
Reply | Threaded
Open this post in threaded view
|

Re: Setting a Thread name in a ThreadPool

Kevin Condon
In reply to this post by Mike Quilleash -2
You can use:

ThreadFactory factory = new ThreadFactory() {
  public Thread newThread(Runnable r) {
    return new Thread(r, "threadname");
  }
};
Executors.newCachedThreadPool(factory);

Kevin

On 10/26/06, Mike Quilleash <[hidden email]> wrote:

> I asked the same question a while back.  The solution for me was to wrap
> up whatever you are submitting to the executor with a Runnable.
>
> Something like
>
> Public class ThreadRenameWrapper implements Runnable
> {
>  private final String name;
>  private final Runnable runnable;
>
>  public ThreadRenameWrapper( String name, Runnable runnable )
>  {
>    this.name = name;
>    this.runnable = runnable;
>  }
>
>  public void run()
>  {
>    Thread thread = Thread.currentThread();
>    String oldName = thread.getName();
>
>    thread.setName( name );
>    try
>    {
>      runnable.run();
>    }
>    finally
>    {
>      thread.setName( oldName );
>    }
>  }
> }
>
> HTH.
>
> -----Original Message-----
> From: [hidden email]
> [mailto:[hidden email]] On Behalf Of David
> Harrigan
> Sent: 26 October 2006 13:13
> To: [hidden email]
> Subject: [concurrency-interest] Setting a Thread name in a ThreadPool
>
>
> Hi,
>
> Previously, if I wanted to set a thread name, I could so something like
> this:
>
> new Thread(new RunnableTask(), "DoSomethingWonderfulThread").start();
>
> now, if I'm delgating over to an Executors, like
> Executors.newCachedThreadPool(), and using that to execute my thread:
>
> ExecutorService s = Executors.newCachedThreadPool(); s.execute(new
> RunnableTask());
>
> The execute method isn't overloaded to provide a name, so, how do I go
> about setting the Thread name?
>
> -=david=-
> --
> View this message in context:
> http://www.nabble.com/Setting-a-Thread-name-in-a-ThreadPool-tf2513566.ht
> ml#a7009924
> Sent from the JSR166 Concurrency mailing list archive at Nabble.com.
>
> _______________________________________________
> Concurrency-interest mailing list
> [hidden email]
> http://altair.cs.oswego.edu/mailman/listinfo/concurrency-interest
>
>
>  This e-mail is bound by the terms and conditions described at http://www.subexazure.com/mail-disclaimer.html
>
>
> _______________________________________________
> Concurrency-interest mailing list
> [hidden email]
> http://altair.cs.oswego.edu/mailman/listinfo/concurrency-interest
>
_______________________________________________
Concurrency-interest mailing list
[hidden email]
http://altair.cs.oswego.edu/mailman/listinfo/concurrency-interest
Reply | Threaded
Open this post in threaded view
|

Re: Setting a Thread name in a ThreadPool

David Harrigan
Hi,

Ooh, that's quite a nice one. I like it.

-=david=-

On 10/26/06, Kevin Condon <[hidden email]> wrote:
You can use:

ThreadFactory factory = new ThreadFactory() {
  public Thread newThread(Runnable r) {
    return new Thread(r, "threadname");
  }
};
Executors.newCachedThreadPool(factory);

Kevin

On 10/26/06, Mike Quilleash <[hidden email]> wrote:

> I asked the same question a while back.  The solution for me was to wrap
> up whatever you are submitting to the executor with a Runnable.
>
> Something like
>
> Public class ThreadRenameWrapper implements Runnable
> {
>  private final String name;
>  private final Runnable runnable;
>
>  public ThreadRenameWrapper( String name, Runnable runnable )
>  {
>    this.name = name;
>    this.runnable = runnable;
>  }
>
>  public void run()
>  {
>    Thread thread = Thread.currentThread();
>    String oldName = thread.getName();
>
>     thread.setName( name );
>    try
>    {
>      runnable.run();
>    }
>    finally
>    {
>      thread.setName( oldName );
>    }
>  }
> }
>
> HTH.
>

> -----Original Message-----
> From: [hidden email]
> [mailto:[hidden email]] On Behalf Of David
> Harrigan
> Sent: 26 October 2006 13:13
> To: [hidden email]
> Subject: [concurrency-interest] Setting a Thread name in a ThreadPool
>
>
> Hi,
>
> Previously, if I wanted to set a thread name, I could so something like
> this:
>
> new Thread(new RunnableTask(), "DoSomethingWonderfulThread").start();
>
> now, if I'm delgating over to an Executors, like
> Executors.newCachedThreadPool(), and using that to execute my thread:
>
> ExecutorService s = Executors.newCachedThreadPool(); s.execute (new
> RunnableTask());
>
> The execute method isn't overloaded to provide a name, so, how do I go
> about setting the Thread name?
>
> -=david=-
> --
> View this message in context:
> http://www.nabble.com/Setting-a-Thread-name-in-a-ThreadPool-tf2513566.ht
> ml#a7009924
> Sent from the JSR166 Concurrency mailing list archive at Nabble.com.
>
> _______________________________________________
> Concurrency-interest mailing list
> [hidden email]
> http://altair.cs.oswego.edu/mailman/listinfo/concurrency-interest
>
>
>  This e-mail is bound by the terms and conditions described at http://www.subexazure.com/mail-disclaimer.html
>
>
> _______________________________________________
> Concurrency-interest mailing list
> [hidden email]
> http://altair.cs.oswego.edu/mailman/listinfo/concurrency-interest
>


_______________________________________________
Concurrency-interest mailing list
[hidden email]
http://altair.cs.oswego.edu/mailman/listinfo/concurrency-interest
Reply | Threaded
Open this post in threaded view
|

Re: Setting a Thread name in a ThreadPool

Mike Quilleash -2
In reply to this post by David Harrigan
This is simpler if you just need a single name for all threads in the
pool.  My requirement at the time was for a different name per runnable
so I had to do it differently.

Cheers.

-----Original Message-----
From: Kevin Condon [mailto:[hidden email]]
Sent: 26 October 2006 14:05
To: Mike Quilleash
Cc: David Harrigan; [hidden email]
Subject: Re: [concurrency-interest] Setting a Thread name in a
ThreadPool

You can use:

ThreadFactory factory = new ThreadFactory() {
  public Thread newThread(Runnable r) {
    return new Thread(r, "threadname");
  }
};
Executors.newCachedThreadPool(factory);

Kevin

On 10/26/06, Mike Quilleash <[hidden email]> wrote:

> I asked the same question a while back.  The solution for me was to
> wrap up whatever you are submitting to the executor with a Runnable.
>
> Something like
>
> Public class ThreadRenameWrapper implements Runnable {  private final
> String name;  private final Runnable runnable;
>
>  public ThreadRenameWrapper( String name, Runnable runnable )  {
>    this.name = name;
>    this.runnable = runnable;
>  }
>
>  public void run()
>  {
>    Thread thread = Thread.currentThread();
>    String oldName = thread.getName();
>
>    thread.setName( name );
>    try
>    {
>      runnable.run();
>    }
>    finally
>    {
>      thread.setName( oldName );
>    }
>  }
> }
>
> HTH.
>
> -----Original Message-----
> From: [hidden email]
> [mailto:[hidden email]] On Behalf Of David

> Harrigan
> Sent: 26 October 2006 13:13
> To: [hidden email]
> Subject: [concurrency-interest] Setting a Thread name in a ThreadPool
>
>
> Hi,
>
> Previously, if I wanted to set a thread name, I could so something
> like
> this:
>
> new Thread(new RunnableTask(), "DoSomethingWonderfulThread").start();
>
> now, if I'm delgating over to an Executors, like
> Executors.newCachedThreadPool(), and using that to execute my thread:
>
> ExecutorService s = Executors.newCachedThreadPool(); s.execute(new
> RunnableTask());
>
> The execute method isn't overloaded to provide a name, so, how do I go

> about setting the Thread name?
>
> -=david=-
> --
> View this message in context:
> http://www.nabble.com/Setting-a-Thread-name-in-a-ThreadPool-tf2513566.
> ht
> ml#a7009924
> Sent from the JSR166 Concurrency mailing list archive at Nabble.com.
>
> _______________________________________________
> Concurrency-interest mailing list
> [hidden email]
> http://altair.cs.oswego.edu/mailman/listinfo/concurrency-interest
>
>
>  This e-mail is bound by the terms and conditions described at
> http://www.subexazure.com/mail-disclaimer.html
>
>
> _______________________________________________
> Concurrency-interest mailing list
> [hidden email]
> http://altair.cs.oswego.edu/mailman/listinfo/concurrency-interest
>


 This e-mail is bound by the terms and conditions described at http://www.subexazure.com/mail-disclaimer.html


_______________________________________________
Concurrency-interest mailing list
[hidden email]
http://altair.cs.oswego.edu/mailman/listinfo/concurrency-interest
Reply | Threaded
Open this post in threaded view
|

Re: Setting a Thread name in a ThreadPool

Kevin Condon
Hi Mike,

We use a slightly more nuanced ThreadFactory to give unique names to
each thread.

class CountingThreadFactory extends ThreadFactory {
  private static final AtomicInteger count = new AtomicInteger(0);
  public Thread newThread(Runnable r) {
    return new Thread(r, "thread" + count.getAndIncrement());
  }
}

Regards,
Kevin

On 10/26/06, Mike Quilleash <[hidden email]> wrote:

> This is simpler if you just need a single name for all threads in the
> pool.  My requirement at the time was for a different name per runnable
> so I had to do it differently.
>
> Cheers.
>
> -----Original Message-----
> From: Kevin Condon [mailto:[hidden email]]
> Sent: 26 October 2006 14:05
> To: Mike Quilleash
> Cc: David Harrigan; [hidden email]
> Subject: Re: [concurrency-interest] Setting a Thread name in a
> ThreadPool
>
> You can use:
>
> ThreadFactory factory = new ThreadFactory() {
>  public Thread newThread(Runnable r) {
>    return new Thread(r, "threadname");
>  }
> };
> Executors.newCachedThreadPool(factory);
>
> Kevin
>
> On 10/26/06, Mike Quilleash <[hidden email]> wrote:
> > I asked the same question a while back.  The solution for me was to
> > wrap up whatever you are submitting to the executor with a Runnable.
> >
> > Something like
> >
> > Public class ThreadRenameWrapper implements Runnable {  private final
> > String name;  private final Runnable runnable;
> >
> >  public ThreadRenameWrapper( String name, Runnable runnable )  {
> >    this.name = name;
> >    this.runnable = runnable;
> >  }
> >
> >  public void run()
> >  {
> >    Thread thread = Thread.currentThread();
> >    String oldName = thread.getName();
> >
> >    thread.setName( name );
> >    try
> >    {
> >      runnable.run();
> >    }
> >    finally
> >    {
> >      thread.setName( oldName );
> >    }
> >  }
> > }
> >
> > HTH.
> >
> > -----Original Message-----
> > From: [hidden email]
> > [mailto:[hidden email]] On Behalf Of David
>
> > Harrigan
> > Sent: 26 October 2006 13:13
> > To: [hidden email]
> > Subject: [concurrency-interest] Setting a Thread name in a ThreadPool
> >
> >
> > Hi,
> >
> > Previously, if I wanted to set a thread name, I could so something
> > like
> > this:
> >
> > new Thread(new RunnableTask(), "DoSomethingWonderfulThread").start();
> >
> > now, if I'm delgating over to an Executors, like
> > Executors.newCachedThreadPool(), and using that to execute my thread:
> >
> > ExecutorService s = Executors.newCachedThreadPool(); s.execute(new
> > RunnableTask());
> >
> > The execute method isn't overloaded to provide a name, so, how do I go
>
> > about setting the Thread name?
> >
> > -=david=-
> > --
> > View this message in context:
> > http://www.nabble.com/Setting-a-Thread-name-in-a-ThreadPool-tf2513566.
> > ht
> > ml#a7009924
> > Sent from the JSR166 Concurrency mailing list archive at Nabble.com.
> >
> > _______________________________________________
> > Concurrency-interest mailing list
> > [hidden email]
> > http://altair.cs.oswego.edu/mailman/listinfo/concurrency-interest
> >
> >
> >  This e-mail is bound by the terms and conditions described at
> > http://www.subexazure.com/mail-disclaimer.html
> >
> >
> > _______________________________________________
> > Concurrency-interest mailing list
> > [hidden email]
> > http://altair.cs.oswego.edu/mailman/listinfo/concurrency-interest
> >
>
>
>  This e-mail is bound by the terms and conditions described at http://www.subexazure.com/mail-disclaimer.html
>
>
_______________________________________________
Concurrency-interest mailing list
[hidden email]
http://altair.cs.oswego.edu/mailman/listinfo/concurrency-interest
Reply | Threaded
Open this post in threaded view
|

Re: Setting a Thread name in a ThreadPool

tpeierls
On 10/26/06, Kevin Condon <[hidden email]> wrote:
Hi Mike,

We use a slightly more nuanced ThreadFactory to give unique names to
each thread.
 
The default ThreadFactory in j.u.c does this, too.

I think Mike was distinguishing a different name for each thread in the pool (which you get by default) vs. a different name for each Runnable adopted by the pool thread when it runs that Runnable .

The latter is at odds with decoupling the work to be done from the execution policy that determines which thread does what work. The only justification I can see for it is in debugging or monitoring, but even then I think there are better solutions, e.g., notify the monitoring agent of pre/post-run() events using the task identity and thread name instead of setting the thread name from the task identity.

--tim

On 10/26/06, Mike Quilleash <[hidden email]> wrote:

> This is simpler if you just need a single name for all threads in the
> pool.  My requirement at the time was for a different name per runnable
> so I had to do it differently.
>
> Cheers.
>
> -----Original Message-----
> From: Kevin Condon [mailto:[hidden email]]
> Sent: 26 October 2006 14:05
> To: Mike Quilleash
> Cc: David Harrigan; [hidden email]
> Subject: Re: [concurrency-interest] Setting a Thread name in a
> ThreadPool

>
> You can use:
>
> ThreadFactory factory = new ThreadFactory() {
>  public Thread newThread(Runnable r) {
>    return new Thread(r, "threadname");
>  }
> };
> Executors.newCachedThreadPool(factory);
>
> Kevin
>
> On 10/26/06, Mike Quilleash <[hidden email]> wrote:
> > I asked the same question a while back.  The solution for me was to
> > wrap up whatever you are submitting to the executor with a Runnable.
> >
> > Something like
> >
> > Public class ThreadRenameWrapper implements Runnable {  private final

> > String name;  private final Runnable runnable;
> >
> >  public ThreadRenameWrapper( String name, Runnable runnable )  {
> >    this.name = name;
> >    this.runnable = runnable;
> >  }
> >
> >  public void run()
> >  {
> >    Thread thread = Thread.currentThread ();
> >    String oldName = thread.getName();
> >
> >    thread.setName( name );
> >    try
> >    {
> >      runnable.run();
> >    }
> >    finally
> >    {
> >      thread.setName( oldName );
> >    }
> >  }
> > }
> >
> > HTH.
> >
> > -----Original Message-----
> > From: [hidden email]
> > [mailto:[hidden email]] On Behalf Of David
>
> > Harrigan
> > Sent: 26 October 2006 13:13
> > To: [hidden email]
> > Subject: [concurrency-interest] Setting a Thread name in a ThreadPool
> >
> >
> > Hi,
> >
> > Previously, if I wanted to set a thread name, I could so something
> > like
> > this:
> >
> > new Thread(new RunnableTask(), "DoSomethingWonderfulThread").start();
> >
> > now, if I'm delgating over to an Executors, like
> > Executors.newCachedThreadPool(), and using that to execute my thread:
> >
> > ExecutorService s = Executors.newCachedThreadPool (); s.execute(new
> > RunnableTask());
> >
> > The execute method isn't overloaded to provide a name, so, how do I go
>
> > about setting the Thread name?
> >
> > -=david=-
> > --
> > View this message in context:
> > http://www.nabble.com/Setting-a-Thread-name-in-a-ThreadPool-tf2513566 .
> > ht
> > ml#a7009924
> > Sent from the JSR166 Concurrency mailing list archive at Nabble.com.
> >
> > _______________________________________________
> > Concurrency-interest mailing list
> > [hidden email]
> > http://altair.cs.oswego.edu/mailman/listinfo/concurrency-interest
> >
> >
> >  This e-mail is bound by the terms and conditions described at
> > http://www.subexazure.com/mail-disclaimer.html
> >
> >
> > _______________________________________________
> > Concurrency-interest mailing list
> > [hidden email]
> > http://altair.cs.oswego.edu/mailman/listinfo/concurrency-interest
> >
>
>
>  This e-mail is bound by the terms and conditions described at http://www.subexazure.com/mail-disclaimer.html
>
>
_______________________________________________
Concurrency-interest mailing list
[hidden email]
http://altair.cs.oswego.edu/mailman/listinfo/concurrency-interest


_______________________________________________
Concurrency-interest mailing list
[hidden email]
http://altair.cs.oswego.edu/mailman/listinfo/concurrency-interest
Reply | Threaded
Open this post in threaded view
|

Re: Setting a Thread name in a ThreadPool

David Holmes-3
Right! My question was going to be "what's wrong with the names they have?"
 
A Runnable can always change the name if security permits, but should set it back again unless you're sure every submitted Runnable manages the name itself.
 
David Holmes
-----Original Message-----
From: [hidden email] [mailto:[hidden email]]On Behalf Of Tim Peierls
Sent: Friday, 27 October 2006 12:01 AM
To: Kevin Condon; Mike Quilleash
Cc: [hidden email]
Subject: Re: [concurrency-interest] Setting a Thread name in a ThreadPool

On 10/26/06, Kevin Condon <[hidden email]> wrote:
Hi Mike,

We use a slightly more nuanced ThreadFactory to give unique names to
each thread.
 
The default ThreadFactory in j.u.c does this, too.

I think Mike was distinguishing a different name for each thread in the pool (which you get by default) vs. a different name for each Runnable adopted by the pool thread when it runs that Runnable .

The latter is at odds with decoupling the work to be done from the execution policy that determines which thread does what work. The only justification I can see for it is in debugging or monitoring, but even then I think there are better solutions, e.g., notify the monitoring agent of pre/post-run() events using the task identity and thread name instead of setting the thread name from the task identity.

--tim

On 10/26/06, Mike Quilleash <[hidden email]> wrote:

> This is simpler if you just need a single name for all threads in the
> pool.  My requirement at the time was for a different name per runnable
> so I had to do it differently.
>
> Cheers.
>
> -----Original Message-----
> From: Kevin Condon [mailto:[hidden email]]
> Sent: 26 October 2006 14:05
> To: Mike Quilleash
> Cc: David Harrigan; [hidden email]
> Subject: Re: [concurrency-interest] Setting a Thread name in a
> ThreadPool
>
> You can use:
>
> ThreadFactory factory = new ThreadFactory() {
>  public Thread newThread(Runnable r) {
>    return new Thread(r, "threadname");
>  }
> };
> Executors.newCachedThreadPool(factory);
>
> Kevin
>
> On 10/26/06, Mike Quilleash <[hidden email]> wrote:
> > I asked the same question a while back.  The solution for me was to
> > wrap up whatever you are submitting to the executor with a Runnable.
> >
> > Something like
> >
> > Public class ThreadRenameWrapper implements Runnable {  private final
> > String name;  private final Runnable runnable;
> >
> >  public ThreadRenameWrapper( String name, Runnable runnable )  {
> >    this.name = name;
> >    this.runnable = runnable;
> >  }
> >
> >  public void run()
> >  {
> >    Thread thread = Thread.currentThread ();
> >    String oldName = thread.getName();
> >
> >    thread.setName( name );
> >    try
> >    {
> >      runnable.run();
> >    }
> >    finally
> >    {
> >      thread.setName( oldName );
> >    }
> >  }
> > }
> >
> > HTH.
> >
> > -----Original Message-----
> > From: [hidden email]
> > [mailto:[hidden email]] On Behalf Of David
>
> > Harrigan
> > Sent: 26 October 2006 13:13
> > To: [hidden email]
> > Subject: [concurrency-interest] Setting a Thread name in a ThreadPool
> >
> >
> > Hi,
> >
> > Previously, if I wanted to set a thread name, I could so something
> > like
> > this:
> >
> > new Thread(new RunnableTask(), "DoSomethingWonderfulThread").start();
> >
> > now, if I'm delgating over to an Executors, like
> > Executors.newCachedThreadPool(), and using that to execute my thread:
> >
> > ExecutorService s = Executors.newCachedThreadPool (); s.execute(new
> > RunnableTask());
> >
> > The execute method isn't overloaded to provide a name, so, how do I go
>
> > about setting the Thread name?
> >
> > -=david=-
> > --
> > View this message in context:
> > http://www.nabble.com/Setting-a-Thread-name-in-a-ThreadPool-tf2513566 .
> > ht
> > ml#a7009924
> > Sent from the JSR166 Concurrency mailing list archive at Nabble.com.
> >
> > _______________________________________________
> > Concurrency-interest mailing list
> > [hidden email]
> > http://altair.cs.oswego.edu/mailman/listinfo/concurrency-interest
> >
> >
> >  This e-mail is bound by the terms and conditions described at
> > http://www.subexazure.com/mail-disclaimer.html
> >
> >
> > _______________________________________________
> > Concurrency-interest mailing list
> > [hidden email]
> > http://altair.cs.oswego.edu/mailman/listinfo/concurrency-interest
> >
>
>
>  This e-mail is bound by the terms and conditions described at http://www.subexazure.com/mail-disclaimer.html
>
>
_______________________________________________
Concurrency-interest mailing list
[hidden email]
http://altair.cs.oswego.edu/mailman/listinfo/concurrency-interest


_______________________________________________
Concurrency-interest mailing list
[hidden email]
http://altair.cs.oswego.edu/mailman/listinfo/concurrency-interest
Reply | Threaded
Open this post in threaded view
|

Re: Setting a Thread name in a ThreadPool

Gregg Wonderly-2


David Holmes wrote:
> Right! My question was going to be "what's wrong with the names they have?"

In multi-threaded applications, I like to put the IP address of a client being
served, a database key name of a row being updated etc on my threads so that I
can tell from the trace, which threads and which associated data are "stuck", or
having particular issues.

Gregg Wonderly
_______________________________________________
Concurrency-interest mailing list
[hidden email]
http://altair.cs.oswego.edu/mailman/listinfo/concurrency-interest