01: /*
02: File: TimeoutException.java
03:
04: Originally written by Doug Lea and released into the public domain.
05: This may be used for any purposes whatsoever without acknowledgment.
06: Thanks for the assistance and support of Sun Microsystems Labs,
07: and everyone contributing, testing, and using this code.
08:
09: History:
10: Date Who What
11: 29Jun1998 dl Create public version
12: 4Aug1998 dl Change to extend InterruptedException
13: */
14:
15: package org.dbunit.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 {
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: /**
35: * Constructs a TimeoutException with given duration value.
36: **/
37: public TimeoutException(long time) {
38: duration = time;
39: }
40:
41: /**
42: * Constructs a TimeoutException with the
43: * specified duration value and detail message.
44: */
45: public TimeoutException(long time, String message) {
46: super(message);
47: duration = time;
48: }
49: }
|