Class Threads

java.lang.Object
org.zkoss.lang.Threads

public class Threads extends Object
Thread relevant utilities.
Author:
tomyeh
  • Constructor Summary

    Constructors
    Constructor
    Description
     
  • Method Summary

    Modifier and Type
    Method
    Description
    static final void
    A dummy function that is used to avoid compiler from optimizing statements around it.
    static final void
    joinAndInterrupt(Thread thd, int timeout)
    Waits a thread to die (and interrupt once a while)
    static final void
    setDaemon(Thread thd, boolean daemon)
    Sets the priority without throwing any exception but log warning.
    static final void
    setPriority(Thread thd, int priority)
    Sets the priority without throwing any exception but log warning.
    static final void
    sleep(int millisecs)
    Put the current thread to sleep for a while.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

    • Threads

      public Threads()
  • Method Details

    • sleep

      public static final void sleep(int millisecs)
      Put the current thread to sleep for a while.
      Throws:
      SystemException - if it is interrupted.
      Since:
      3.0.0
    • setPriority

      public static final void setPriority(Thread thd, int priority)
      Sets the priority without throwing any exception but log warning.
    • setDaemon

      public static final void setDaemon(Thread thd, boolean daemon)
      Sets the priority without throwing any exception but log warning.
    • joinAndInterrupt

      public static final void joinAndInterrupt(Thread thd, int timeout) throws InterruptedException
      Waits a thread to die (and interrupt once a while)
      Parameters:
      timeout - how long to wait (0 means forever)
      Throws:
      InterruptedException
    • dummy

      public static final void dummy(Object o)
      A dummy function that is used to avoid compiler from optimizing statements around it.