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

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

remove static logs

parent 4f6ed700
No related branches found
No related tags found
No related merge requests found
......@@ -16,7 +16,7 @@ import net.i2p.I2PAppContext;
/**
* Wrapper class for whatever logging system I2P uses. This class should be
* instantiated and kept as a variable for each class it is used by, ala:
* <code>private final static Log _log = new Log(MyClassName.class);</code>
* <code>private final Log _log = context.logManager().getLog(MyClassName.class);</code>
*
* If there is anything in here that doesn't make sense, turn off your computer
* and go fly a kite.
......
......@@ -31,7 +31,6 @@ public class SimpleTimer2 {
private static final int MIN_THREADS = 2;
private static final int MAX_THREADS = 4;
private final I2PAppContext _context;
private static Log _log; // static so TimedEvent can use it
private final ScheduledThreadPoolExecutor _executor;
private final String _name;
private int _count;
......@@ -40,7 +39,6 @@ public class SimpleTimer2 {
protected SimpleTimer2() { this("SimpleTimer2"); }
protected SimpleTimer2(String name) {
_context = I2PAppContext.getGlobalContext();
_log = _context.logManager().getLog(SimpleTimer2.class);
_name = name;
_count = 0;
long maxMemory = Runtime.getRuntime().maxMemory();
......@@ -79,8 +77,10 @@ public class SimpleTimer2 {
@Override
protected void afterExecute(Runnable r, Throwable t) {
super.afterExecute(r, t);
if (t != null) // shoudn't happen, caught in RunnableEvent.run()
_log.log(Log.CRIT, "wtf, event borked: " + r, t);
if (t != null) { // shoudn't happen, caught in RunnableEvent.run()
Log log = I2PAppContext.getGlobalContext().logManager().getLog(SimpleTimer2.class);
log.log(Log.CRIT, "wtf, event borked: " + r, t);
}
}
}
......@@ -126,6 +126,7 @@ public class SimpleTimer2 {
*
*/
public static abstract class TimedEvent implements Runnable {
private final Log _log;
private SimpleTimer2 _pool;
private int _fuzz;
protected static final int DEFAULT_FUZZ = 3;
......@@ -136,7 +137,9 @@ public class SimpleTimer2 {
public TimedEvent(SimpleTimer2 pool) {
_pool = pool;
_fuzz = DEFAULT_FUZZ;
_log = I2PAppContext.getGlobalContext().logManager().getLog(SimpleTimer2.class);
}
/** automatically schedules, don't use this one if you have other things to do first */
public TimedEvent(SimpleTimer2 pool, long timeoutMs) {
this(pool);
......
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