| 1 | package felix.util; |
| 2 | |
| 3 | import tuffy.util.ExceptionMan; |
| 4 | |
| 5 | /** |
| 6 | * Class for sleeping. |
| 7 | */ |
| 8 | public class TimeOut extends Thread{ |
| 9 | |
| 10 | public int timeout = 0; |
| 11 | |
| 12 | /** |
| 13 | * The constructor. |
| 14 | * @param _timeout |
| 15 | */ |
| 16 | public TimeOut(int _timeout){ |
| 17 | timeout = _timeout; |
| 18 | } |
| 19 | |
| 20 | /** |
| 21 | * Sleeps for the number of seconds specified in the constructor. |
| 22 | */ |
| 23 | public void run(){ |
| 24 | try { |
| 25 | Thread.sleep(timeout*1000); |
| 26 | ExceptionMan.die("####TimeOut####"); |
| 27 | |
| 28 | } catch (InterruptedException e) { |
| 29 | // TODO Auto-generated catch block |
| 30 | e.printStackTrace(); |
| 31 | } |
| 32 | |
| 33 | } |
| 34 | |
| 35 | } |