Enhancements to tasks recipe
- Fix AbstractStateMachineFactory so that it does not try to create transitions with null source or target. Basically we just skip transition source or target which doesn't belong to region. - Change DefaultExtendedState to use ConcurrentHashMap so that there's less change to get into trouble with concurrency. - Add statechart for tasks recipe. - Fix various concepts in TasksHandler and its tests. - Prepare some examples for docs. - Fixes #74
This commit is contained in:
@@ -510,7 +510,7 @@ public abstract class AbstractStateMachineFactory<S, E> extends LifecycleObjectS
|
||||
|
||||
if (transitionData.getKind() == TransitionKind.EXTERNAL) {
|
||||
// TODO can we do this?
|
||||
if (stateMap.get(source) == null && stateMap.get(target) == null) {
|
||||
if (stateMap.get(source) == null || stateMap.get(target) == null) {
|
||||
continue;
|
||||
}
|
||||
DefaultExternalTransition<S, E> transition = new DefaultExternalTransition<S, E>(stateMap.get(source),
|
||||
|
||||
@@ -15,8 +15,8 @@
|
||||
*/
|
||||
package org.springframework.statemachine.support;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
import java.util.concurrent.ConcurrentHashMap;
|
||||
|
||||
import org.springframework.statemachine.ExtendedState;
|
||||
|
||||
@@ -34,7 +34,7 @@ public class DefaultExtendedState implements ExtendedState {
|
||||
* Instantiates a new default extended state.
|
||||
*/
|
||||
public DefaultExtendedState() {
|
||||
this.variables = new HashMap<Object, Object>();
|
||||
this.variables = new ConcurrentHashMap<Object, Object>();
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user