Class DefaultThreadFactory
java.lang.Object
org.jgroups.util.DefaultThreadFactory
- All Implemented Interfaces:
ThreadFactory, ThreadFactory
- 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
If includeClusterName and includeLocalAddress are both false, and clusterName is set, then we assume we have a shared transport, and therefore print shared=clusterName.
- Author:
- Vladimir Blagojevic, Bela Ban
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected Stringprotected final Stringprotected Stringprotected final AtomicIntegerprotected final booleanprotected booleanprotected booleanprotected Logprotected booleanprotected boolean -
Constructor Summary
ConstructorsConstructorDescriptionDefaultThreadFactory(String base_name, boolean createDaemons) DefaultThreadFactory(String base_name, boolean createDaemons, boolean use_numbering) -
Method Summary
Modifier and TypeMethodDescriptionprotected StringgetThreadName(String base_name, String addr, String cluster_name) protected StringgetThreadName(String base_name, Thread thread, String addr, String cluster_name) <T extends DefaultThreadFactory>
Tprotected ThreadvoidrenameThread(String base_name, Thread thread) voidrenameThread(String base_name, Thread thread, String addr, String cluster_name) Names a thread according to base_name, cluster name and local address.voidsetAddress(String address) voidsetClusterName(String channelName) voidsetIncludeClusterName(boolean includeClusterName) voidsetIncludeLocalAddress(boolean f) voidsetPattern(String pattern) voidsetUseNumbering(boolean f) boolean<T extends DefaultThreadFactory>
TuseVirtualThreads(boolean f) <T extends DefaultThreadFactory>
TuseVThreads(boolean f)
-
Field Details
-
baseName
-
createDaemons
protected final boolean createDaemons -
use_numbering
protected boolean use_numbering -
counter
-
includeClusterName
protected boolean includeClusterName -
clusterName
-
includeLocalAddress
protected boolean includeLocalAddress -
address
-
use_vthreads
protected boolean use_vthreads -
log
-
-
Constructor Details
-
DefaultThreadFactory
-
DefaultThreadFactory
-
-
Method Details
-
setPattern
- Specified by:
setPatternin interfaceThreadFactory
-
setUseNumbering
public void setUseNumbering(boolean f) -
setIncludeClusterName
public void setIncludeClusterName(boolean includeClusterName) - Specified by:
setIncludeClusterNamein interfaceThreadFactory
-
setIncludeLocalAddress
public void setIncludeLocalAddress(boolean f) -
setClusterName
- Specified by:
setClusterNamein interfaceThreadFactory
-
setAddress
- Specified by:
setAddressin interfaceThreadFactory
-
useVirtualThreads
public boolean useVirtualThreads()- Specified by:
useVirtualThreadsin interfaceThreadFactory
-
useVirtualThreads
-
useVThreads
-
log
-
newThread
- Specified by:
newThreadin interfaceThreadFactory
-
newThread
- Specified by:
newThreadin interfaceThreadFactory
-
newThread
-
renameThread
- Specified by:
renameThreadin interfaceThreadFactory
-
renameThread
Names a thread according to base_name, cluster name and local address. If includeClusterName and includeLocalAddress are null, but cluster_name is set, then we assume we have a shared transport and name the thread shared=clusterName. In the latter case, clusterName points to the singleton_name of TP. -
getThreadName
-
getThreadName
-