LockSupport | java.util.concurrent.locks | This class provides a low-level alternative to the deprecated methods Thread.suspend( ) and THRead.resume( ) . The park( ) , parkNanos( ) , and parkUntil( ) methods suspend, or park, the thread until it is unparked by another thread with unpark( ) , or until it is interrupted by another thread, or until the specified time elapses. parkNanos( ) parks the thread for the specified number of nanoseconds. parkUntil( ) parks the thread until the specified time, using the millisecond representation of System.currentTimeMillis( ) . Any call to these parking methods may return spuriously, so it is important to call park( ) in a loop that can repark the thread if it should not have resumed. Unpark a thread with the unpark( ) method. Note that while the parking methods affect the current thread, the unpark( ) method affects the thread you specify. If the specified thread is not parked, the next time that thread calls one of the park( ) methods, it returns immediately instead of blocking. public class LockSupport { // No Constructor // Public Class Methods public static void park ( ); public static void parkNanos (long nanos ); public static void parkUntil (long deadline ); public static void unpark (Thread thread ); } |