01: /*
02: * Copyright 2004-2008 H2 Group. Licensed under the H2 License, Version 1.0
03: * (license2)
04: * Initial Developer: H2 Group
05: */
06: package org.h2.test.synth.thread;
07:
08: import java.sql.SQLException;
09: import java.util.Random;
10:
11: import org.h2.test.TestBase;
12:
13: /**
14: * The is an abstract operation for {@link TestMulti}.
15: */
16: abstract class TestMultiThread extends Thread {
17:
18: TestMulti base;
19: Random random = new Random();
20:
21: TestMultiThread(TestMulti base) throws SQLException {
22: this .base = base;
23: }
24:
25: abstract void first() throws SQLException;
26:
27: abstract void operation() throws SQLException;
28:
29: abstract void begin() throws SQLException;
30:
31: abstract void end() throws SQLException;
32:
33: abstract void finalTest() throws Exception;
34:
35: public void run() {
36: try {
37: while (!base.stop) {
38: operation();
39: }
40: end();
41: } catch (Throwable e) {
42: TestBase.logError("error", e);
43: }
44: }
45:
46: }
|