Package org.jgroups.util
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.
-
Field Summary
Fields -
Constructor Summary
ConstructorsConstructorDescriptionDefaultThreadFactory(String baseName, boolean createDaemons) DefaultThreadFactory(String baseName, boolean createDaemons, boolean use_numbering) -
Method Summary
Modifier and TypeMethodDescriptionprotected StringgetNewThreadName(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.voidrenameThread(Thread thread) voidsetAddress(String address) voidsetClusterName(String channelName) voidsetIncludeClusterName(boolean includeClusterName) voidsetPattern(String pattern) booleanDeprecated, for removal: This API element is subject to removal in a future version.<T extends DefaultThreadFactory>
TuseFibers(boolean f) Deprecated, for removal: This API element is subject to removal in a future version.boolean<T extends DefaultThreadFactory>
TuseVirtualThreads(boolean f)
-
Field Details
-
baseName
-
createDaemons
protected final boolean createDaemons -
use_numbering
protected final boolean use_numbering -
counter
protected short counter -
includeClusterName
protected boolean includeClusterName -
clusterName
-
includeLocalAddress
protected boolean includeLocalAddress -
address
-
use_virtual_threads
protected boolean use_virtual_threads -
log
-
-
Constructor Details
-
DefaultThreadFactory
-
DefaultThreadFactory
-
-
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
-
useFibers
Deprecated, for removal: This API element is subject to removal in a future version. -
useFibers
Deprecated, for removal: This API element is subject to removal in a future version. -
useVirtualThreads
public boolean useVirtualThreads() -
useVirtualThreads
-
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.- Parameters:
base_name-thread-addr-cluster_name-
-
renameThread
-
getThreadName
-
getNewThreadName
-