* PersistentDataStore: Don't try to remove nonexistent leaseSet files

This commit is contained in:
zzz
2008-06-24 14:39:14 +00:00
parent a11b74b2d8
commit f057666ac2
4 changed files with 13 additions and 1 deletions

View File

@ -18,6 +18,7 @@ public interface DataStore {
public DataStructure get(Hash key);
public void put(Hash key, DataStructure data);
public DataStructure remove(Hash key);
public DataStructure removeLease(Hash key);
public Set getKeys();
public void restart();
public int countLeaseSets();

View File

@ -783,7 +783,10 @@ public class KademliaNetworkDatabaseFacade extends NetworkDatabaseFacade {
// if we dont know the key, lets make sure it isn't a now-dead peer
}
_ds.remove(dbEntry);
if (isRouterInfo)
_ds.remove(dbEntry);
else
_ds.removeLease(dbEntry);
synchronized (_lastSent) {
_lastSent.remove(dbEntry);
}

View File

@ -63,6 +63,10 @@ class PersistentDataStore extends TransientDataStore {
return super.remove(key);
}
public DataStructure removeLease(Hash key) {
return super.removeLease(key);
}
public void put(Hash key, DataStructure data) {
if ( (data == null) || (key == null) ) return;
super.put(key, data);

View File

@ -163,6 +163,10 @@ class TransientDataStore implements DataStore {
return buf.toString();
}
public DataStructure removeLease(Hash key) {
return remove(key);
}
public DataStructure remove(Hash key) {
synchronized (_data) {
if (_log.shouldLog(Log.DEBUG))