Class ThreadFactoryImpl

  • All Implemented Interfaces:
    java.util.concurrent.ThreadFactory


    public class ThreadFactoryImpl
    extends java.lang.Object
    implements java.util.concurrent.ThreadFactory
    The ThreadFactoryImpl implements the ThreadFactory to be used by an ExecutorService. The ThreadFactoryImpl is providing additional means to set the priority of a thread or whether a is being executed as a daemon thread; so that the threads can be configured as required when being executed by an ExecutorService.

    Else there would be no means force threads to be executed as daemon threads or with a required priority when executed by the ExecutorService without such a dedicated ThreadFactory.

    • Constructor Detail

      • ThreadFactoryImpl

        public ThreadFactoryImpl​(int aPriority,
                                 boolean isDaemon)
        Constructs the ThreadFactoryImpl with the given attributes.
        Parameters:
        aPriority - The priority to to set for the treads
        isDaemon - True in case the threads are to be executed as daemon threads.
      • ThreadFactoryImpl

        public ThreadFactoryImpl​(int aPriority)
        Constructs the ThreadFactoryImpl with the given attributes.
        Parameters:
        aPriority - The priority to to set for the treads
      • ThreadFactoryImpl

        public ThreadFactoryImpl​(boolean isDaemon)
        Constructs the ThreadFactoryImpl with the given attributes.
        Parameters:
        isDaemon - True in case the threads are to be executed as daemon threads.
    • Method Detail

      • newThread

        public java.lang.Thread newThread​(java.lang.Runnable aRunnable)
        Specified by:
        newThread in interface java.util.concurrent.ThreadFactory