HomeSF Project Home

Gridarta Transaction System

The Gridarta editor (currently daimonin only, in future crossfire as well) has a transaction system. This document describes the current and future purposes of the transaction system.


Originally the transaction system was developed during reimplementing the maps as model view controller. Before I (Cher) started working on the editor, the code looked like being model view controller but it wasn't. The central point of model view controller is not naming classes model, view and control or whatever. The central point of model view controller is a message system and a view registry so each time the model changes, all registered views are notified and updated automatically. In Java, this is done via event listeners. This was missing.

When adding the event listeners to the map MVC, the system might have run into the problem that for instance when deleting a whole selected region, an event would be fired for every single deleted object, resulting in bulky slow behavior. I've added a transaction system that's first purpose was to group changes to the model so only the last change actually fires an event. The typical call sequence is: beginTransaction(), perform changes, endTransaction(). The event will be fired when endTransaction() is called.

The transaction system supports nesting. That means if a call sequence is: beginTransaction() ... beginTransaction() ... endTransaction() ... endTransaction(), only the last endTransaction() actually fires an event. In case an exception occurs, the transaction system also supports an endAllTransactions(), and for completeness I've added a getTransactionDepth() method.

Future / New Requirements

There are some requirements that could also be fulfilled using the transaction system. LogoSupport This Projectfreshmeat.netValid HTML 4.01!Valid CSS! Feedback: webmaster