fix db writes to disk broken in last checkin

This commit is contained in:
zzz
2009-05-20 22:35:56 +00:00
parent b7e2d3a10b
commit 438ea1b269

View File

@ -193,9 +193,11 @@ class PersistentDataStore extends TransientDataStore {
while (true) { while (true) {
// get a new iterator every time to get a random entry without // get a new iterator every time to get a random entry without
// having concurrency issues or copying to a List or Array // having concurrency issues or copying to a List or Array
Iterator<Hash> iter = _keys.keySet().iterator(); Iterator<Map.Entry<Hash, DataStructure>> iter = _keys.entrySet().iterator();
try { try {
key = iter.next(); Map.Entry<Hash, DataStructure> entry = iter.next();
key = entry.getKey();
data = entry.getValue();
iter.remove(); iter.remove();
count++; count++;
} catch (NoSuchElementException nsee) { } catch (NoSuchElementException nsee) {
@ -207,7 +209,6 @@ class PersistentDataStore extends TransientDataStore {
} }
if (key != null) { if (key != null) {
data = _keys.get(key);
if (data != null) { if (data != null) {
write(key, data); write(key, data);
data = null; data = null;