提交 ea710513 authored 作者: andrei's avatar andrei

just removed useless throw Exception etc. to make IDE happy

上级 e9cebe85
......@@ -41,7 +41,13 @@ public class TestConcurrent extends TestMVStore {
* @param a ignored
*/
public static void main(String... a) throws Exception {
TestBase.createCaller().init().test();
TestBase init = TestBase.createCaller().init();
init.config.memory = true;
init.config.multiThreaded = true;
for (int i = 0; i < 1000; i++) {
System.out.println("Pass #" + i);
init.test();
}
}
@Override
......@@ -64,7 +70,7 @@ public class TestConcurrent extends TestMVStore {
testConcurrentRead();
}
private void testInterruptReopen() throws Exception {
private void testInterruptReopen() {
String fileName = "retry:nio:" + getBaseDir() + "/" + getTestName();
FileUtils.delete(fileName);
final MVStore s = new MVStore.Builder().
......@@ -95,7 +101,7 @@ public class TestConcurrent extends TestMVStore {
}
}
private void testConcurrentSaveCompact() throws Exception {
private void testConcurrentSaveCompact() {
String fileName = "memFS:" + getTestName();
FileUtils.delete(fileName);
final MVStore s = new MVStore.Builder().
......@@ -107,7 +113,7 @@ public class TestConcurrent extends TestMVStore {
final MVMap<Integer, Integer> dataMap = s.openMap("data");
Task task = new Task() {
@Override
public void call() throws Exception {
public void call() {
int i = 0;
while (!stop) {
s.compact(100, 1024 * 1024);
......@@ -152,7 +158,7 @@ public class TestConcurrent extends TestMVStore {
for (int i = 0; i < tasks.length; i++) {
tasks[i] = new Task() {
@Override
public void call() throws Exception {
public void call() {
Random r = new Random();
WriteBuffer buff = new WriteBuffer();
while (!stop) {
......@@ -198,7 +204,7 @@ public class TestConcurrent extends TestMVStore {
s.setAutoCommitDelay(1);
Task task = new Task() {
@Override
public void call() throws Exception {
public void call() {
while (!stop) {
s.compact(100, 1024 * 1024);
}
......@@ -210,7 +216,7 @@ public class TestConcurrent extends TestMVStore {
final AtomicInteger counter = new AtomicInteger();
Task task2 = new Task() {
@Override
public void call() throws Exception {
public void call() {
while (!stop) {
int i = counter.getAndIncrement();
dataMap.put(i, i * 10);
......@@ -247,7 +253,7 @@ public class TestConcurrent extends TestMVStore {
}
Task task = new Task() {
@Override
public void call() throws Exception {
public void call() {
int i = 0;
while (!stop) {
map.put(i % 100, i % 100);
......@@ -281,7 +287,7 @@ public class TestConcurrent extends TestMVStore {
try {
Task task = new Task() {
@Override
public void call() throws Exception {
public void call() {
while (!stop) {
s.compact(100, 1024 * 1024);
}
......@@ -290,7 +296,7 @@ public class TestConcurrent extends TestMVStore {
task.execute();
Task task2 = new Task() {
@Override
public void call() throws Exception {
public void call() {
while (!stop) {
s.compact(100, 1024 * 1024);
}
......@@ -323,7 +329,7 @@ public class TestConcurrent extends TestMVStore {
m.put(1, 1);
Task task = new Task() {
@Override
public void call() throws Exception {
public void call() {
while (!stop) {
m.put(1, 1);
s.commit();
......@@ -386,7 +392,7 @@ public class TestConcurrent extends TestMVStore {
final AtomicInteger counter = new AtomicInteger();
Task task = new Task() {
@Override
public void call() throws Exception {
public void call() {
while (!stop) {
int x = counter.getAndIncrement();
if (x >= count) {
......@@ -451,7 +457,7 @@ public class TestConcurrent extends TestMVStore {
final AtomicInteger counter = new AtomicInteger();
Task task = new Task() {
@Override
public void call() throws Exception {
public void call() {
while (!stop) {
counter.incrementAndGet();
s.commit();
......@@ -483,7 +489,7 @@ public class TestConcurrent extends TestMVStore {
final AtomicInteger counter = new AtomicInteger();
Task task = new Task() {
@Override
public void call() throws Exception {
public void call() {
while (!stop) {
s.setStoreVersion(counter.incrementAndGet());
s.commit();
......@@ -499,7 +505,7 @@ public class TestConcurrent extends TestMVStore {
// sometimes closing works, in which case
// storing must fail at some point (not necessarily
// immediately)
for (int x = counter.get(), y = x; x <= y + 2; x++) {
for (int x = counter.get(), y = x + 2; x <= y; x++) {
Thread.sleep(1);
}
Exception e = task.getException();
......@@ -529,7 +535,7 @@ public class TestConcurrent extends TestMVStore {
final Random rand = new Random(1);
Task task = new Task() {
@Override
public void call() throws Exception {
public void call() {
try {
while (!stop) {
if (rand.nextBoolean()) {
......@@ -651,7 +657,7 @@ public class TestConcurrent extends TestMVStore {
final Random r = new Random();
Task task = new Task() {
@Override
public void call() throws Exception {
public void call() {
while (!stop) {
int x = r.nextInt(len);
if (r.nextBoolean()) {
......@@ -704,7 +710,7 @@ public class TestConcurrent extends TestMVStore {
final Random rand = new Random(1);
Task task = new Task() {
@Override
public void call() throws Exception {
public void call() {
while (!stop) {
try {
if (rand.nextBoolean()) {
......@@ -715,13 +721,7 @@ public class TestConcurrent extends TestMVStore {
m.get(rand.nextInt(size));
} catch (ConcurrentModificationException e) {
detected.incrementAndGet();
} catch (NegativeArraySizeException e) {
notDetected.incrementAndGet();
} catch (ArrayIndexOutOfBoundsException e) {
notDetected.incrementAndGet();
} catch (IllegalArgumentException e) {
notDetected.incrementAndGet();
} catch (NullPointerException e) {
} catch (NegativeArraySizeException | ArrayIndexOutOfBoundsException | IllegalArgumentException | NullPointerException e) {
notDetected.incrementAndGet();
}
}
......@@ -741,13 +741,7 @@ public class TestConcurrent extends TestMVStore {
m.get(rand.nextInt(size));
} catch (ConcurrentModificationException e) {
detected.incrementAndGet();
} catch (NegativeArraySizeException e) {
notDetected.incrementAndGet();
} catch (ArrayIndexOutOfBoundsException e) {
notDetected.incrementAndGet();
} catch (IllegalArgumentException e) {
notDetected.incrementAndGet();
} catch (NullPointerException e) {
} catch (NegativeArraySizeException | ArrayIndexOutOfBoundsException | IllegalArgumentException | NullPointerException e) {
notDetected.incrementAndGet();
}
}
......@@ -771,7 +765,7 @@ public class TestConcurrent extends TestMVStore {
s.commit();
Task task = new Task() {
@Override
public void call() throws Exception {
public void call() {
while (!stop) {
long v = s.getCurrentVersion() - 1;
Map<Integer, Integer> old = m.openVersion(v);
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论