Commit Graph

266 Commits

Author SHA1 Message Date
Janne Valkealahti
7fc7dd9cac Fix potential concurrency issue with join pseudostate
- Change notified flag to volatile which might explain
  some test failures.
- More testing tweaks for #76
2015-08-08 16:30:24 +01:00
Janne Valkealahti
5347ea4dd9 Fix internal transition for dist machine
- Change previous DistributedStateMachine fixes which didn't
  really work. Now explicitely getting state from machine to be set
  into ensemble for post internal transition.
- Now can send Message<E> via test plan instead of plain E.
- More testing for tweaked features.
2015-08-08 10:53:44 +01:00
Janne Valkealahti
7572a9ced3 Add extended state variables for web sample rest api 2015-08-07 17:49:49 +01:00
Janne Valkealahti
ba16830151 Remove extra debug logging 2015-08-07 17:28:48 +01:00
Janne Valkealahti
672a41ecf1 Add internal transition to web sample
- This is purely for jepsen tests, though also
  handy for UI for showing that variable can be changed.
  Essentially we want to have a way to set extended state
  variable via internal transition which takes an value from
  event headers and set that to extended state. This is then
  supposed to be used from jepsen to test concurrenty issues
  around extended state variables.
2015-08-07 17:26:02 +01:00
Janne Valkealahti
435b306cf9 Fix DistributedStateMachine internal transition
- For some reason ZookeeperStateMachineEnsemble may return null
  for very early when postTransition() is handled. Adding check not
  to ping back ensemble if its getState() returns null. It really
  feels a bit wrong right now, so need to follow this.
2015-08-07 17:25:52 +01:00
Janne Valkealahti
bba3b231b3 Synchronize Join PseudoState state machine listener
- Synchronize JoinPseudoState's
  JoinTracker.stateChanged(State<S, E>, State<S, E>) method
  for playing nice with concurrent region execution.
  Should fix #93.
- Tuning test which relates to #76. What comes for the
  tests, there was this concurrency issue and also problem
  in tests itself.
- Polish JoinPseudoState.
2015-08-07 14:38:49 +01:00
Janne Valkealahti
4008436d75 Better handling of zk bad version
- Remove propagating BadVersionException from ZookeeperStateMachineEnsemble
  via event so that machine can be kept running. Further logs are then read
  anyway via watcher. Thought we still need better handling but this
  is better for now.
- Relates to #92
2015-08-07 11:15:16 +01:00
Janne Valkealahti
e6c400e31c Fix jdk8 javadoc build 2015-08-04 09:08:22 +01:00
Janne Valkealahti
924300999e Update ref docs
- Relates to #88
2015-08-02 16:00:03 +01:00
Janne Valkealahti
70455ed329 Add status to web sample rest api 2015-08-01 18:39:49 +01:00
Janne Valkealahti
0d7ec09885 Add zk web sample ref docs 2015-07-31 19:22:35 +01:00
Janne Valkealahti
48d6459c26 Add zookeeper web example
- This is a web based distributed zookeeper state machine
  sample showing how multiple Spring boot instances having
  a state machine can work with a zookeeper to distribute state
  handling thoughout a jvm boundaries.
- Also this example is using websocket support to have live
  updates of a UI for state machine state changes.
2015-07-31 18:29:06 +01:00
Janne Valkealahti
5ab1cb3fcb Add ref docs for error handling
- Base docs for error handling and some tests
  to verify added doc samples.
- Relates to #88
2015-07-31 16:58:47 +01:00
Janne Valkealahti
d5257c64e7 Add base feature for error handling
- Add related error handling methods to StateMachine.
- Enhance StateMachineListener and context events around
  error events.
- Modify StateMachineInterceptor and stuff around it order
  to handle errors.
- Fixes #6, fixes #77
2015-07-31 13:11:19 +01:00
Janne Valkealahti
6684b0deda Fixes for zk ensemble operations
- Fix some concurrent event issues which were
  born with new tests
- Enhance tests for dist machine and ensemble
- Add new features to testing system
- Polish and add more logging
2015-07-29 20:15:42 +01:00
Janne Valkealahti
706f1de232 Update ref docs
- First set of changes for doc updates for M3
- Relates #88
2015-07-26 16:52:15 +01:00
Janne Valkealahti
e92a6c5a09 Add test framework skeleton
- Relates to #49
- New project spring-statemachine-test which contains public
  classes to easy generic state machine testing.
- Concepts of StateMachineTestPlan and StateMachineTestPlanBuilder.
- Replaced one zk test to use this framework.
2015-07-26 13:27:10 +01:00
Janne Valkealahti
ba6c689123 Fix for failing tests 2015-07-25 17:22:54 +01:00
Janne Valkealahti
178ee816a4 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
2015-07-25 17:09:54 +01:00
Janne Valkealahti
0fba91cbf2 Fix event overflow
- Fixes #89
- Added new method into EnsembleListeger which can
  be used to listen ensemble errors.
2015-07-25 08:31:03 +01:00
Janne Valkealahti
74f2f72ed6 Fix concepts around internal transitions
- Fixes #86
- Fix internal transition changes when extended
  state variables has been modified. Also internal
  transition is now correctly passed into other
  distributed state machines.
2015-07-24 09:07:03 +01:00
Janne Valkealahti
550c17f5e4 update readme 2015-07-19 18:48:08 +01:00
Janne Valkealahti
0cdd833648 Enhance concepts around interceptor
- Rename StateChangeInterceptor to StateMachineInterceptor and
  add methods for pre/post transitions.
- Adding getId concept into a state machine to help distributed
  machines to know from where a state change originates.
- Fix ZookeeperStateMachineEnsemble to work better with
  persisted state machine contexts.
2015-07-19 10:33:28 +01:00
Janne Valkealahti
15c6e507d8 Tweak concepts around state reset
- StateMachineAccess, replace state reset and variables
  with a StateMachineContext.
- Additional fixes to reset state properly even if
  target transition is a super state.
- Some polish
- Add tests
2015-07-15 11:17:43 +01:00
Janne Valkealahti
db5a1ab3f7 Update docs 2015-07-12 17:19:46 +01:00
Janne Valkealahti
c28ace7945 Enhance config model with StateMachineListener
- Fixes #84
2015-07-11 16:43:28 +01:00
Janne Valkealahti
48bb6631f9 Tweak factory lifecycle handling
- Setup autostart and afterPropertiesSet() for distributed machine.
2015-07-11 16:08:41 +01:00
Janne Valkealahti
087da55cbb Add autostart flag for top-level machine - take2
- Add actual start calls
- Rename autoStart to autoStartup in config methods.
- Tweak so that this works in factory and builder
2015-07-11 09:34:45 +01:00
Janne Valkealahti
2c0c79a537 Add autostart flag for top-level machine
- Fixes #82
- Now have configure method ConfigurationConfigurer.autoStart(boolean)
  which can be used to enable autostart feature for top-level state machine.
  We keep this feature disabled as default because most of the cases it is
  easier to enable it than disable it.
2015-07-10 18:37:16 +01:00
Janne Valkealahti
8292bbff00 Fixing initial state transitions
- Reported and fixex #81
- Change how internal state is entered and handled
  when transition doesn't terminate into initial state.
- Needed to change stuff in various places because
  some of the concepts were literally broken which were
  overlooked due to missing tests.
2015-07-10 17:24:56 +01:00
Janne Valkealahti
9b6caaf6b8 Docs updates 2015-07-05 17:36:45 +01:00
Janne Valkealahti
24ca522802 Fix typo 2015-07-05 15:52:40 +01:00
Janne Valkealahti
c4e5e999e0 Fix typo 2015-07-05 15:51:53 +01:00
Janne Valkealahti
9c67299a35 Add event if event is not accepted
- OnStateNotAcceptedEvent is fired via context
  if event is not accepted.
- eventNotAccepted called via StateMachineListener
  if event is not accepted.
- Test in StateMachineEventTests.testEventNotAccepted()
- Fixes #43
2015-07-05 15:43:04 +01:00
Janne Valkealahti
bba4bc1d28 Add headers and events to serialization
- Relates to #35
- Now event headers and extended state variables
  are serialized with kryo and zookeeper.
2015-07-05 09:52:36 +01:00
Janne Valkealahti
cb3b811707 Fix for failing test 2015-07-04 18:39:20 +01:00
Janne Valkealahti
bdbe9c32db Fix for failing test 2015-07-04 18:27:29 +01:00
Janne Valkealahti
ddc19392c6 Further fixes for tasks recipe
- Relates to #74
- Add missing features for listener
- Tweak rest of a missing tasks features
2015-07-04 18:13:07 +01:00
Janne Valkealahti
2ac515b04b Polish 2015-07-04 15:34:24 +01:00
Janne Valkealahti
6ae2f2fa43 Can now skip initial state
- Fixes #71
- If substate is entered directry, we don't
  go via initial state for particular state machine
  where transition ends.
- Fixing other tests which assumed initial state is entered.
- In terms of a history state, initial state is still entered.
2015-07-04 15:15:27 +01:00
Janne Valkealahti
4b858b1d9b Add skeleton for tasks recipe
- Relates to #74
- Tasks recipe not yet fully working, need to get
  this work in to be able to work with other tickets.
- Add childs to StateMachineContext
- A lot of fixes to regions concept throughout
  a code base. Some of the concepts were really broken
  if there were a complex recursive set of regions, etc.
- Add task executor/scheduler to StateMachineBuilder
2015-07-03 14:02:17 +01:00
Janne Valkealahti
44d09f257e Change StateMachinePersist interface
- Remove away from plain serialize/deserialize to write/read
  concept which works better in a generic abstraction.
- Tweak related class in zookeeper package.
- Relates to #35
2015-06-20 15:44:49 +01:00
Janne Valkealahti
e2fe4907d3 Add config builder for distributed machine
- New configurer which can be used to define an ensemble which
  if is set automatically wraps a machine with a distributed
  state machine and sets it to use an given ensemble.
- Relates to #35
2015-06-18 13:20:04 +01:00
Janne Valkealahti
742010f1a5 Change distributed machine to use interceptor
- Move away from using state machine listener if favor
  of interceptor which allows to skip state change.
- Remove previously added method in a
  StateMachineListener. (was a bad idea).
- More tweaks to zk example
- Relates to #35
2015-06-18 11:22:37 +01:00
Janne Valkealahti
1bcdbd5ae0 Add base work for recipes
- Better state sync handling #35
- Adding first recipe for synching and
  persisting a state # 73
2015-06-17 09:19:43 +01:00
Janne Valkealahti
608183f2a3 Add builder pattern for state machine instantiation
- Relates to #45
- Modify current annotation builder model to work via
  manual StateMachineBuilder class.
- Add ConfigurationConfigurer to configure bean factory,
  task executor and task scheduler via builder.
2015-06-13 22:17:06 +01:00
Janne Valkealahti
c03b998d1e Update readme 2015-06-12 19:25:43 +01:00
Janne Valkealahti
c68fa5d09d Add skeleton for distributed state machine
- NOTE: not yet fully working distributed sm, this
  commit is considered to be a stage 1 of further
  commits on this matter.
- Preliminary concept of DistributedStateMachine,
  StateMachineEnsemble and StateMachinePersist.
- New module spring-statemachine-zookeeper order to
  persist state in a distributed matter.
- Refactoring concept of a state machine access to get
  better internal access into a sm via functional interfaces.
- Change build to use jdk7 and change test to rely on jdk8
  order to test functional lambdas.
- new zookeeper sample demonstrating distributed concepts.
- Relates t0 #35 and #34.
- No docs until things are fully implemented.
2015-06-12 18:15:50 +01:00
Janne Valkealahti
1648b39de1 Lift requirement of enums for states and events
- Relasing the use of enums where applicable
- Fixes #69
2015-06-03 18:26:21 +01:00