Module id.xfunction

Class XThread

Object
XThread

public class XThread extends Object
Additions to standard java.lang.Thread
  • Constructor Details

    • XThread

      public XThread()
  • Method Details

    • sleep

      public static void sleep(long msec)
      Standard way to sleep in Java is pretty verbose because it throws checked exception which you need to handle:
      
       try {
           Thread.sleep(1000);
       } catch (InterruptedException e) {
           throw new RuntimeException(e);
       }
       

      When you write scripts in Java you probably want it to fit in one line and wrap any thrown exception to unchecked.

      
       XThread.sleep(1000);
       
      Parameters:
      msec - how long to sleep in milliseconds. -1 - sleep forever