Restore all regions of statemachine

- Restore all regions of statemachine
- A persisted statemachine with orthogonal states will not be correctly
  restored as only the top region gets correctly reset. Tests in
  StateMachineResetTests use the correct way to reset the statemachine
  with all regions
- Fixes #978
This commit is contained in:
Erik Greijus
2021-06-26 17:25:28 +02:00
committed by GitHub
parent c930c54fad
commit 4da9c52742

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2017-2019 the original author or authors.
* Copyright 2017-2021 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.
@@ -165,8 +165,7 @@ public class DefaultStateMachineService<S, E> implements StateMachineService<S,
return stateMachine;
}
stateMachine.stopReactively().block();
// only go via top region
stateMachine.getStateMachineAccessor().doWithRegion(function -> function.resetStateMachineReactively(stateMachineContext).block());
stateMachine.getStateMachineAccessor().doWithAllRegions(function -> function.resetStateMachineReactively(stateMachineContext).block());
return stateMachine;
}