无码av一区二区三区无码,在线观看老湿视频福利,日韩经典三级片,成 人色 网 站 欧美大片在线观看

歡迎光臨散文網(wǎng) 會員登陸 & 注冊

PCI和PCle子系統(tǒng)\/--》ccys1473

2023-07-10 12:27 作者:拆字成詩  | 我要投稿

**

?* 實現(xiàn)Callable接口

?*/

public class Demo6_CreateCallable implements Callable<Boolean> {


? ? private String url;//網(wǎng)絡(luò)圖片地址

? ? private String name;//報錯扥文件名


? ? //有參構(gòu)造

? ? public Demo6_CreateCallable(String url, String name) {

? ? ? ? this.url = url;

? ? ? ? this.name = name;

? ? }


? ? //下載圖片線程的執(zhí)行體

? ? public Boolean call() throws Exception {

? ? ? ? WebDownloader webDownloader = new WebDownloader();

? ? ? ? webDownloader.downloader(url, name);

? ? ? ? System.out.println("下載了文件名為:" + name);

? ? ? ? return true;

? ? }


? ? public static void main(String[] args) throws ExecutionException, InterruptedException {

? ? ? ? Demo6_CreateCallable c = new Demo6_CreateCallable("https://img-home.csdnimg.cn/images/20201124032511.png", "1.png");

? ? ? ? Demo6_CreateCallable c1 = new Demo6_CreateCallable("https://img-home.csdnimg.cn/images/20201124032511.png", "2.png");

? ? ? ? Demo6_CreateCallable c2 = new Demo6_CreateCallable("https://img-home.csdnimg.cn/images/20201124032511.png", "3.png");

? ? ? ? //創(chuàng)建執(zhí)行服務(wù)

? ? ? ? ExecutorService ser = Executors.newFixedThreadPool(3);

? ? ? ? //提交執(zhí)行

? ? ? ? Future<Boolean> r = ser.submit(c);

? ? ? ? Future<Boolean> r1 = ser.submit(c1);

? ? ? ? Future<Boolean> r2 = ser.submit(c2);

? ? ? ? //獲取結(jié)果

? ? ? ? boolean res = r.get();

? ? ? ? boolean res1 = r1.get();

? ? ? ? boolean res2 = r2.get();

? ? ? ? //關(guān)閉服務(wù)

? ? ? ? ser.shutdownNow();

? ? }

}



PCI和PCle子系統(tǒng)\/--》ccys1473的評論 (共 條)

分享到微博請遵守國家法律
青河县| 万安县| 南靖县| 清涧县| 韶山市| 岑溪市| 泗洪县| 五家渠市| 双流县| 临泉县| 新河县| 镇宁| 阳西县| 林口县| 碌曲县| 雷州市| 巨鹿县| 桦南县| 米易县| 南皮县| 宜都市| 澎湖县| 瑞金市| 榆林市| 建始县| 静乐县| 泽州县| 垫江县| 吴旗县| 启东市| 嘉鱼县| 宁陵县| 西盟| 宁夏| 师宗县| 梁平县| 孟州市| 长沙市| 吉林省| 绥芬河市| 邓州市|