符合中小企业对网站设计、功能常规化式的企业展示型网站建设
本套餐主要针对企业品牌型网站、中高端设计、前端互动体验...
商城网站建设因基本功能的需求不同费用上面也有很大的差别...
手机微信网站开发、微信官网、微信商城网站...
package com.jane;
import java.util.concurrent.CountDownLatch;
public class Task implements Runnable {
private CountDownLatch countDownLatch;
private String name;
public Task(CountDownLatch countDownLatch, String name) {
this.countDownLatch = countDownLatch;
this.name = name;
}
@Override
public void run() {
try {
System.out.println(name + "开始等待开关......");
countDownLatch.await();
} catch (InterruptedException e) {
e.printStackTrace();
}
System.out.println(name + "执行任务完成");
}
}
public class Main {
public static void main(String[] args) throws InterruptedException {
//主线程创建,和子线程共享
CountDownLatch countDownLatch = new CountDownLatch(1);
System.out.println("主线程启动......");
//创建3个子线程
Thread t1 = new Thread(new Task(countDownLatch, "线程-1"));
Thread t2 = new Thread(new Task(countDownLatch, "线程-2"));
Thread t3 = new Thread(new Task(countDownLatch, "线程-3"));
t1.start();
t2.start();
t3.start();
Thread.sleep(2000);
System.out.println("主线程执行任务完毕,放行......");
countDownLatch.countDown();
System.out.println("主线程执行完毕");
}
}
创新互联建站成都网站建设按需求定制制作,是成都网站建设公司,为人造雾提供网站建设服务,有成熟的网站定制合作流程,提供网站定制设计服务:原型图制作、网站创意设计、前端HTML5制作、后台程序开发等。成都网站建设热线:13518219792
package com.jane;
import java.util.concurrent.CountDownLatch;
public class Task1 implements Runnable {
private CountDownLatch countDownLatch;
private String name;
public Task1(CountDownLatch countDownLatch, String name) {
this.countDownLatch = countDownLatch;
this.name = name;
}
@Override
public void run() {
try {
System.out.println(name + "开始开始执行任务......");
Thread.sleep(2000);
System.out.println(name + "执行任务完成");
countDownLatch.countDown();
} catch (Exception e) {
e.printStackTrace();
}
}
}
package com.jane;
import java.util.concurrent.CountDownLatch;
public class Main1 {
public static void main(String[] args) throws InterruptedException {
//主线程创建,和子线程共享
CountDownLatch countDownLatch = new CountDownLatch(3);
System.out.println("主线程启动......");
//创建3个子线程
Thread t1 = new Thread(new Task1(countDownLatch, "线程-1"));
Thread t2 = new Thread(new Task1(countDownLatch, "线程-2"));
Thread t3 = new Thread(new Task1(countDownLatch, "线程-3"));
t1.start();
t2.start();
t3.start();
System.out.println("主线程等待子线程执行结果......");
countDownLatch.await();
System.out.println("主线程执行完毕");
}
}