hey tom!it works like this:prevayler makes the copy of the system only before the first transaction and after a failing transaction.
if (foodtaster == null)
foodtaster = copyKing();
if (execute action on foodtaster fails)
foodtaster = null;
execute action on king
Thanks, I understand better now.
if (king == null)
king = loadKingAndRollForward(); // that is, restore from the persistent store
if (execute action on king fails)
king = null;
So you don't have to execute an action twice, and you don't use as much memory, but you do need to do a reload instead of a copy when a transaction fails.
I imagine that reloading is more expensive than copying?