Created
March 24, 2017 12:37
-
-
Save 924060929/a11cde7c4fa102e4912b6518b8832597 to your computer and use it in GitHub Desktop.
show a spring-statemachine demo that join can't enter when fork a substate
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package org.springframework.statemachine.recipes.mytest; | |
import org.springframework.statemachine.StateMachine; | |
import org.springframework.statemachine.recipes.tasks.TasksHandler; | |
public class Main { | |
public static void main(String[] args) { | |
TasksHandler handler = TasksHandler.builder() | |
.task("1", taskRunnable("1")) | |
.task("1", "12", taskRunnable("12")) | |
// .task("1", "13", taskRunnable("13")) | |
.listener(new TasksHandler.TasksListenerAdapter() { | |
@Override | |
public void onTasksSuccess() { | |
System.out.println("success"); | |
} | |
}) | |
.build(); | |
StateMachine<String, String> machine = handler.getStateMachine(); | |
machine.start(); | |
handler.runTasks(); | |
} | |
private static Runnable taskRunnable(final String id) { | |
return new Runnable() { | |
@Override | |
public void run() { | |
System.out.println("run taskRunnable " + id); | |
} | |
}; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment