摘要:
package com.wangwenjun.concurrency.chapter5; public class ThreadJoin3 { public static void main(String[] args) throws InterruptedException { long startTimestamp = System.currentTimeMil... 阅读全文
posted @ 2019-04-03 22:30
三号小玩家
阅读(172)
评论(0)
推荐(0)
摘要:
package chapter2; public class Demo02 { public static void main(String[] args) { Thread th1=new Thread(){ @Override public void run() { //主线程 Thread th2=new Thread(){ ... 阅读全文
posted @ 2019-04-03 21:35
三号小玩家
阅读(99)
评论(0)
推荐(0)
摘要:
Thread thread = new Thread(); // init(null, null, "Thread-" + nextThreadNum(), 0); //init(线程组,策略名称,线程名称,栈大小); thread.start(); System.out.println(); } ... 阅读全文
posted @ 2019-04-03 17:09
三号小玩家
阅读(149)
评论(0)
推荐(0)
摘要:
策略模式的使用: 一个计算税率的例子: 调用: 阅读全文
posted @ 2019-04-03 15:51
三号小玩家
阅读(242)
评论(0)
推荐(0)
摘要:
package chapter2; public class TicketWindowRun implements Runnable { private static final int MAX =500; private static int index=1; @Override public void run() { //出票 ... 阅读全文
posted @ 2019-04-03 13:10
三号小玩家
阅读(179)
评论(0)
推荐(0)
摘要:
package chapter2; /** * 1.使用static虽然完成了当前的功能。 * 但是static的生命周期比较长,需要在所有线程执行完成后才会结束。 * 还有号没有按照顺序进行打印 */ public class TicketWindow extends Thread { private static final int MAX =50; pr... 阅读全文
posted @ 2019-04-03 12:31
三号小玩家
阅读(209)
评论(0)
推荐(0)
摘要:
模板方法模式案例: 阅读全文
posted @ 2019-04-03 11:30
三号小玩家
阅读(10421)
评论(0)
推荐(2)