Package org.jgroups.util
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 String
protected final String
protected String
protected short
protected final boolean
protected final ThreadGroup
protected boolean
protected boolean
protected ThreadDecorator
protected 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 Thread
void
renameThread
(String base_name, Thread thread) void
renameThread
(String base_name, Thread thread, String address, String cluster_name) void
renameThread
(Thread thread) protected void
renameThread
(Thread thread, String address, String cluster_name) void
setAddress
(String address) void
setClusterName
(String channelName) void
setIncludeClusterName
(boolean includeClusterName) void
setPattern
(String pattern) void
setThreadDecorator
(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:
setPattern
in interfaceThreadFactory
-
setIncludeClusterName
public void setIncludeClusterName(boolean includeClusterName) - Specified by:
setIncludeClusterName
in interfaceThreadFactory
-
setClusterName
- Specified by:
setClusterName
in interfaceThreadFactory
-
setAddress
- Specified by:
setAddress
in interfaceThreadFactory
-
getThreadDecorator
Description copied from interface:ThreadManager
Gets the ThreadDecorator associated with this manager.- Specified by:
getThreadDecorator
in interfaceThreadManager
- Returns:
- the ThreadDecorator, or
null
if there is none.
-
setThreadDecorator
Description copied from interface:ThreadManager
Sets the ThreadDecorator associated this manager should use.- Specified by:
setThreadDecorator
in interfaceThreadManager
- Parameters:
threadDecorator
- the ThreadDecorator, ornull
.
-
newThread
- Specified by:
newThread
in interfaceThreadFactory
-
newThread
- Specified by:
newThread
in interfaceThreadFactory
-
newThread
- Specified by:
newThread
in interfaceThreadFactory
-
newThread
-
renameThread
- Specified by:
renameThread
in interfaceThreadFactory
-
renameThread
-
renameThread
-
renameThread
-