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

Skip to content
Snippets Groups Projects
Commit de9d968b authored by zzz's avatar zzz
Browse files

DatabaseEntry: Change from volatile to synched

parent 7bb76776
No related branches found
No related tags found
No related merge requests found
......@@ -59,8 +59,9 @@ public abstract class DatabaseEntry extends DataStructureImpl {
public final static int KEY_TYPE_SERVICE_LIST = 11;
protected volatile Signature _signature;
protected volatile Hash _currentRoutingKey;
protected volatile long _routingKeyGenMod;
// synch: this
private Hash _currentRoutingKey;
private long _routingKeyGenMod;
/**
* A common interface to the timestamp of the two subclasses.
......@@ -153,11 +154,13 @@ public abstract class DatabaseEntry extends DataStructureImpl {
throw new IllegalStateException("Not in router context");
RoutingKeyGenerator gen = ctx.routingKeyGenerator();
long mod = gen.getLastChanged();
if (mod != _routingKeyGenMod) {
_currentRoutingKey = gen.getRoutingKey(getHash());
_routingKeyGenMod = mod;
synchronized(this) {
if (mod != _routingKeyGenMod) {
_currentRoutingKey = gen.getRoutingKey(getHash());
_routingKeyGenMod = mod;
}
return _currentRoutingKey;
}
return _currentRoutingKey;
}
/**
......
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