merge of '476489c04057318947e2947393aa6a10aa382af8'

and 'd38ab82268c3643119e5c226a3f97c23fb794e93'
This commit is contained in:
mkvore-commit
2009-05-12 22:32:49 +00:00
5 changed files with 24 additions and 37 deletions

View File

@ -46,7 +46,7 @@ public class DoCMDS implements Runnable {
// FIX ME // FIX ME
// I need a better way to do versioning, but this will do for now. // I need a better way to do versioning, but this will do for now.
public static final String BMAJ = "00", BMIN = "00", BREV = "05", BEXT = ""; public static final String BMAJ = "00", BMIN = "00", BREV = "06", BEXT = "";
public static final String BOBversion = BMAJ + "." + BMIN + "." + BREV + BEXT; public static final String BOBversion = BMAJ + "." + BMIN + "." + BREV + BEXT;
private Socket server; private Socket server;
private Properties props; private Properties props;

View File

@ -235,27 +235,13 @@ public class MUXlisten implements Runnable {
} }
} // die } // die
// I2PSession session = socketManager.getSession();
// if (session != null) {
// System.out.println("I2Plistener: destroySession");
// try {
// session.destroySession();
// } catch (I2PSessionException ex) {
// nop
// }
// }
// try {
// socketManager.destroySocketManager();
//} catch (Exception e) {
// nop
//}
} catch (Exception e) { } catch (Exception e) {
// System.out.println("MUXlisten: Caught an exception" + e); // System.out.println("MUXlisten: Caught an exception" + e);
break quit; break quit;
} }
} // quit } // quit
} finally { } finally {
// allow threads above this one to catch the stop signal. // Start cleanup. Allow threads above this one to catch the stop signal.
try { try {
Thread.sleep(250); Thread.sleep(250);
} catch (InterruptedException ex) { } catch (InterruptedException ex) {
@ -275,10 +261,6 @@ public class MUXlisten implements Runnable {
} catch (Exception e) { } catch (Exception e) {
} }
//try {
// Thread.sleep(1000 * 20); // how long?? is this even needed??
//} catch (InterruptedException ex) {
//}
if (SS != null) { if (SS != null) {
try { try {
@ -292,32 +274,34 @@ public class MUXlisten implements Runnable {
} catch (IOException e) { } catch (IOException e) {
} }
} }
try { try {
socketManager.destroySocketManager(); socketManager.destroySocketManager();
} catch (Exception e) { } catch (Exception e) {
// nop // nop
} }
// This is here to catch when something fucks up REALLY bad, like those annoying stuck threads! // Wait around till all threads are collected.
if (tg != null) { if (tg != null) {
String boner = tg.getName(); String boner = tg.getName();
_log.warn("BOB: MUXlisten: Starting thread collection for: " + boner);
// tg.interrupt(); // give my stuff a small smack again. // tg.interrupt(); // give my stuff a small smack again.
if (tg.activeCount() + tg.activeGroupCount() != 0) { if (tg.activeCount() + tg.activeGroupCount() != 0) {
int foo = tg.activeCount() + tg.activeGroupCount(); int foo = tg.activeCount() + tg.activeGroupCount();
int bar = foo;
// hopefully no longer needed! // hopefully no longer needed!
// int bar = foo;
// System.out.println("BOB: MUXlisten: Waiting on threads for " + boner); // System.out.println("BOB: MUXlisten: Waiting on threads for " + boner);
// System.out.println("\n\nBOB: MUXlisten: ThreadGroup dump BEGIN " + boner); // System.out.println("\nBOB: MUXlisten: ThreadGroup dump BEGIN " + boner);
// visit(tg, 0, boner); // visit(tg, 0, boner);
// System.out.println("BOB: MUXlisten: ThreadGroup dump END " + boner + "\n\n"); // System.out.println("BOB: MUXlisten: ThreadGroup dump END " + boner + "\n");
// Happily spin forever :-( // Happily spin forever :-(
while ((tg.activeCount() + tg.activeGroupCount() != 0)) { while (foo != 0) {
foo = tg.activeCount() + tg.activeGroupCount(); foo = tg.activeCount() + tg.activeGroupCount();
// if (foo != bar) { // if (foo != bar) {
// System.out.println("\n\nBOB: MUXlisten: ThreadGroup dump BEGIN " + boner); // System.out.println("\nBOB: MUXlisten: ThreadGroup dump BEGIN " + boner);
// visit(tg, 0, boner); // visit(tg, 0, boner);
// System.out.println("BOB: MUXlisten: ThreadGroup dump END " + boner + "\n\n"); // System.out.println("BOB: MUXlisten: ThreadGroup dump END " + boner + "\n");
// } // }
bar = foo; // bar = foo;
try { try {
Thread.sleep(100); //sleep for 100 ms (One tenth second) Thread.sleep(100); //sleep for 100 ms (One tenth second)
} catch (InterruptedException ex) { } catch (InterruptedException ex) {
@ -325,7 +309,7 @@ public class MUXlisten implements Runnable {
} }
} }
} }
System.out.println("BOB: MUXlisten: Threads went away. Success: " + boner); _log.warn("BOB: MUXlisten: Threads went away. Success: " + boner);
tg.destroy(); tg.destroy();
// Zap reference to the ThreadGroup so the JVM can GC it. // Zap reference to the ThreadGroup so the JVM can GC it.
tg = null; tg = null;
@ -334,7 +318,7 @@ public class MUXlisten implements Runnable {
} }
// Debugging... // Debugging... None of this is normally used.
/** /**
* Find the root thread group and print them all. * Find the root thread group and print them all.
* *

View File

@ -200,7 +200,7 @@ class I2PSessionMuxedImpl extends I2PSessionImpl2 implements I2PSession {
protected class MuxedAvailabilityNotifier extends AvailabilityNotifier { protected class MuxedAvailabilityNotifier extends AvailabilityNotifier {
private LinkedBlockingQueue<MsgData> _msgs; private LinkedBlockingQueue<MsgData> _msgs;
private volatile Boolean _alive = new Boolean(false); private volatile boolean _alive = false;
private static final int POISON_SIZE = -99999; private static final int POISON_SIZE = -99999;
private final AtomicBoolean stopping = new AtomicBoolean(false); private final AtomicBoolean stopping = new AtomicBoolean(false);
@ -212,9 +212,8 @@ class I2PSessionMuxedImpl extends I2PSessionImpl2 implements I2PSession {
public void stopNotifying() { public void stopNotifying() {
boolean again = true; boolean again = true;
synchronized (stopping) { synchronized (stopping) {
if(!stopping.get()) { if( !stopping.getAndSet(true)) {
stopping.set(true); if (_alive == true) {
if (_alive.equals(true)) {
// System.out.println("I2PSessionMuxedImpl.stopNotifying()"); // System.out.println("I2PSessionMuxedImpl.stopNotifying()");
_msgs.clear(); _msgs.clear();
while(again) { while(again) {
@ -230,7 +229,7 @@ class I2PSessionMuxedImpl extends I2PSessionImpl2 implements I2PSession {
_alive = false; _alive = false;
stopping.set(false); stopping.set(false);
} }
stopping.notifyAll(); // stopping.notifyAll();
} }
} }
/** unused */ /** unused */
@ -251,7 +250,7 @@ class I2PSessionMuxedImpl extends I2PSessionImpl2 implements I2PSession {
try { try {
msg = _msgs.take(); msg = _msgs.take();
} catch (InterruptedException ie) { } catch (InterruptedException ie) {
_log.debug("I2PSessionMuxedImpl.run() InterruptedException " + String.valueOf(_msgs.size()) + " Messages, Alive " + _alive.toString()); _log.debug("I2PSessionMuxedImpl.run() InterruptedException " + String.valueOf(_msgs.size()) + " Messages, Alive " + _alive);
continue; continue;
} }
if (msg.size == POISON_SIZE) { if (msg.size == POISON_SIZE) {

View File

@ -1,3 +1,7 @@
2009-05-12 sponge
* BOB clean up, change println's to _log.warn, bump BOB version
* I2PSessionMuxedImpl.java changes as per zzz, and they test OK for me.
2009-05-12 mkvore 2009-05-12 mkvore
* SAM: fix: warnings when generating javadoc * SAM: fix: warnings when generating javadoc

View File

@ -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 = 13; public final static long BUILD = 14;
/** for example "-test" */ /** for example "-test" */
public final static String EXTRA = ""; public final static String EXTRA = "";
public final static String FULL_VERSION = VERSION + "-" + BUILD + EXTRA; public final static String FULL_VERSION = VERSION + "-" + BUILD + EXTRA;