Class ThreadFactoryBuilder

    • Method Detail

      • eventLoop

        public ThreadFactoryBuilder eventLoop​(boolean eventLoop)
        Sets event loop for new threads.
      • taskFunction

        public ThreadFactoryBuilder taskFunction​(Function<? super Runnable,​? extends Runnable> taskFunction)
        Sets task function for new threads. Use this method to set additional work before or after the Runnable is run. For example:
        
         ThreadFactories.builder("thread-prefix")
                        .taskFunction( task -> {
                            return () -> {
                                // Add something to do before task is run
                                task.run();
                                // Add something to do after task is run
                            };
                        })
                        .build();