name all threads, and (nearly) always use I2PThread (in case we add some pooling/throttling/monitoring or whatnot later)

This commit is contained in:
jrandom
2004-04-09 01:22:04 +00:00
committed by zzz
parent 6b1d671aed
commit f37c0ed612
9 changed files with 20 additions and 11 deletions

View File

@ -21,6 +21,7 @@ import net.i2p.client.streaming.I2PSocketOptions;
import net.i2p.data.Destination;
import net.i2p.util.EventDispatcher;
import net.i2p.util.Log;
import net.i2p.util.I2PThread;
public abstract class I2PTunnelClientBase extends I2PTunnelTask
implements Runnable {
@ -73,7 +74,7 @@ public abstract class I2PTunnelClientBase extends I2PTunnelTask
if (sockMgr == null) throw new NullPointerException();
l.log("I2P session created");
Thread t = new Thread(this);
Thread t = new I2PThread(this);
t.setName("Client");
listenerReady=false;
t.start();
@ -270,7 +271,7 @@ public abstract class I2PTunnelClientBase extends I2PTunnelTask
}
}
public class ClientConnectionRunner extends Thread {
public class ClientConnectionRunner extends I2PThread {
private Socket s;
public ClientConnectionRunner(Socket s, String name) {

View File

@ -208,6 +208,7 @@ public class I2PTunnelHTTPClient extends I2PTunnelClientBase
_targetRequest = targetRequest;
_useWWWProxy = useWWWProxy;
_disabled = false;
setName("InactivityThread");
}
public void disable() {
_disabled = true;

View File

@ -15,8 +15,9 @@ import net.i2p.client.I2PSession;
import net.i2p.client.streaming.I2PSocket;
import net.i2p.util.Log;
import net.i2p.util.Clock;
import net.i2p.util.I2PThread;
public class I2PTunnelRunner extends Thread {
public class I2PTunnelRunner extends I2PThread {
private final static Log _log = new Log(I2PTunnelRunner.class);
/**
@ -121,7 +122,7 @@ public class I2PTunnelRunner extends Thread {
}
}
private class StreamForwarder extends Thread {
private class StreamForwarder extends I2PThread {
InputStream in;
OutputStream out;

View File

@ -23,6 +23,7 @@ import net.i2p.client.streaming.I2PSocketManagerFactory;
import net.i2p.data.Base64;
import net.i2p.util.EventDispatcher;
import net.i2p.util.Log;
import net.i2p.util.I2PThread;
public class I2PTunnelServer extends I2PTunnelTask
implements Runnable {
@ -82,7 +83,7 @@ public class I2PTunnelServer extends I2PTunnelTask
l.log("Ready!");
notifyEvent("openServerResult", "ok");
open=true;
Thread t = new Thread(this);
Thread t = new I2PThread(this);
t.setName("Server");
t.start();
}

View File

@ -15,6 +15,7 @@ import net.i2p.client.streaming.I2PSocketManager;
import net.i2p.data.Destination;
import net.i2p.util.EventDispatcher;
import net.i2p.util.Log;
import net.i2p.util.I2PThread;
public class I2Ping extends I2PTunnelTask implements Runnable {
private final static Log _log = new Log(I2Ping.class);
@ -58,7 +59,7 @@ public class I2Ping extends I2PTunnelTask implements Runnable {
sockMgr = I2PTunnelClient.getSocketManager();
}
}
Thread t = new Thread(this);
Thread t = new I2PThread(this);
t.setName("Client");
t.start();
open=true;
@ -180,7 +181,7 @@ public class I2Ping extends I2PTunnelTask implements Runnable {
public class PingHandler extends Thread {
public class PingHandler extends I2PThread {
private String destination;
public PingHandler(String dest) {

View File

@ -192,7 +192,7 @@ public class TunnelManager implements Runnable {
}
TunnelManager mgr = new TunnelManager(host, port);
Thread t = new Thread(mgr, "Listener");
Thread t = new I2PThread(mgr, "Listener");
t.start();
}

View File

@ -9,6 +9,7 @@ import net.i2p.I2PException;
import net.i2p.client.I2PSessionException;
import net.i2p.data.Destination;
import net.i2p.util.Log;
import net.i2p.util.I2PThread;
/**
* Initial stub implementation for the socket
@ -227,13 +228,14 @@ class I2PSocketImpl implements I2PSocket {
}
}
public class I2PSocketRunner extends Thread {
public class I2PSocketRunner extends I2PThread {
public InputStream in;
public I2PSocketRunner(InputStream in) {
_log.debug("Runner's input stream is: "+in.hashCode());
this.in=in;
setName("SocketRunner from " + I2PSocketImpl.this.remote.calculateHash().toBase64().substring(0, 4));
start();
}

View File

@ -14,6 +14,7 @@ import net.i2p.util.RandomSource;
import net.i2p.util.Log;
import net.i2p.util.NativeBigInteger;
import net.i2p.util.Clock;
import net.i2p.util.I2PThread;
import java.math.BigInteger;
import java.util.ArrayList;
@ -84,7 +85,7 @@ public class DHSessionKeyBuilder {
if (_log.shouldLog(Log.DEBUG)) _log.debug("DH Precalc (minimum: " + MIN_NUM_BUILDERS + " max: " + MAX_NUM_BUILDERS + ", delay: " + CALC_DELAY + ")");
_precalcThread = new Thread(new DHSessionKeyBuilderPrecalcRunner(MIN_NUM_BUILDERS, MAX_NUM_BUILDERS));
_precalcThread = new I2PThread(new DHSessionKeyBuilderPrecalcRunner(MIN_NUM_BUILDERS, MAX_NUM_BUILDERS));
_precalcThread.setName("DH Precalc");
_precalcThread.setDaemon(true);
_precalcThread.setPriority(Thread.MIN_PRIORITY);

View File

@ -14,6 +14,7 @@ import java.util.List;
import net.i2p.util.Clock;
import net.i2p.util.Log;
import net.i2p.util.I2PThread;
import net.i2p.util.NativeBigInteger;
import net.i2p.util.RandomSource;
@ -78,7 +79,7 @@ class YKGenerator {
if (_log.shouldLog(Log.DEBUG)) _log.debug("ElGamal YK Precalc (minimum: " + MIN_NUM_BUILDERS + " max: " + MAX_NUM_BUILDERS + ", delay: " + CALC_DELAY + ")");
_precalcThread = new Thread(new YKPrecalcRunner(MIN_NUM_BUILDERS, MAX_NUM_BUILDERS));
_precalcThread = new I2PThread(new YKPrecalcRunner(MIN_NUM_BUILDERS, MAX_NUM_BUILDERS));
_precalcThread.setName("YK Precalc");
_precalcThread.setDaemon(true);
_precalcThread.setPriority(Thread.MIN_PRIORITY);