Java Reference
In-Depth Information
Figure 18.6 The Tower of Hanoi in an inconsistent state. Copyright © 2005 Sun Micro-
systems, Inc. All rights reserved. Reproduced by permission of Sun Microsystems, Inc.
Tracker.record( this , "move", new Class[] {String.class,
String.class}, new Object[] {from, to});
towers[Integer.parseInt(to)].push(
towers[Integer.parseInt(from)].pull() );
drawingArea.drawingPanel.repaint();
}
}
Figure 18.6 shows an inconsistent configuration of the Tower of Hanoi
puzzle resulting from the re-execution of operations recorded in the log file
when logical recording of both complex and simple operations is enabled.
18.6
Extension
The reader can extend the framework in several ways:
Consider the problem of tracking operations that return a value. Is it
necessary to log the return value?
Add more sophisticated and efficient undo
redo functionalities. Is it
necessary to recover from the last saved stable state in order to undo
operations in the case of physical recording? Is it possible to undo a few
operations and then continue normal execution? Should the log file
record that some operations have been undone?
Address not only user interactive applications, but also autonomously
running applications. This requires the definition of more complex
recovery procedures: when the application restarts, it must recover the
last stable state, reapply all the subsequent state changes, and then
continue its execution autonomously.
Address concurrent applications. This requires solving synchronization
problems for concurrent read and write operations on the log file.
Adopt the framework to make recoverable some of the case studies
discussed in previous chapters, such as Chapter 3 (Scheduler), Chapter 4
 
Search WWH ::




Custom Search