Search in sources :

Example 16 with I2PThread

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();
}
Also used : I2PThread(net.i2p.util.I2PThread)

Example 17 with I2PThread

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));
}
Also used : I2PThread(net.i2p.util.I2PThread)

Example 18 with I2PThread

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;
}
Also used : I2PThread(net.i2p.util.I2PThread) I2PThread(net.i2p.util.I2PThread)

Example 19 with I2PThread

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();
}
Also used : I2PThread(net.i2p.util.I2PThread)

Example 20 with I2PThread

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();
}
Also used : I2PThread(net.i2p.util.I2PThread) I2PAppThread(net.i2p.util.I2PAppThread) I2PThread(net.i2p.util.I2PThread)

Aggregations

I2PThread (net.i2p.util.I2PThread)35 FileInputStream (java.io.FileInputStream)3 IOException (java.io.IOException)3 BufferedInputStream (java.io.BufferedInputStream)1 BufferedOutputStream (java.io.BufferedOutputStream)1 BufferedReader (java.io.BufferedReader)1 File (java.io.File)1 FileOutputStream (java.io.FileOutputStream)1 InputStreamReader (java.io.InputStreamReader)1 OutputStream (java.io.OutputStream)1 InvocationTargetException (java.lang.reflect.InvocationTargetException)1 Socket (java.net.Socket)1 SocketException (java.net.SocketException)1 HashMap (java.util.HashMap)1 Properties (java.util.Properties)1 Destination (net.i2p.data.Destination)1 I2CPMessageReader (net.i2p.data.i2cp.I2CPMessageReader)1 I2PAppThread (net.i2p.util.I2PAppThread)1 ForwardPort (org.freenetproject.ForwardPort)1 ForwardPortStatus (org.freenetproject.ForwardPortStatus)1