Commit 319953253ee9a275b8d15dc7e66ace4fe8113858

Authored by liquanyu
1 parent 2b8efa7949

删除test类

Showing 2 changed files with 0 additions and 79 deletions

platform-operate-api/src/main/java/com/lyms/Test2.java View file @ 3199532
1   -package com.lyms;
2   -
3   -import java.util.HashMap;
4   -import java.util.Map;
5   -
6   -/**
7   - * @auther yangfei
8   - * @createTime 2018年07月25日 16时56分
9   - * @discription
10   - */
11   -public class Test2 {
12   -
13   -
14   - public static void main(String[] args) {
15   - Map<String, String> testLMap = testLMap();
16   - System.out.println("第二次:"+testLMap.toString());
17   - }
18   - private static Map<String,String> testLMap() {
19   - Map<String,String> dd=new HashMap<String, String>();
20   - try {
21   - dd.put("1", "1");
22   - return dd;
23   - } catch (Exception e) {
24   - // TODO: handle exception
25   - }finally{
26   - dd.put("4", "4");
27   - dd=null;
28   - System.out.println("第一次:"+dd);
29   - }
30   - return dd;
31   - }
32   -
33   -}
platform-operate-api/src/main/java/com/lyms/platform/operate/web/ThreadPoolTest.java View file @ 3199532
1   -package com.lyms.platform.operate.web;
2   -
3   -import java.util.concurrent.ExecutorService;
4   -import java.util.concurrent.Executors;
5   -import java.util.concurrent.TimeUnit;
6   -
7   -/**
8   - * @auther yangfei
9   - * @createTime 2017年10月25日 18时00分
10   - * @discription
11   - */
12   -public class ThreadPoolTest {
13   - public static void main(String[] args) {
14   - //固定线程数量的线程池
15   - ExecutorService threadPool = Executors.newFixedThreadPool(3); //线程池的大小依赖于操作系统(或者说JVM)
16   - // ExecutorService threadPool = Executors.newCachedThreadPool(); //单个线程的线程池:只有一个线程在工作,如果这个线程异常结束,则会立刻有一个新线程替代它
17   - // ExecutorService threadPool = Executors.newSingleThreadExecutor();
18   - for (int i = 1; i <= 10; i++) {
19   - final int task = i;
20   - threadPool.execute(new Runnable() {
21   - @Override
22   - public void run() {
23   - for (int j = 1; j <= 10; j++) {
24   - try {
25   - Thread.sleep(20);
26   - } catch (InterruptedException e) { // TODO Auto-generated catch block
27   -
28   - e.printStackTrace();
29   - }
30   - System.out.println(Thread.currentThread().getName() + " is looping of " + j + " for task of " + task);
31   - }
32   - }
33   - });
34   - }
35   - threadPool.shutdown();
36   - //结束线程池
37   - // 附带一个定时任务,O(∩_∩)O哈哈~
38   - Executors.newScheduledThreadPool(3).scheduleAtFixedRate(new Runnable() {
39   - @Override
40   - public void run() {
41   - System.out.println("bombing!");
42   - }
43   - }, 6, 2, TimeUnit.SECONDS);
44   -
45   - }
46   -}