最美情侣中文字幕电影,在线麻豆精品传媒,在线网站高清黄,久久黄色视频

歡迎光臨散文網(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的評論 (共 條)

分享到微博請遵守國家法律
灌南县| 革吉县| 随州市| 闵行区| 沈丘县| 安塞县| 岳阳市| 桦甸市| 鲁甸县| 武川县| 涿州市| 焦作市| 大邑县| 天全县| 墨竹工卡县| 彰化市| 沙洋县| 稻城县| 洛宁县| 利川市| 岱山县| 桂东县| 五寨县| 栾川县| 车险| 手游| 屏南县| 嵊泗县| 阿城市| 泸水县| 霍林郭勒市| 定襄县| 潞西市| 溆浦县| 乐平市| 武宁县| 贵溪市| 苗栗县| 沧州市| 花莲县| 泰安市|