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
// 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;
private Socket server;
private Properties props;

View File

@ -235,27 +235,13 @@ public class MUXlisten implements Runnable {
}
} // 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) {
// System.out.println("MUXlisten: Caught an exception" + e);
break quit;
}
} // quit
} finally {
// allow threads above this one to catch the stop signal.
// Start cleanup. Allow threads above this one to catch the stop signal.
try {
Thread.sleep(250);
} catch (InterruptedException ex) {
@ -275,10 +261,6 @@ public class MUXlisten implements Runnable {
} catch (Exception e) {
}
//try {
// Thread.sleep(1000 * 20); // how long?? is this even needed??
//} catch (InterruptedException ex) {
//}
if (SS != null) {
try {
@ -292,32 +274,34 @@ public class MUXlisten implements Runnable {
} catch (IOException e) {
}
}
try {
socketManager.destroySocketManager();
} catch (Exception e) {
// 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) {
String boner = tg.getName();
_log.warn("BOB: MUXlisten: Starting thread collection for: " + boner);
// tg.interrupt(); // give my stuff a small smack again.
if (tg.activeCount() + tg.activeGroupCount() != 0) {
int foo = tg.activeCount() + tg.activeGroupCount();
int bar = foo;
// hopefully no longer needed!
// int bar = foo;
// 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);
// System.out.println("BOB: MUXlisten: ThreadGroup dump END " + boner + "\n\n");
// System.out.println("BOB: MUXlisten: ThreadGroup dump END " + boner + "\n");
// Happily spin forever :-(
while ((tg.activeCount() + tg.activeGroupCount() != 0)) {
while (foo != 0) {
foo = tg.activeCount() + tg.activeGroupCount();
// 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);
// 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 {
Thread.sleep(100); //sleep for 100 ms (One tenth second)
} 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();
// Zap reference to the ThreadGroup so the JVM can GC it.
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.
*

View File

@ -200,7 +200,7 @@ class I2PSessionMuxedImpl extends I2PSessionImpl2 implements I2PSession {
protected class MuxedAvailabilityNotifier extends AvailabilityNotifier {
private LinkedBlockingQueue<MsgData> _msgs;
private volatile Boolean _alive = new Boolean(false);
private volatile boolean _alive = false;
private static final int POISON_SIZE = -99999;
private final AtomicBoolean stopping = new AtomicBoolean(false);
@ -212,9 +212,8 @@ class I2PSessionMuxedImpl extends I2PSessionImpl2 implements I2PSession {
public void stopNotifying() {
boolean again = true;
synchronized (stopping) {
if(!stopping.get()) {
stopping.set(true);
if (_alive.equals(true)) {
if( !stopping.getAndSet(true)) {
if (_alive == true) {
// System.out.println("I2PSessionMuxedImpl.stopNotifying()");
_msgs.clear();
while(again) {
@ -230,7 +229,7 @@ class I2PSessionMuxedImpl extends I2PSessionImpl2 implements I2PSession {
_alive = false;
stopping.set(false);
}
stopping.notifyAll();
// stopping.notifyAll();
}
}
/** unused */
@ -251,7 +250,7 @@ class I2PSessionMuxedImpl extends I2PSessionImpl2 implements I2PSession {
try {
msg = _msgs.take();
} 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;
}
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
* SAM: fix: warnings when generating javadoc

View File

@ -18,7 +18,7 @@ public class RouterVersion {
/** deprecated */
public final static String ID = "Monotone";
public final static String VERSION = CoreVersion.VERSION;
public final static long BUILD = 13;
public final static long BUILD = 14;
/** for example "-test" */
public final static String EXTRA = "";
public final static String FULL_VERSION = VERSION + "-" + BUILD + EXTRA;