feat: 状态机内置默认用于异步执行事件的线程池.

This commit is contained in:
2025-02-17 12:45:51 +08:00
parent 4b4a6d27b3
commit 4a843f885e
4 changed files with 59 additions and 3 deletions

View File

@@ -21,9 +21,8 @@ public class MachineTest {
@Test
public void testStandardStateMachine() throws Exception {
StateMachine<PrinterState> stateMachine = StateMachineBuilder.from(PrinterState.values())
.async(false)
.async(true)
.standard()
.executor(Executors.newFixedThreadPool(16))
.whenLeave(PrinterState.IDLE, h -> {
System.out.println(Thread.currentThread().getName() + ": leave IDLE");
})