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;
|
||||
}
|
||||
|
||||
/**
|
||||
* @since 0.9.17
|
||||
*/
|
||||
public static void clearCache() {
|
||||
_cache.clear();
|
||||
}
|
||||
}
|
||||
|
@ -68,4 +68,11 @@ public class PublicKey extends SimpleDataStructure {
|
||||
public int length() {
|
||||
return KEYSIZE_BYTES;
|
||||
}
|
||||
|
||||
/**
|
||||
* @since 0.9.17
|
||||
*/
|
||||
public static void clearCache() {
|
||||
_cache.clear();
|
||||
}
|
||||
}
|
||||
|
@ -91,9 +91,16 @@ public class SDSCache<V extends SimpleDataStructure> {
|
||||
*/
|
||||
private class Shutdown implements Runnable {
|
||||
public void run() {
|
||||
synchronized(_cache) {
|
||||
_cache.clear();
|
||||
}
|
||||
clear();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @since 0.9.17
|
||||
*/
|
||||
public void clear() {
|
||||
synchronized(_cache) {
|
||||
_cache.clear();
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -193,4 +193,11 @@ public class SigningPublicKey extends SimpleDataStructure {
|
||||
buf.append(']');
|
||||
return buf.toString();
|
||||
}
|
||||
|
||||
/**
|
||||
* @since 0.9.17
|
||||
*/
|
||||
public static void clearCache() {
|
||||
_cache.clear();
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user