Add additinal sync
- Change how some internals in AbstractStateMachine are synchronized to limit changes for deadlock. - Relates #359
This commit is contained in:
@@ -55,6 +55,37 @@ public class TimerSmokeTests {
|
||||
return builder.build();
|
||||
}
|
||||
|
||||
private StateMachine<String, String> buildMachine2() throws Exception {
|
||||
|
||||
StateMachineBuilder.Builder<String, String> builder = StateMachineBuilder.builder();
|
||||
|
||||
builder.configureConfiguration()
|
||||
.withConfiguration()
|
||||
.taskExecutor(taskExecutor);
|
||||
|
||||
builder.configureStates()
|
||||
.withStates()
|
||||
.initial("initial").end("end").and()
|
||||
.withStates().parent("initial").initial("inner");
|
||||
|
||||
builder.configureTransitions()
|
||||
.withExternal()
|
||||
.source("initial")
|
||||
.target("end")
|
||||
.timerOnce(30)
|
||||
.and()
|
||||
.withExternal()
|
||||
.source("inner")
|
||||
.target("end")
|
||||
.timerOnce(15)
|
||||
.and()
|
||||
.withLocal()
|
||||
.source("inner")
|
||||
.event("repeate");
|
||||
|
||||
return builder.build();
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testNPE() throws Exception {
|
||||
StateMachine<String, String> stateMachine;
|
||||
@@ -67,6 +98,21 @@ public class TimerSmokeTests {
|
||||
}
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testNPE2() throws Exception {
|
||||
|
||||
StateMachine<String, String> stateMachine;
|
||||
|
||||
for (int i = 0; i < 20; i++) {
|
||||
stateMachine = buildMachine2();
|
||||
stateMachine.start();
|
||||
while(!stateMachine.isComplete()) {
|
||||
stateMachine.sendEvent("repeate");
|
||||
}
|
||||
stateMachine.stop();
|
||||
}
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testDeadlock() throws Exception {
|
||||
StateMachineTestPlan<String, String> plan;
|
||||
|
||||
Reference in New Issue
Block a user