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