I2P Address: [http://git.idk.i2p]

Skip to content
Snippets Groups Projects
Unverified Commit 621862af authored by zzz's avatar zzz
Browse files

NetDB: Replace Set with List in ExpireLeasesJob for efficiency

parent af99250a
No related branches found
No related tags found
No related merge requests found
......@@ -8,9 +8,9 @@ package net.i2p.router.networkdb.kademlia;
*
*/
import java.util.HashSet;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import java.util.Set;
import net.i2p.data.DatabaseEntry;
import net.i2p.data.Hash;
......@@ -41,7 +41,7 @@ class ExpireLeasesJob extends JobImpl {
public String getName() { return "Expire Lease Sets Job"; }
public void runJob() {
Set<Hash> toExpire = selectKeysToExpire();
List<Hash> toExpire = selectKeysToExpire();
_log.info("Leases to expire: " + toExpire);
for (Hash key : toExpire) {
_facade.fail(key);
......@@ -57,8 +57,8 @@ class ExpireLeasesJob extends JobImpl {
* don't have any leases that haven't yet passed, even with the CLOCK_FUDGE_FACTOR)
*
*/
private Set<Hash> selectKeysToExpire() {
Set<Hash> toExpire = new HashSet<Hash>(128);
private List<Hash> selectKeysToExpire() {
List<Hash> toExpire = new ArrayList<Hash>(128);
for (Map.Entry<Hash, DatabaseEntry> entry : _facade.getDataStore().getMapEntries()) {
DatabaseEntry obj = entry.getValue();
if (obj.isLeaseSet()) {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment