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

Skip to content
Snippets Groups Projects
Commit d40bb459 authored by ragnarok's avatar ragnarok Committed by zzz
Browse files

* Get the PetNameDB for the PetNameNamingService from the router context.

parent edf04f07
No related branches found
No related tags found
No related merge requests found
...@@ -5,6 +5,7 @@ import java.util.Properties; ...@@ -5,6 +5,7 @@ import java.util.Properties;
import java.util.Set; import java.util.Set;
import net.i2p.client.naming.NamingService; import net.i2p.client.naming.NamingService;
import net.i2p.client.naming.PetNameDB;
import net.i2p.crypto.AESEngine; import net.i2p.crypto.AESEngine;
import net.i2p.crypto.CryptixAESEngine; import net.i2p.crypto.CryptixAESEngine;
import net.i2p.crypto.DSAEngine; import net.i2p.crypto.DSAEngine;
...@@ -60,6 +61,7 @@ public class I2PAppContext { ...@@ -60,6 +61,7 @@ public class I2PAppContext {
private StatManager _statManager; private StatManager _statManager;
private SessionKeyManager _sessionKeyManager; private SessionKeyManager _sessionKeyManager;
private NamingService _namingService; private NamingService _namingService;
private PetNameDB _petnameDb;
private ElGamalEngine _elGamalEngine; private ElGamalEngine _elGamalEngine;
private ElGamalAESEngine _elGamalAESEngine; private ElGamalAESEngine _elGamalAESEngine;
private AESEngine _AESEngine; private AESEngine _AESEngine;
...@@ -74,6 +76,7 @@ public class I2PAppContext { ...@@ -74,6 +76,7 @@ public class I2PAppContext {
private volatile boolean _statManagerInitialized; private volatile boolean _statManagerInitialized;
private volatile boolean _sessionKeyManagerInitialized; private volatile boolean _sessionKeyManagerInitialized;
private volatile boolean _namingServiceInitialized; private volatile boolean _namingServiceInitialized;
private volatile boolean _petnameDbInitialized;
private volatile boolean _elGamalEngineInitialized; private volatile boolean _elGamalEngineInitialized;
private volatile boolean _elGamalAESEngineInitialized; private volatile boolean _elGamalAESEngineInitialized;
private volatile boolean _AESEngineInitialized; private volatile boolean _AESEngineInitialized;
...@@ -128,6 +131,7 @@ public class I2PAppContext { ...@@ -128,6 +131,7 @@ public class I2PAppContext {
_statManager = null; _statManager = null;
_sessionKeyManager = null; _sessionKeyManager = null;
_namingService = null; _namingService = null;
_petnameDb = null;
_elGamalEngine = null; _elGamalEngine = null;
_elGamalAESEngine = null; _elGamalAESEngine = null;
_logManager = null; _logManager = null;
...@@ -237,6 +241,19 @@ public class I2PAppContext { ...@@ -237,6 +241,19 @@ public class I2PAppContext {
} }
} }
public PetNameDB petnameDb() {
if (!_petnameDbInitialized) initializePetnameDb();
return _petnameDb;
}
private void initializePetnameDb() {
synchronized (this) {
if (_petnameDb == null) {
_petnameDb = new PetNameDB();
}
_petnameDbInitialized = true;
}
}
/** /**
* This is the ElGamal engine used within this context. While it doesn't * This is the ElGamal engine used within this context. While it doesn't
* really have anything substantial that is context specific (the algorithm * really have anything substantial that is context specific (the algorithm
......
...@@ -17,7 +17,7 @@ public class PetNameNamingService extends NamingService { ...@@ -17,7 +17,7 @@ public class PetNameNamingService extends NamingService {
public PetNameNamingService(I2PAppContext context) { public PetNameNamingService(I2PAppContext context) {
super(context); super(context);
_petnameDb = new PetNameDB(); _petnameDb = _context.petnameDb();
String file = _context.getProperty(PROP_PETNAME_FILE, DEFAULT_PETNAME_FILE); String file = _context.getProperty(PROP_PETNAME_FILE, DEFAULT_PETNAME_FILE);
//If the petnamedb file doesn't exist, create it, using the //If the petnamedb file doesn't exist, create it, using the
......
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