itm / testbed-runtime

WISEBED Wireless Sensor Network Testbed Infrastructure Software
https://github.com/itm/testbed-runtime/wiki
15 stars 11 forks source link

Fix life cycle of reservation #380

Closed danbim closed 10 years ago

danbim commented 10 years ago

Currently the life cycle of a reservation is bound to the life cycle of an instance of the Reservation interface and the other way around. The current states correspond to the states of a Guava Service instance (new, starting, running, shutting down and terminated) and there are two life cycle events being propagated over the PortalEventBus: ReservationStartedEvent and ReservationEndedEvent.

After fixing the life cycle of the reservation (domain logic) should have the following states:

State transitions into cancelled can occur from both scheduled and running. The cancelled state also contains the timestamp of the cancellation making it the effective end time of the reservation so that reserved resources can be reused again.

For every transition in the state machine there shall be pre- and post-transition events fired: