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