Class DefaultThreadFactory
java.lang.Object
org.jgroups.util.DefaultThreadFactory
- All Implemented Interfaces:
ThreadFactory, ThreadFactory, ThreadManager
- Direct Known Subclasses:
LazyThreadFactory
Thread factory mainly responsible for naming of threads. Can be replaced by
user. If use_numbering is set, a thread THREAD will be called THREAD-1,
THREAD-2, and so on. If a pattern has been set (through setPattern()),
then the cluster name and local address will also be added, e.g.
THREAD-5,MyCluster,192.168.1.5:63754 or THREAD,MyCluster,192.168.1.5:63754
- Version:
- $Id: DefaultThreadFactory.java,v 1.3.2.4 2008/05/26 09:14:38 belaban Exp $
- Author:
- Vladimir Blagojevic, Bela Ban
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected Stringprotected final Stringprotected Stringprotected shortprotected final booleanprotected final ThreadGroupprotected booleanprotected booleanprotected ThreadDecoratorprotected final boolean -
Constructor Summary
ConstructorsConstructorDescriptionDefaultThreadFactory(ThreadGroup group, String baseName, boolean createDaemons) DefaultThreadFactory(ThreadGroup group, String baseName, boolean createDaemons, boolean use_numbering) -
Method Summary
Modifier and TypeMethodDescriptionGets the ThreadDecorator associated with this manager.newThread(ThreadGroup group, Runnable r, String name) protected ThreadvoidrenameThread(String base_name, Thread thread) voidrenameThread(String base_name, Thread thread, String address, String cluster_name) voidrenameThread(Thread thread) protected voidrenameThread(Thread thread, String address, String cluster_name) voidsetAddress(String address) voidsetClusterName(String channelName) voidsetIncludeClusterName(boolean includeClusterName) voidsetPattern(String pattern) voidsetThreadDecorator(ThreadDecorator threadDecorator) Sets the ThreadDecorator associated this manager should use.
-
Field Details
-
group
-
baseName
-
createDaemons
protected final boolean createDaemons -
counter
protected short counter -
use_numbering
protected final boolean use_numbering -
includeClusterName
protected boolean includeClusterName -
includeLocalAddress
protected boolean includeLocalAddress -
clusterName
-
address
-
threadDecorator
-
-
Constructor Details
-
DefaultThreadFactory
-
DefaultThreadFactory
public DefaultThreadFactory(ThreadGroup group, String baseName, boolean createDaemons, boolean use_numbering)
-
-
Method Details
-
setPattern
- Specified by:
setPatternin interfaceThreadFactory
-
setIncludeClusterName
public void setIncludeClusterName(boolean includeClusterName) - Specified by:
setIncludeClusterNamein interfaceThreadFactory
-
setClusterName
- Specified by:
setClusterNamein interfaceThreadFactory
-
setAddress
- Specified by:
setAddressin interfaceThreadFactory
-
getThreadDecorator
Description copied from interface:ThreadManagerGets the ThreadDecorator associated with this manager.- Specified by:
getThreadDecoratorin interfaceThreadManager- Returns:
- the ThreadDecorator, or
nullif there is none.
-
setThreadDecorator
Description copied from interface:ThreadManagerSets the ThreadDecorator associated this manager should use.- Specified by:
setThreadDecoratorin interfaceThreadManager- Parameters:
threadDecorator- the ThreadDecorator, ornull.
-
newThread
- Specified by:
newThreadin interfaceThreadFactory
-
newThread
- Specified by:
newThreadin interfaceThreadFactory
-
newThread
- Specified by:
newThreadin interfaceThreadFactory
-
newThread
-
renameThread
- Specified by:
renameThreadin interfaceThreadFactory
-
renameThread
-
renameThread
-
renameThread
-