亚洲免费乱码视频,日韩 欧美 国产 动漫 一区,97在线观看免费视频播国产,中文字幕亚洲图片

      1. <legend id="ppnor"></legend>

      2. 
        
        <sup id="ppnor"><input id="ppnor"></input></sup>
        <s id="ppnor"></s>

        Java多線程遞歸如何彌補(bǔ)管理漏洞

        字號(hào):

        Java多線程遞歸在我們使用的時(shí)候需要我們不斷的進(jìn)行學(xué)習(xí),其實(shí)每個(gè)語言都可以在源代碼中找到問題的解決方案。當(dāng)每個(gè)迭代彼此獨(dú)立,并且完成Java多線程遞歸中每個(gè)迭代的工作,意義都足夠重大,足以彌補(bǔ)管理一個(gè)新任務(wù)的開銷時(shí),這個(gè)順序循環(huán)是適合并行化的。
            1.public voidParallelRecursive(final Executorexec,
            List>nodes,Collection results){
            2.for(Node n:nodes){
            3.exec.execute(new Runnable(){
            4.public void run(){
            5.results.add(n.compute());
            6.}
            7.});
            8.parallelRecursive(exec,n.getChildren(),results);
            9.}
            10.}
            11.publicCollectiongetParallelResults(List>nodes)
            12.throws InterruptedException{
            13.ExecutorService exec=Executors.newCachedThreadPool();
            14.Queue resultQueue=newConcurrentLinkedQueue();
            15.parallelRecursive(exec,nodes,resultQueue);
            16.exec.shutdown();
            17.exec.awaitTermination(Long.MAX_VALUE,TimeUnit.SECONDS);
            18.return reslutQueue;
            19.}