Class TweakableThreadFactory

java.lang.Object
org.refcodes.controlflow.TweakableThreadFactory
All Implemented Interfaces:
ThreadFactory

public class TweakableThreadFactory extends Object implements ThreadFactory
The TweakableThreadFactory implements the ThreadFactory to be used by an ExecutorService. The TweakableThreadFactory is providing additional means to set the priority of a Thread or whether a Thread is being executed as a daemon Thread so that the IllegalThreadStateException instances can be configured as required when being executed by an ExecutorService.

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

  • Constructor Details

    • TweakableThreadFactory

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

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

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