Class 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
    • Constructor Detail

      • LazyThreadFactory

        public LazyThreadFactory​(java.lang.String baseName,
                                 boolean createDaemons,
                                 boolean use_numbering)
    • Method Detail

      • newThread

        public java.lang.Thread newThread​(java.lang.Runnable r)
        Specified by:
        newThread in interface java.util.concurrent.ThreadFactory
        Overrides:
        newThread in class DefaultThreadFactory
      • 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