GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — executor/src/ThreadPoolTest.java at master · HaotingLiu/executor

Expand file tree

/

ThreadPoolTest.java

Copy path
More file actions
More file actions

Latest commit

 

History

History
History
44 lines (39 loc) · 937 Bytes
/

ThreadPoolTest.java

Copy path

File metadata and controls

44 lines (39 loc) · 937 Bytes
Raw
Copy raw file
Download raw file
Open symbols panel
Edit and raw actions
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
import java.util.concurrent.*;
/**
* Description:
* <br/>网站: <a href="http://www.crazyit.org">疯狂Java联盟</a>
* <br/>Copyright (C), 2001-2012, Yeeku.H.Lee
* <br/>This program is protected by copyright laws.
* <br/>Program Name:
* <br/>Date:
* @author Yeeku.H.Lee [email protected]
* @version 1.0
*/
// 实现Runnable接口来定义一个简单的线程类
class MyThread implements Runnable
{
public void run()
{
for (int i = 0; i < 100 ; i++ )
{
System.out.println(Thread.currentThread().getName()
+ "的i值为:" + i);
}
}
}
public class ThreadPoolTest
{
public static void main(String[] args)
throws Exception
{
// 创建一个具有固定线程数(6)的线程池
ExecutorService pool = Executors.newFixedThreadPool(6);
// 向线程池中提交两个线程
/* pool.submit(new MyThread());
pool.submit(new MyThread());*/
pool.execute(new MyThread());
pool.execute(new MyThread());
// 关闭线程池
pool.shutdown();
}
}
You are visitor 01402792 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.