* Get the PetNameDB for the PetNameNamingService from the router context.
This commit is contained in:
@ -5,6 +5,7 @@ import java.util.Properties;
|
||||
import java.util.Set;
|
||||
|
||||
import net.i2p.client.naming.NamingService;
|
||||
import net.i2p.client.naming.PetNameDB;
|
||||
import net.i2p.crypto.AESEngine;
|
||||
import net.i2p.crypto.CryptixAESEngine;
|
||||
import net.i2p.crypto.DSAEngine;
|
||||
@ -60,6 +61,7 @@ public class I2PAppContext {
|
||||
private StatManager _statManager;
|
||||
private SessionKeyManager _sessionKeyManager;
|
||||
private NamingService _namingService;
|
||||
private PetNameDB _petnameDb;
|
||||
private ElGamalEngine _elGamalEngine;
|
||||
private ElGamalAESEngine _elGamalAESEngine;
|
||||
private AESEngine _AESEngine;
|
||||
@ -74,6 +76,7 @@ public class I2PAppContext {
|
||||
private volatile boolean _statManagerInitialized;
|
||||
private volatile boolean _sessionKeyManagerInitialized;
|
||||
private volatile boolean _namingServiceInitialized;
|
||||
private volatile boolean _petnameDbInitialized;
|
||||
private volatile boolean _elGamalEngineInitialized;
|
||||
private volatile boolean _elGamalAESEngineInitialized;
|
||||
private volatile boolean _AESEngineInitialized;
|
||||
@ -128,6 +131,7 @@ public class I2PAppContext {
|
||||
_statManager = null;
|
||||
_sessionKeyManager = null;
|
||||
_namingService = null;
|
||||
_petnameDb = null;
|
||||
_elGamalEngine = null;
|
||||
_elGamalAESEngine = null;
|
||||
_logManager = null;
|
||||
@ -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
|
||||
* really have anything substantial that is context specific (the algorithm
|
||||
|
@ -17,7 +17,7 @@ public class PetNameNamingService extends NamingService {
|
||||
|
||||
public PetNameNamingService(I2PAppContext context) {
|
||||
super(context);
|
||||
_petnameDb = new PetNameDB();
|
||||
_petnameDb = _context.petnameDb();
|
||||
String file = _context.getProperty(PROP_PETNAME_FILE, DEFAULT_PETNAME_FILE);
|
||||
|
||||
//If the petnamedb file doesn't exist, create it, using the
|
||||
|
Reference in New Issue
Block a user