Fix potential concurrency issue with join pseudostate

- Change notified flag to volatile which might explain
  some test failures.
- More testing tweaks for #76
This commit is contained in:
Janne Valkealahti
2015-08-08 16:30:24 +01:00
parent 5347ea4dd9
commit 7fc7dd9cac
3 changed files with 19 additions and 8 deletions

View File

@@ -63,7 +63,7 @@ public class TasksTests {
public void testRunOnce() throws InterruptedException {
listener.reset(9, 0, 0);
tasks.run();
assertThat(listener.stateChangedLatch.await(6, TimeUnit.SECONDS), is(true));
assertThat(listener.stateChangedLatch.await(8, TimeUnit.SECONDS), is(true));
assertThat(machine.getState().getIds(), contains(States.READY));
Map<Object, Object> variables = machine.getExtendedState().getVariables();
assertThat(variables.size(), is(3));
@@ -73,7 +73,7 @@ public class TasksTests {
public void testRunTwice() throws InterruptedException {
listener.reset(9, 0, 0);
tasks.run();
assertThat(listener.stateChangedLatch.await(6, TimeUnit.SECONDS), is(true));
assertThat(listener.stateChangedLatch.await(8, TimeUnit.SECONDS), is(true));
assertThat(machine.getState().getIds(), contains(States.READY));
Map<Object, Object> variables = machine.getExtendedState().getVariables();
@@ -81,7 +81,7 @@ public class TasksTests {
listener.reset(9, 0, 0);
tasks.run();
assertThat(listener.stateChangedLatch.await(6, TimeUnit.SECONDS), is(true));
assertThat(listener.stateChangedLatch.await(8, TimeUnit.SECONDS), is(true));
assertThat(machine.getState().getIds(), contains(States.READY));
variables = machine.getExtendedState().getVariables();