Package org.jgroups.util
Class LazyThreadFactory
- java.lang.Object
-
- org.jgroups.util.DefaultThreadFactory
-
- org.jgroups.util.LazyThreadFactory
-
- All Implemented Interfaces:
java.util.concurrent.ThreadFactory
,ThreadFactory
public class LazyThreadFactory extends DefaultThreadFactory
Lazily names threads: whenever the address or cluster name is changed, all threads are renamed- Author:
- Bela Ban
-
-
Field Summary
-
Fields inherited from class org.jgroups.util.DefaultThreadFactory
address, baseName, clusterName, counter, createDaemons, includeClusterName, includeLocalAddress, log, use_fibers, use_numbering
-
-
Constructor Summary
Constructors Constructor Description LazyThreadFactory(java.lang.String baseName, boolean createDaemons, boolean use_numbering)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected java.lang.String
changeName(java.lang.String name)
Replaces "" with the local address and with the cluster name void
destroy()
java.lang.String
dumpThreads()
java.lang.Thread
newThread(java.lang.Runnable r)
java.lang.Thread
newThread(java.lang.Runnable r, java.lang.String name)
void
removeTerminatedThreads()
protected void
renameThreads()
void
setAddress(java.lang.String address)
void
setClusterName(java.lang.String cluster_name)
int
size()
-
Methods inherited from class org.jgroups.util.DefaultThreadFactory
getNewThreadName, getThreadName, log, newThread, renameThread, renameThread, renameThread, setIncludeClusterName, setPattern, useFibers, useFibers
-
-
-
-
Method Detail
-
newThread
public java.lang.Thread newThread(java.lang.Runnable r)
- Specified by:
newThread
in interfacejava.util.concurrent.ThreadFactory
- Overrides:
newThread
in classDefaultThreadFactory
-
newThread
public java.lang.Thread newThread(java.lang.Runnable r, java.lang.String name)
- Specified by:
newThread
in interfaceThreadFactory
- Overrides:
newThread
in classDefaultThreadFactory
-
setAddress
public void setAddress(java.lang.String address)
- Specified by:
setAddress
in interfaceThreadFactory
- Overrides:
setAddress
in classDefaultThreadFactory
-
setClusterName
public void setClusterName(java.lang.String cluster_name)
- Specified by:
setClusterName
in interfaceThreadFactory
- Overrides:
setClusterName
in classDefaultThreadFactory
-
size
public int size()
-
destroy
public void destroy()
-
removeTerminatedThreads
public void removeTerminatedThreads()
-
dumpThreads
public java.lang.String dumpThreads()
-
renameThreads
protected void renameThreads()
-
changeName
protected java.lang.String changeName(java.lang.String name)
Replaces "" with the local address and with the cluster name
-
-