Question: Using Java use the Proxy pattern to support a persistent and recoverable HashMap, which we'll call RecoverableHashMap. RecoverableHashMap must also implement the Map interface. You

Using Java use the Proxy pattern to support a persistent and recoverable HashMap, which we'll call RecoverableHashMap. RecoverableHashMap must also implement the Map interface. You will be responsible for logging the clear(), put(K,V), remove(Object), replace(K, V) functions so that in case of a "crash", you could "replay" these operations to restore the state of the HashMap. [Revised from original draft] You don't have the freedom to modify the Map interface, but we do want to support a "flush()" function which saves the current HashMap and clears the log, plus a "recover()" function which will load the current HashMap and replay the logged operations to recover the HashMap. To manage the RecoverableHashMap, define a class RecoveryManager. This class will also be generic in the key and value types. It will have: A constructor that takes a Map and two strings. The map is the object to wrap inside our RecoverableHashMap. The strings are the names of the file for storing the map. A getter for the (wrapped) map flush() and recover()

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!