Efficient persistent recoverable object collections
Original Publication Date: 2000-Apr-07
Included in the Prior Art Database: 2003-Jun-20
It is a common requirement to be able to store data in persistent keyed collections. TM Programming languages such as Java provide classes that permit the efficient storage of objects in keyed collections but they are not persistent. These collections may be made persistent by serialising the collection to a file. The process of serialising the complete collection is relatively expensive in terms of processing power and thus for a collection of any size it is not practical to persist the collection after the addition or removal of a single element. Disclosed is a method whereby the existing collection classes and object serialisation mechanisms may be used in concert to create efficient persistent collections. The capabilities of the keyed collection classes of the language and the ability to make an object persistent through serialisation can be combined to create a keyed collection that efficiently maintains a persistent image of itself without incurring the overhead of persisting the whole collection after each update. In a perfect world the standard keyed collection classes could be used unchanged. When the system starts up the collection can be reinstated from its persistent form. During the execution of the system objects can be added and removed from the collection. The system can then be shutdown in an orderly fashion and a new persistent form of the collection created through object serialisation. In the real world though a failure of such a system prior to orderly shutdown causes the loss of all additions and deletions made since start up. A solution to this problem is to extend the simple system described above by adding a form of persistent journal to track the changes made to the collection during the life of the system. Instead of saving the whole collection after each change only a journal entry is written. On the next startup of the system, if it can be determined that the system was not shutdown in an orderly fashion, the journal entries can be applied one by one to the collection to reinstate any lost changes.