Fix possible deadlock
- Removing some sync blocks which imho are not needed anymore. - Adding some smoke tests. - Relates to #364
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2015 the original author or authors.
|
||||
* Copyright 2015-2017 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -89,6 +89,25 @@ public class PersistTests {
|
||||
assertThat(persist.listDbEntries(), containsString("id=2, state=SENT"));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testThreadingSmoke() throws Exception {
|
||||
int cnt = 10;
|
||||
Thread[] threads = new Thread[cnt];
|
||||
for (int i = 0; i < cnt; i++) {
|
||||
threads[i] = new Thread(() -> {
|
||||
for (int j = 0; j < 1000; j++) {
|
||||
persist.change(3, "SEND");
|
||||
}
|
||||
});
|
||||
}
|
||||
for (Thread t : threads) {
|
||||
t.start();
|
||||
}
|
||||
for (Thread t : threads) {
|
||||
t.join();
|
||||
}
|
||||
}
|
||||
|
||||
private static class TestListener extends StateMachineListenerAdapter<String, String> {
|
||||
|
||||
volatile CountDownLatch stateChangedLatch = new CountDownLatch(1);
|
||||
|
||||
Reference in New Issue
Block a user