Skip to content

Commit b4868df

Browse files
committed
线程池
1 parent d77d6fa commit b4868df

File tree

2 files changed

+10
-5
lines changed

2 files changed

+10
-5
lines changed

src/main/java/com/huiwan/gdata/AdminMain.java

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,10 @@
33
import java.io.File;
44
import java.util.ArrayList;
55
import java.util.List;
6+
import java.util.concurrent.Executors;
67

78
import org.eclipse.jetty.server.Server;
9+
import org.eclipse.jetty.util.thread.ExecutorThreadPool;
810
import org.eclipse.jetty.webapp.WebAppContext;
911
import org.slf4j.Logger;
1012
import org.slf4j.LoggerFactory;
@@ -23,6 +25,9 @@ public static void main(String[] args) {
2325
ignored.printStackTrace();
2426
}
2527
Server server = new Server(port);
28+
server.setThreadPool(new ExecutorThreadPool(Executors.newFixedThreadPool(200)));
29+
server.setThreadPool(new ExecutorThreadPool());
30+
2631
// 关联一个已经存在的上下文 src/main/webapp
2732
//WebAppContext webAppContext = new WebAppContext("webapp", "/main");
2833
WebAppContext webAppContext = new WebAppContext(getWebAppPath(), "/zdata");

src/main/java/com/huiwan/gdata/SimpleMain.java

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -15,12 +15,12 @@ public static void main(String[] args) throws Exception {
1515
// 设置线程
1616
server.setThreadPool(new ExecutorThreadPool());
1717
// 端口
18-
connector.setPort(9808);
18+
connector.setPort(9899);
1919
// 设置handler
20-
//项目目录名/src/main/webapp
21-
//lib/webapp
22-
//demo
23-
Handler handler=new WebAppContext("src/main/webapp", "/");
20+
// 项目目录名/src/main/webapp
21+
// lib/webapp
22+
// demo
23+
// Handler handler=new WebAppContext("src/main/webapp", "/");
2424

2525
server.setHandler(new WebAppContext("src/main/webapp", "/"));
2626
// 连接器

0 commit comments

Comments
 (0)