From 07b3c8a7b4956bce19088758a7413c986905397a Mon Sep 17 00:00:00 2001 From: zzz <zzz@mail.i2p> Date: Tue, 2 Oct 2012 12:38:05 +0000 Subject: [PATCH] * PRNG, LogWriter: Use I2PThread to catch OOM --- core/java/src/gnu/crypto/prng/AsyncFortunaStandalone.java | 3 ++- core/java/src/net/i2p/util/LogManager.java | 4 ++-- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/core/java/src/gnu/crypto/prng/AsyncFortunaStandalone.java b/core/java/src/gnu/crypto/prng/AsyncFortunaStandalone.java index 46e994695d..1a2ec48921 100644 --- a/core/java/src/gnu/crypto/prng/AsyncFortunaStandalone.java +++ b/core/java/src/gnu/crypto/prng/AsyncFortunaStandalone.java @@ -5,6 +5,7 @@ import java.util.Map; import java.util.concurrent.LinkedBlockingQueue; import net.i2p.I2PAppContext; +import net.i2p.util.I2PThread; import net.i2p.util.Log; /** @@ -53,7 +54,7 @@ public class AsyncFortunaStandalone extends FortunaStandalone implements Runnabl for (int i = 0; i < _bufferCount; i++) _emptyBuffers.offer(new AsyncBuffer(_bufferSize)); _isRunning = true; - _refillThread = new Thread(this, "PRNG"); + _refillThread = new I2PThread(this, "PRNG"); _refillThread.setDaemon(true); _refillThread.setPriority(Thread.MIN_PRIORITY+1); _refillThread.start(); diff --git a/core/java/src/net/i2p/util/LogManager.java b/core/java/src/net/i2p/util/LogManager.java index 689b046f92..cf6cb9593c 100644 --- a/core/java/src/net/i2p/util/LogManager.java +++ b/core/java/src/net/i2p/util/LogManager.java @@ -159,8 +159,8 @@ public class LogManager { if (_writer != null) return; _writer = new LogWriter(this); - // NOT an I2PThread, as it contains logging and we end up with problems - Thread t = new Thread(_writer, "LogWriter"); + // if you enable logging in I2PThread again, you MUST change this back to Thread + Thread t = new I2PThread(_writer, "LogWriter"); t.setDaemon(true); t.start(); } -- GitLab