Java Reference
In-Depth Information
outputObject # new ObjectOutputStream(outputFile);
} catch (IOException ioe) { ioe.printStackTrace(); }
}
public static void bind(Trackable target, String key)
throws Exception{
if (objectList.containsValue(target))
throw new RuntimeException("Object already bound");
else if (objectList.containsKey(key))
throw new RuntimeException("Key already in use");
else
objectList.put(key, target);
}
public static void record(Trackable target,
String methodName, String when){
try {
Entry entry # new Entry(target, methodName, when);
outputObject.writeObject(entry);
} catch (IOException ioe) { ioe.printStackTrace(); }
}
public static void saveStablePoint() {
Tracker.startTracking();
entryList.removeAll(entryList);
try {
// save the state of every registered object in the
// log file
FileOutputStream outputFile #
new FileOutputStream("trackerState.log");
ObjectOutputStream outputObject #
new ObjectOutputStream(outputFile);
outputObject.writeObject(objectList);
outputObject.close();
outputFile.close();
currentEntry # 0;
} catch (IOException ioe) { ioe.printStackTrace(); }
}
public static void restore() {
try {
// loads the last saved stable point
FileInputStream inputFile #
new FileInputStream("trackerState.log");
ObjectInputStream inputObject #
new ObjectInputStream(inputFile);
Search WWH ::




Custom Search