com.sun.sgs.impl.util
Class NamedThreadFactory

java.lang.Object
  extended by com.sun.sgs.impl.util.NamedThreadFactory
All Implemented Interfaces:
ThreadFactory

public class NamedThreadFactory
extends Object
implements ThreadFactory

A custom implementation of a ThreadFactory that assigns a configurable name to each thread.


Constructor Summary
NamedThreadFactory(String name)
          Creates a new NamedThreadFactory that names each thread that it creates using the given name.
 
Method Summary
 Thread newThread(Runnable r)
          Constructs a new Thread for the given Runnable.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

NamedThreadFactory

public NamedThreadFactory(String name)
Creates a new NamedThreadFactory that names each thread that it creates using the given name.

Parameters:
name - the prefix to use for each thread's name
Method Detail

newThread

public Thread newThread(Runnable r)
Constructs a new Thread for the given Runnable. The name of the returned Thread is equal to the current count of the number of threads that have been created thus far with this factory appended to the name used to construct this factory.

Specified by:
newThread in interface ThreadFactory
Parameters:
r - the Runnable to be executed by the new thread
Returns:
new thread associated with the given Runnable

RedDwarf, Version 0.10.1
2010-03-14 10:56:12

Copyright © 2010 The RedDwarf Authors. All rights reserved
Copyright © 2007-2010 Sun Microsystems, Inc. All rights reserved