diff --git a/apps/routerconsole/java/src/net/i2p/router/web/RouterConsoleRunner.java b/apps/routerconsole/java/src/net/i2p/router/web/RouterConsoleRunner.java index c40abefba8..1ccbc42cae 100644 --- a/apps/routerconsole/java/src/net/i2p/router/web/RouterConsoleRunner.java +++ b/apps/routerconsole/java/src/net/i2p/router/web/RouterConsoleRunner.java @@ -9,7 +9,11 @@ import java.security.KeyStore; import java.util.List; import java.util.Properties; import java.util.StringTokenizer; +import java.util.concurrent.Executors; +import java.util.concurrent.SynchronousQueue; import java.util.concurrent.TimeUnit; +import java.util.concurrent.ThreadFactory; +import java.util.concurrent.ThreadPoolExecutor; import net.i2p.I2PAppContext; import net.i2p.apps.systray.SysTray; @@ -77,6 +81,7 @@ public class RouterConsoleRunner { private static final int MIN_THREADS = 1; private static final int MAX_THREADS = 24; private static final int MAX_IDLE_TIME = 90*1000; + private static final String THREAD_NAME = "RouterConsole Jetty"; static { System.setProperty("org.mortbay.http.Version.paranoid", "true"); @@ -217,10 +222,12 @@ public class RouterConsoleRunner { // so Jetty can find WebAppConfiguration System.setProperty("jetty.class.path", I2PAppContext.getGlobalContext().getBaseDir() + "/lib/routerconsole.jar"); _server = new Server(); + _server.setGracefulShutdown(1000); - /**** this doesn't work with NIO maybe? try { - _server.setThreadPool(new ThreadPool(MIN_THREADS, MAX_THREADS, MAX_IDLE_TIME, TimeUnit.MILLISECONDS)); + ThreadPool ctp = new CustomThreadPoolExecutor(); + ctp.prestartAllCoreThreads(); + _server.setThreadPool(ctp); } catch (Throwable t) { // class not found... System.out.println("INFO: Jetty concurrent ThreadPool unavailable, using QueuedThreadPool"); @@ -229,7 +236,7 @@ public class RouterConsoleRunner { qtp.setMaxIdleTimeMs(MAX_IDLE_TIME); _server.setThreadPool(qtp); } - ****/ + HandlerCollection hColl = new HandlerCollection(); ContextHandlerCollection chColl = new ContextHandlerCollection(); _server.addHandler(hColl); @@ -673,4 +680,31 @@ public class RouterConsoleRunner { } } + + /** + * Just to set the name and set Daemon + * @since Jetty 6 + */ + private static class CustomThreadPoolExecutor extends ThreadPool { + public CustomThreadPoolExecutor() { + super(MIN_THREADS, MAX_THREADS, MAX_IDLE_TIME, TimeUnit.MILLISECONDS, + new SynchronousQueue(), new CustomThreadFactory(), + new ThreadPoolExecutor.CallerRunsPolicy()); + } + } + + /** + * Just to set the name and set Daemon + * @since Jetty 6 + */ + private static class CustomThreadFactory implements ThreadFactory { + + public Thread newThread(Runnable r) { + Thread rv = Executors.defaultThreadFactory().newThread(r); + rv.setName(THREAD_NAME); + rv.setDaemon(true); + return rv; + } + } + } diff --git a/build.xml b/build.xml index 531de9aac0..76ecc658ad 100644 --- a/build.xml +++ b/build.xml @@ -938,7 +938,7 @@ - + diff --git a/installer/resources/eepsite/jetty-ssl.xml b/installer/resources/eepsite/jetty-ssl.xml new file mode 100644 index 0000000000..49421d69c3 --- /dev/null +++ b/installer/resources/eepsite/jetty-ssl.xml @@ -0,0 +1,35 @@ + + + + + + + + + + + + + + + + + 8443 + 30000 + 2000 + ./eepsite/etc/keystore.ks + OBF:1vny1zlo1x8e1vnw1vn61x8g1zlu1vn4 + OBF:1u2u1wml1z7s1z7a1wnl1u2g + ./eepsite/etc/keystore.ks + OBF:1vny1zlo1x8e1vnw1vn61x8g1zlu1vn4 + 2000 + + + + + diff --git a/installer/resources/eepsite/jetty.xml b/installer/resources/eepsite/jetty.xml index b827c9e82c..0cf46bd700 100644 --- a/installer/resources/eepsite/jetty.xml +++ b/installer/resources/eepsite/jetty.xml @@ -54,20 +54,32 @@ - + + + + --> + 0 1 16 - --> @@ -87,7 +99,7 @@ 127.0.0.1 7658 60000 - 2 + 1 false 8443 5000 @@ -96,22 +108,12 @@ - - - + + + @@ -120,21 +122,13 @@ - - - - - - - - diff --git a/router/java/src/net/i2p/router/startup/WorkingDir.java b/router/java/src/net/i2p/router/startup/WorkingDir.java index a249038833..888262302e 100644 --- a/router/java/src/net/i2p/router/startup/WorkingDir.java +++ b/router/java/src/net/i2p/router/startup/WorkingDir.java @@ -151,6 +151,7 @@ public class WorkingDir { File newEep = new File(oldDirf, "eepsite"); String newPath = newEep.getAbsolutePath() + File.separatorChar; success &= migrateJettyXml(oldEep, newEep, "jetty.xml", "./eepsite/", newPath); + success &= migrateJettyXml(oldEep, newEep, "jetty-ssl.xml", "./eepsite/", newPath); success &= migrateJettyXml(oldEep, newEep, "contexts/base-context.xml", "./eepsite/", newPath); success &= migrateJettyXml(oldEep, newEep, "contexts/cgi-context.xml", "./eepsite/", newPath); success &= migrateClientsConfig(oldDirf, dirf);