The constants defined by this enumerated type represent granularities of time. Timeout and delay specifications throughout the java.util.concurrent package are specified by a long value and TimeUnit constant that specifies the interpretation of that value. TimeUnit defines conversion methods that convert values expressed in one unit to values in another unit. More interestingly, it defines convenient alternatives to THRead.sleep( ) , Thread.join( ) , and Object.wait( ) . Figure 16-96. java.util.concurrent.TimeUnitpublic enum TimeUnit { // Enumerated Constants NANOSECONDS , MICROSECONDS , MILLISECONDS , SECONDS ; // Public Class Methods public static TimeUnit valueOf (String name ); public static final TimeUnit[ ] values ( ); // Public Instance Methods public long convert (long duration , TimeUnit unit ); public void sleep (long timeout ) throws InterruptedException; public void timedJoin (Thread thread , long timeout ) throws InterruptedException; public void timedWait (Object obj , long timeout ) throws InterruptedException; public long toMicros (long duration ); public long toMillis (long duration ); public long toNanos (long duration ); public long toSeconds (long duration ); } Passed ToToo many methods to list. |