Router: Add gzip caches to clearCaches()

This commit is contained in:
zzz
2015-05-30 11:18:04 +00:00
parent c807194e93
commit 7715e6484c
3 changed files with 22 additions and 0 deletions

View File

@ -43,6 +43,15 @@ public class ReusableGZIPInputStream extends ResettableGZIPInputStream {
private ReusableGZIPInputStream() { super(); }
/**
* Clear the cache.
* @since 0.9.21
*/
public static void clearCache() {
if (_available != null)
_available.clear();
}
/*******
public static void main(String args[]) {
for (int i = 0; i < 2; i++)

View File

@ -75,6 +75,15 @@ public class ReusableGZIPOutputStream extends ResettableGZIPOutputStream {
/** pull the contents of the stream written */
public byte[] getData() { return _buffer.toByteArray(); }
/**
* Clear the cache.
* @since 0.9.21
*/
public static void clearCache() {
if (_available != null)
_available.clear();
}
/******
public static void main(String args[]) {
try {

View File

@ -52,6 +52,8 @@ import net.i2p.util.I2PThread;
import net.i2p.util.Log;
import net.i2p.util.NativeBigInteger;
import net.i2p.util.OrderedProperties;
import net.i2p.util.ReusableGZIPInputStream;
import net.i2p.util.ReusableGZIPOutputStream;
import net.i2p.util.SecureFileOutputStream;
import net.i2p.util.SimpleByteCache;
import net.i2p.util.SystemVersion;
@ -420,6 +422,8 @@ public class Router implements RouterClock.ClockShiftListener {
SigningPublicKey.clearCache();
SigUtil.clearCaches();
I2PSessionImpl.clearCache();
ReusableGZIPInputStream.clearCache();
ReusableGZIPOutputStream.clearCache();
}
/**