View Javadoc
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 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   * @author Doug Lea
25   * @author Last changed by: $Author$
26   * @version $Revision$ $Date$
27   * @since ? (pre 2.1)
28   */
29  public class TimeoutException extends InterruptedException {
30  
31    /** 
32     * The approximate time that the operation lasted before 
33     * this timeout exception was thrown.
34     **/
35  
36    public final long duration;
37    /**
38     * Constructs a TimeoutException with given duration value.
39     **/
40    public TimeoutException(long time) {
41      duration = time;
42    }
43  
44    /**
45       * Constructs a TimeoutException with the
46       * specified duration value and detail message.
47       */
48    public TimeoutException(long time, String message) {
49      super(message);
50      duration = time;
51    }
52  }