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:
Janne Valkealahti
2015-07-25 17:09:54 +01:00
parent 0fba91cbf2
commit 178ee816a4
7 changed files with 399 additions and 46 deletions

View File

@@ -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),

View File

@@ -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>();
}
/**