KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > EDU > oswego > cs > dl > util > concurrent > TimeoutException


1 /*
2   File: TimeoutException.java
3
4   Originally written by Doug Lea and released into the public domain.
5   This may be used for any purposes whatsoever without acknowledgment.
6   Thanks for the assistance and support of Sun Microsystems Labs,
7   and everyone contributing, testing, and using this code.
8
9   History:
10   Date Who What
11   29Jun1998 dl Create public version
12    4Aug1998 dl Change to extend InterruptedException
13 */

14
15 package EDU.oswego.cs.dl.util.concurrent;
16
17 /**
18  * Thrown by synchronization classes that report
19  * timeouts via exceptions. The exception is treated
20  * as a form (subclass) of InterruptedException. This both
21  * simplifies handling, and conceptually reflects the fact that
22  * timed-out operations are artificially interrupted by timers.
23  **/

24
25 public class TimeoutException extends InterruptedException JavaDoc {
26
27   /**
28    * The approximate time that the operation lasted before
29    * this timeout exception was thrown.
30    **/

31
32   public final long duration;
33   /**
34    * Constructs a TimeoutException with given duration value.
35    **/

36   public TimeoutException(long time) {
37     duration = time;
38   }
39
40   /**
41      * Constructs a TimeoutException with the
42      * specified duration value and detail message.
43      */

44   public TimeoutException(long time, String JavaDoc message) {
45     super(message);
46     duration = time;
47   }
48 }
49
Popular Tags