Class ThreadNum

  • All Implemented Interfaces:
    java.util.function.LongUnaryOperator

    public class ThreadNum
    extends java.lang.Object
    implements java.util.function.LongUnaryOperator
    Matches a digit sequence in the current thread name and caches it in a thread local. This allows you to use any intentionally indexed thread factories to provide an analogue for concurrency. Note that once the thread number is cached, it will not be refreshed. This means you can't change the thread name and get an updated value.
    • Constructor Summary

      Constructors 
      Constructor Description
      ThreadNum()  
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      long applyAsLong​(long input)  
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
      • Methods inherited from interface java.util.function.LongUnaryOperator

        andThen, compose
    • Constructor Detail

      • ThreadNum

        public ThreadNum()
    • Method Detail

      • applyAsLong

        public long applyAsLong​(long input)
        Specified by:
        applyAsLong in interface java.util.function.LongUnaryOperator