OW2 Consortium jaspte

Rev

Details | Last modification | View Log | RSS feed

Rev Author Line No. Line
6 duanzhiquan 1
/**
2
 * =========================================================================
3
 * 					Bench4Q version 1.2.1
4
 * =========================================================================
5
 *
6
 * Bench4Q is available on the Internet at http://forge.ow2.org/projects/jaspte
7
 * You can find latest version there.
8
 *
9
 * Distributed according to the GNU Lesser General Public Licence.
10
 * This library is free software; you can redistribute it and/or modify it
11
 * under the terms of the GNU Lesser General Public License as published by
12
 * the Free Software Foundation; either version 2.1 of the License, or any
13
 * later version.
14
 *
15
 * SEE Copyright.txt FOR FULL COPYRIGHT INFORMATION.
16
 *
17
 * This source code is distributed "as is" in the hope that it will be
18
 * useful.  It comes with no warranty, and no author or distributor
19
 * accepts any responsibility for the consequences of its use.
20
 *
21
 *
22
 * This version is a based on the implementation of TPC-W from University of Wisconsin.
23
 * This version used some source code of The Grinder.
24
 *
25
 * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
26
 *  * Initial developer(s): Zhiquan Duan.
27
 * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
28
 *
29
 */
30
 
31
package org.bench4Q.common.util.thread;
32
 
33
import org.bench4Q.common.UncheckedInterruptedException;
34
 
35
/**
36
 * Object used for synchronisation.
37
 *
38
 * @see UncheckedInterruptedException
39
 */
40
public class Condition {
41
 
42
	/**
43
	 * Wait until we are notified, or receive an {@link InterruptedException}.
44
	 *
45
	 * @see Object#wait()
46
	 * @throws UncheckedInterruptedException
47
	 *             If we receive an {@link InterruptedException}.
48
	 */
49
	public void waitNoInterrruptException()
50
			throws UncheckedInterruptedException {
51
		try {
52
			super.wait();
53
		} catch (InterruptedException e) {
54
			throw new UncheckedInterruptedException(e);
55
		}
56
	}
57
 
58
	/**
59
	 * Wait until we are notified, time out, or receive an
60
	 * {@link InterruptedException}.
61
	 *
62
	 * @param timeout
63
	 *            the maximum time to wait in milliseconds.
64
	 * @see Object#wait(long)
65
	 * @throws UncheckedInterruptedException
66
	 *             If we receive an {@link InterruptedException}.
67
	 */
68
	public void waitNoInterrruptException(long timeout)
69
			throws UncheckedInterruptedException {
70
		try {
71
			super.wait(timeout);
72
		} catch (InterruptedException e) {
73
			throw new UncheckedInterruptedException(e);
74
		}
75
	}
76
}