标签:存在 rri 调用 场景 源码 lazy 超时 图片 imp
public class DataImportThread extends Thread{
private CyclicBarrier cyclicBarrier;
private String path;
public
DataImportThread(CyclicBarrier cyclicBarrier, String path) {
this.cyclicBarrier =
cyclicBarrier;
this.path = path;
}
@Override
public void run() {
System.out.println("开始导入:"+path+"位置的数据");
try {
cyclicBarrier.await();//阻塞
} catch
(InterruptedException e) {
e.printStackTrace();
} catch (BrokenBarrierException e) {
e.printStackTrace();
}
}
}
public static class CycliBarrierDemo extends Thread { @Override public void run() { System.out.println("开始进行数据分析"); } public static void main(String[] args) { CyclicBarrier cycliBarrier = new CyclicBarrier(3, new CycliBarrierDemo()); new Thread(new DataImportThread(cycliBarrier, "file 1")).start(); new Thread(new DataImportThread(cycliBarrier, "file 2")).start(); new Thread(new DataImportThread(cycliBarrier, "file 3")).start(); } }
标签:存在 rri 调用 场景 源码 lazy 超时 图片 imp
原文地址:https://www.cnblogs.com/47Gamer/p/13084141.html