forked from I2P_Developers/i2p.i2p
* I2PThread: Remove logging, too many issues with extra contexts
This commit is contained in:
@@ -23,48 +23,50 @@ public class I2PThread extends Thread {
|
|||||||
/**
|
/**
|
||||||
* Non-static to avoid refs to old context in Android.
|
* Non-static to avoid refs to old context in Android.
|
||||||
* Probably should just remove all the logging though.
|
* Probably should just remove all the logging though.
|
||||||
|
* Logging removed, too much trouble with extra contexts
|
||||||
*/
|
*/
|
||||||
private volatile Log _log;
|
//private volatile Log _log;
|
||||||
private static final Set _listeners = new CopyOnWriteArraySet();
|
private static final Set _listeners = new CopyOnWriteArraySet();
|
||||||
private String _name;
|
//private String _name;
|
||||||
private Exception _createdBy;
|
//private Exception _createdBy;
|
||||||
|
|
||||||
public I2PThread() {
|
public I2PThread() {
|
||||||
super();
|
super();
|
||||||
if ( (_log == null) || (_log.shouldLog(Log.DEBUG)) )
|
//if ( (_log == null) || (_log.shouldLog(Log.DEBUG)) )
|
||||||
_createdBy = new Exception("Created by");
|
// _createdBy = new Exception("Created by");
|
||||||
}
|
}
|
||||||
|
|
||||||
public I2PThread(String name) {
|
public I2PThread(String name) {
|
||||||
super(name);
|
super(name);
|
||||||
if ( (_log == null) || (_log.shouldLog(Log.DEBUG)) )
|
//if ( (_log == null) || (_log.shouldLog(Log.DEBUG)) )
|
||||||
_createdBy = new Exception("Created by");
|
// _createdBy = new Exception("Created by");
|
||||||
}
|
}
|
||||||
|
|
||||||
public I2PThread(Runnable r) {
|
public I2PThread(Runnable r) {
|
||||||
super(r);
|
super(r);
|
||||||
if ( (_log == null) || (_log.shouldLog(Log.DEBUG)) )
|
//if ( (_log == null) || (_log.shouldLog(Log.DEBUG)) )
|
||||||
_createdBy = new Exception("Created by");
|
// _createdBy = new Exception("Created by");
|
||||||
}
|
}
|
||||||
|
|
||||||
public I2PThread(Runnable r, String name) {
|
public I2PThread(Runnable r, String name) {
|
||||||
super(r, name);
|
super(r, name);
|
||||||
if ( (_log == null) || (_log.shouldLog(Log.DEBUG)) )
|
//if ( (_log == null) || (_log.shouldLog(Log.DEBUG)) )
|
||||||
_createdBy = new Exception("Created by");
|
// _createdBy = new Exception("Created by");
|
||||||
}
|
}
|
||||||
public I2PThread(Runnable r, String name, boolean isDaemon) {
|
public I2PThread(Runnable r, String name, boolean isDaemon) {
|
||||||
super(r, name);
|
super(r, name);
|
||||||
setDaemon(isDaemon);
|
setDaemon(isDaemon);
|
||||||
if ( (_log == null) || (_log.shouldLog(Log.DEBUG)) )
|
//if ( (_log == null) || (_log.shouldLog(Log.DEBUG)) )
|
||||||
_createdBy = new Exception("Created by");
|
// _createdBy = new Exception("Created by");
|
||||||
}
|
}
|
||||||
|
|
||||||
public I2PThread(ThreadGroup g, Runnable r) {
|
public I2PThread(ThreadGroup g, Runnable r) {
|
||||||
super(g, r);
|
super(g, r);
|
||||||
if ( (_log == null) || (_log.shouldLog(Log.DEBUG)) )
|
//if ( (_log == null) || (_log.shouldLog(Log.DEBUG)) )
|
||||||
_createdBy = new Exception("Created by");
|
// _createdBy = new Exception("Created by");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/****
|
||||||
private void log(int level, String msg) { log(level, msg, null); }
|
private void log(int level, String msg) { log(level, msg, null); }
|
||||||
|
|
||||||
private void log(int level, String msg, Throwable t) {
|
private void log(int level, String msg, Throwable t) {
|
||||||
@@ -73,20 +75,23 @@ public class I2PThread extends Thread {
|
|||||||
if (_log.shouldLog(level))
|
if (_log.shouldLog(level))
|
||||||
_log.log(level, msg, t);
|
_log.log(level, msg, t);
|
||||||
}
|
}
|
||||||
|
****/
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void run() {
|
public void run() {
|
||||||
_name = Thread.currentThread().getName();
|
//_name = Thread.currentThread().getName();
|
||||||
log(Log.INFO, "New thread started" + (isDaemon() ? " (daemon): " : ": ") + _name, _createdBy);
|
//log(Log.INFO, "New thread started" + (isDaemon() ? " (daemon): " : ": ") + _name, _createdBy);
|
||||||
try {
|
try {
|
||||||
super.run();
|
super.run();
|
||||||
} catch (Throwable t) {
|
} catch (Throwable t) {
|
||||||
|
/****
|
||||||
try {
|
try {
|
||||||
log(Log.CRIT, "Thread terminated unexpectedly: " + getName(), t);
|
log(Log.CRIT, "Thread terminated unexpectedly: " + getName(), t);
|
||||||
} catch (Throwable woof) {
|
} catch (Throwable woof) {
|
||||||
System.err.println("Died within the OOM itself");
|
System.err.println("Died within the OOM itself");
|
||||||
t.printStackTrace();
|
t.printStackTrace();
|
||||||
}
|
}
|
||||||
|
****/
|
||||||
if (t instanceof OutOfMemoryError)
|
if (t instanceof OutOfMemoryError)
|
||||||
fireOOM((OutOfMemoryError)t);
|
fireOOM((OutOfMemoryError)t);
|
||||||
}
|
}
|
||||||
@@ -122,6 +127,7 @@ public class I2PThread extends Thread {
|
|||||||
public void outOfMemory(OutOfMemoryError err);
|
public void outOfMemory(OutOfMemoryError err);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/****
|
||||||
public static void main(String args[]) {
|
public static void main(String args[]) {
|
||||||
I2PThread t = new I2PThread(new Runnable() {
|
I2PThread t = new I2PThread(new Runnable() {
|
||||||
public void run() {
|
public void run() {
|
||||||
@@ -134,4 +140,5 @@ public class I2PThread extends Thread {
|
|||||||
} catch (Throwable tt) { // nop
|
} catch (Throwable tt) { // nop
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
****/
|
||||||
}
|
}
|
||||||
|
@@ -2,6 +2,7 @@
|
|||||||
* EepGet:
|
* EepGet:
|
||||||
- Fix error output bug
|
- Fix error output bug
|
||||||
- Output error data for 504 too
|
- Output error data for 504 too
|
||||||
|
* I2PThread: Remove logging, too many issues with extra contexts
|
||||||
* Router, console, i2psnark: Change three errors to warns (tickets #479, #482, #487)
|
* Router, console, i2psnark: Change three errors to warns (tickets #479, #482, #487)
|
||||||
|
|
||||||
2011-06-30 zzz
|
2011-06-30 zzz
|
||||||
|
@@ -18,7 +18,7 @@ public class RouterVersion {
|
|||||||
/** deprecated */
|
/** deprecated */
|
||||||
public final static String ID = "Monotone";
|
public final static String ID = "Monotone";
|
||||||
public final static String VERSION = CoreVersion.VERSION;
|
public final static String VERSION = CoreVersion.VERSION;
|
||||||
public final static long BUILD = 2;
|
public final static long BUILD = 3;
|
||||||
|
|
||||||
/** for example "-test" */
|
/** for example "-test" */
|
||||||
public final static String EXTRA = "";
|
public final static String EXTRA = "";
|
||||||
|
Reference in New Issue
Block a user