use of net.i2p.util.I2PThread in project i2p.i2p by i2p.
the class LoadClientAppsJob method runClient.
/**
* Run client in a new thread.
*
* @param clientName can be null
* @param args can be null
* @param threadGroup can be null
* @param cl can be null
* @since 0.7.13
*/
public static void runClient(String className, String clientName, String[] args, RouterContext ctx, Log log, ThreadGroup threadGroup, ClassLoader cl) {
if (log.shouldLog(Log.INFO))
log.info("Loading up the client application " + clientName + ": " + className + " " + Arrays.toString(args));
I2PThread t;
if (threadGroup != null)
t = new I2PThread(threadGroup, new RunApp(className, clientName, args, ctx, log, cl));
else
t = new I2PThread(new RunApp(className, clientName, args, ctx, log, cl));
if (clientName == null)
clientName = className + " client";
t.setName(clientName);
t.setDaemon(true);
if (cl != null)
t.setContextClassLoader(cl);
t.start();
}
use of net.i2p.util.I2PThread in project i2p.i2p by i2p.
the class TunnelPoolManager method startup.
public synchronized void startup() {
_isShutdown = false;
if (!_executor.isRunning()) {
I2PThread t = new I2PThread(_executor, "BuildExecutor", true);
t.start();
_handler.init();
for (int i = 1; i <= _numHandlerThreads; i++) {
I2PThread hThread = new I2PThread(_handler, "BuildHandler " + i + '/' + _numHandlerThreads, true);
hThread.start();
}
}
_inboundExploratory.startup();
_context.simpleTimer2().addEvent(new DelayedStartup(_outboundExploratory), 3 * 1000);
// try to build up longer tunnels
_context.jobQueue().addJob(new BootstrapPool(_context, _inboundExploratory));
_context.jobQueue().addJob(new BootstrapPool(_context, _outboundExploratory));
}
use of net.i2p.util.I2PThread in project i2p.i2p by i2p.
the class LocalClientManager method startListeners.
@Override
protected void startListeners() {
ClientListenerRunner listener = new LocalClientListenerRunner(_ctx, this, _port);
Thread t = new I2PThread(listener, "ClientListener:" + _port, true);
t.start();
_listeners.add(listener);
_isStarted = true;
}
use of net.i2p.util.I2PThread in project i2p.i2p by i2p.
the class UDPFlooder method startup.
public void startup() {
_alive = true;
I2PThread t = new I2PThread(this, "flooder");
t.setDaemon(true);
t.start();
}
use of net.i2p.util.I2PThread in project i2p.i2p by i2p.
the class Router method restart.
/**
* A "soft" restart, primarily of the comm system, after
* a port change or large step-change in system time.
* Does not stop the whole JVM, so it is safe even in the absence
* of the wrapper.
* This is not a graceful restart - all peer connections are dropped immediately.
*
* As of 0.8.8, this returns immediately and does the actual restart in a separate thread.
* Poll isAlive() if you need to know when the restart is complete.
*
* Not recommended for external use.
*/
public synchronized void restart() {
synchronized (_stateLock) {
if (gracefulShutdownInProgress() || !isAlive())
return;
changeState(State.RESTARTING);
}
((RouterClock) _context.clock()).removeShiftListener(this);
// Let's not stop accepting tunnels, etc
// _started = _context.clock().now();
Thread t = new I2PThread(new Restarter(_context), "Router Restart");
t.setPriority(Thread.NORM_PRIORITY + 1);
t.start();
}
Aggregations