Class VirtualThreadUtils

java.lang.Object
io.awspring.cloud.sqs.VirtualThreadUtils

public class VirtualThreadUtils extends Object
Utility class for virtual thread detection. Uses reflection to access Thread.isVirtual() (JDK 21+) while maintaining compatibility with JDK 17.
Since:
4.1.0
Author:
Tomaz Fernandes
See Also:
  • Method Details

    • isVirtual

      public static boolean isVirtual(Thread thread)
      Check whether the given thread is a virtual thread.
      Parameters:
      thread - the thread to check.
      Returns:
      true if the thread is virtual, false if not or if running on JDK < 21.