forked from I2P_Developers/i2p.i2p
Data: Clear more caches when under memory pressure and at shutdown
This commit is contained in:
@@ -104,4 +104,11 @@ public class Hash extends SimpleDataStructure {
|
|||||||
}
|
}
|
||||||
return _base64ed;
|
return _base64ed;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @since 0.9.17
|
||||||
|
*/
|
||||||
|
public static void clearCache() {
|
||||||
|
_cache.clear();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@@ -68,4 +68,11 @@ public class PublicKey extends SimpleDataStructure {
|
|||||||
public int length() {
|
public int length() {
|
||||||
return KEYSIZE_BYTES;
|
return KEYSIZE_BYTES;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @since 0.9.17
|
||||||
|
*/
|
||||||
|
public static void clearCache() {
|
||||||
|
_cache.clear();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@@ -91,11 +91,18 @@ public class SDSCache<V extends SimpleDataStructure> {
|
|||||||
*/
|
*/
|
||||||
private class Shutdown implements Runnable {
|
private class Shutdown implements Runnable {
|
||||||
public void run() {
|
public void run() {
|
||||||
|
clear();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @since 0.9.17
|
||||||
|
*/
|
||||||
|
public void clear() {
|
||||||
synchronized(_cache) {
|
synchronized(_cache) {
|
||||||
_cache.clear();
|
_cache.clear();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* WARNING - If the SDS is found in the cache, the passed-in
|
* WARNING - If the SDS is found in the cache, the passed-in
|
||||||
|
@@ -193,4 +193,11 @@ public class SigningPublicKey extends SimpleDataStructure {
|
|||||||
buf.append(']');
|
buf.append(']');
|
||||||
return buf.toString();
|
return buf.toString();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @since 0.9.17
|
||||||
|
*/
|
||||||
|
public static void clearCache() {
|
||||||
|
_cache.clear();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@@ -1,4 +1,5 @@
|
|||||||
2014-11-12 zzz
|
2014-11-12 zzz
|
||||||
|
* Data: Clear more caches when under memory pressure and at shutdown
|
||||||
* Plugins: Fix bug in stopping a ClientApp plugin with $parameters in the args
|
* Plugins: Fix bug in stopping a ClientApp plugin with $parameters in the args
|
||||||
|
|
||||||
2014-11-09 zzz
|
2014-11-09 zzz
|
||||||
|
@@ -25,14 +25,18 @@ import java.util.concurrent.ConcurrentHashMap;
|
|||||||
|
|
||||||
import gnu.getopt.Getopt;
|
import gnu.getopt.Getopt;
|
||||||
|
|
||||||
|
import net.i2p.crypto.SigUtil;
|
||||||
import net.i2p.data.Base64;
|
import net.i2p.data.Base64;
|
||||||
import net.i2p.data.Certificate;
|
import net.i2p.data.Certificate;
|
||||||
import net.i2p.data.DataFormatException;
|
import net.i2p.data.DataFormatException;
|
||||||
import net.i2p.data.DataHelper;
|
import net.i2p.data.DataHelper;
|
||||||
import net.i2p.data.Destination;
|
import net.i2p.data.Destination;
|
||||||
import net.i2p.data.router.RouterInfo;
|
import net.i2p.data.Hash;
|
||||||
|
import net.i2p.data.PublicKey;
|
||||||
import net.i2p.data.SigningPrivateKey;
|
import net.i2p.data.SigningPrivateKey;
|
||||||
|
import net.i2p.data.SigningPublicKey;
|
||||||
import net.i2p.data.i2np.GarlicMessage;
|
import net.i2p.data.i2np.GarlicMessage;
|
||||||
|
import net.i2p.data.router.RouterInfo;
|
||||||
import net.i2p.router.message.GarlicMessageHandler;
|
import net.i2p.router.message.GarlicMessageHandler;
|
||||||
import net.i2p.router.networkdb.kademlia.FloodfillNetworkDatabaseFacade;
|
import net.i2p.router.networkdb.kademlia.FloodfillNetworkDatabaseFacade;
|
||||||
import net.i2p.router.startup.CreateRouterInfoJob;
|
import net.i2p.router.startup.CreateRouterInfoJob;
|
||||||
@@ -346,6 +350,10 @@ public class Router implements RouterClock.ClockShiftListener {
|
|||||||
SimpleByteCache.clearAll();
|
SimpleByteCache.clearAll();
|
||||||
Destination.clearCache();
|
Destination.clearCache();
|
||||||
Translate.clearCache();
|
Translate.clearCache();
|
||||||
|
Hash.clearCache();
|
||||||
|
PublicKey.clearCache();
|
||||||
|
SigningPublicKey.clearCache();
|
||||||
|
SigUtil.clearCaches();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
Reference in New Issue
Block a user