亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频

? 歡迎來到蟲蟲下載站! | ?? 資源下載 ?? 資源專輯 ?? 關于我們
? 蟲蟲下載站

?? distributedwebdbwriter.java

?? 爬蟲數據的改進,并修正了一些bug
?? JAVA
?? 第 1 頁 / 共 5 頁
字號:

        /**
         */
        public boolean next(PageInstruction result) throws IOException {
            if (!haveCurrent) {
                return false;
            }
        
            currentUrl.set(current.getPage().getURL());
            result.set(current); // take the first instruction

            do {
                // skip the rest
            } while ((haveCurrent = edits.next(current, NullWritable.get())) &&
                     currentUrl.compareTo(current.getPage().getURL()) == 0);
            return true;
        }
    }


    /*************************************************
     * Holds an instruction over a Link.
     *************************************************/
    public static class LinkInstruction implements WritableComparable {
        Link link;
        int instruction;

        /**
         */
        public LinkInstruction() {
        }

        /**
         */
        public LinkInstruction(Link link, int instruction) {
            set(link, instruction);
        }

        /**
         * Re-init from another LinkInstruction's info.
         */
        public void set(LinkInstruction that) {
            this.instruction = that.instruction;
          
            if (this.link == null)
                this.link = new Link();

            this.link.set(that.link);
        }

        /**
         * Re-init with a Link and an instruction
         */
        public void set(Link link, int instruction) {
            this.link = link;
            this.instruction = instruction;
        }

        //
        // WritableComparable
        //
        public int compareTo(Object o) {
            return this.link.compareTo(((LinkInstruction) o).link);
        }
        public void write(DataOutput out) throws IOException {
            out.writeByte(instruction);
            link.write(out);
        }
        public void readFields(DataInput in) throws IOException {
            this.instruction = in.readByte();
            if (link == null)
                link = new Link();
            link.readFields(in);
        }
        public Link getLink() {
            return link;
        }
        public int getInstruction() {
            return instruction;
        }

        /*******************************************************
         * Sorts the instruction first by Md5, then by opcode.
         *******************************************************/
        public static class MD5Comparator extends WritableComparator {
            private static final Link.MD5Comparator MD5_COMPARATOR =
            new Link.MD5Comparator();

            public MD5Comparator() { super(LinkInstruction.class); }

            public int compare(WritableComparable a, WritableComparable b) {
                LinkInstruction instructionA = (LinkInstruction)a;
                LinkInstruction instructionB = (LinkInstruction)b;
                return instructionA.link.md5Compare(instructionB.link);
            }

            /** Optimized comparator. */
            public int compare(byte[] b1, int s1, int l1,
                               byte[] b2, int s2, int l2) {
                return MD5_COMPARATOR.compare(b1, s1+1, l1-1, b2, s2+1, l2-1);
            }
        }
 
        /*********************************************************
         * Sorts the instruction first by url, then by opcode.
         *********************************************************/
        public static class UrlComparator extends WritableComparator {
            private static final Link.UrlComparator URL_COMPARATOR =
            new Link.UrlComparator();

            public UrlComparator() { super(LinkInstruction.class); }

            public int compare(WritableComparable a, WritableComparable b) {
                LinkInstruction instructionA = (LinkInstruction)a;
                LinkInstruction instructionB = (LinkInstruction)b;
                return instructionA.link.urlCompare(instructionB.link);

            }

            /** 
             * Optimized comparator. 
             */
            public int compare(byte[] b1, int s1, int l1,
                               byte[] b2, int s2, int l2) {
                return URL_COMPARATOR.compare(b1, s1+1, l1-1, b2, s2+1, l2-1);
            }
        }
    }

    /*******************************************************
     * LinkInstructionWriter very efficiently writes a
     * LinkInstruction to an EditSectionGroupWriter.  Much better
     * than calling "writer.append(new LinkInstruction())"
     ********************************************************/
    public static class LinkInstructionWriter {
        LinkInstruction li = new LinkInstruction();

        /**
         */
        public LinkInstructionWriter() {
        }

        /**
         * Append the LinkInstruction info to the indicated SequenceFile
         * and keep the LI for later reuse.
         */
        public synchronized void appendInstructionInfo(EditSectionGroupWriter writer, Link link, int opcode, Writable val) throws IOException {
            li.set(link, opcode);
            writer.append(li, val);
        }
    }

    /********************************************************
     * This class deduplicates link operations.  We want to 
     * sort by MD5, then by URL.  But all operations
     * should be unique.
     *********************************************************/
    class DeduplicatingLinkSequenceReader {
        Link currentKey = new Link();
        LinkInstruction current = new LinkInstruction();
        SequenceFile.Reader edits;
        boolean haveCurrent;

        /**
         */
        public DeduplicatingLinkSequenceReader(SequenceFile.Reader edits) throws IOException {
            this.edits = edits;
            this.haveCurrent = edits.next(current, NullWritable.get());
        }


        /**
         * The incoming stream of edits is sorted first by MD5, then by URL.
         * MD5-only values always come before MD5+URL.
         */
        public boolean next(LinkInstruction key) throws IOException {
            if (! haveCurrent) {
                return false;
            }

            currentKey.set(current.getLink());
            
            do {
                key.set(current);
            } while ((haveCurrent = edits.next(current, NullWritable.get())) &&
                     currentKey.compareTo(current.getLink()) == 0);
            return true;
        }
    }


    /**************************************************
     * The CloseProcessor class is used when we close down
     * the webdb.  We give it the path, members, and class values
     * needed to apply changes to any of our 4 data tables.
     * 
     * This is an abstract class.  Each subclass must define
     * the exact merge procedure.  However, file-handling
     * and edit-processing is standardized as much as possible.
     *
     **************************************************/
    private abstract class CloseProcessor {
        String basename;
        String curDBPart;
        MapFile.Reader oldDb;
        EditSectionGroupWriter editWriter;
        SequenceFile.Sorter sorter;
        WritableComparator comparator;
        Class keyClass, valueClass;
        long itemsWritten = 0;

        /**
         * Store away these members for later use.
         */
        CloseProcessor(String basename, MapFile.Reader oldDb, EditSectionGroupWriter editWriter, SequenceFile.Sorter sorter, WritableComparator comparator, Class keyClass, Class valueClass, String curDBPart) {
            this.basename = basename;
            this.oldDb = oldDb;
            this.editWriter = editWriter;
            this.sorter = sorter;
            this.comparator = comparator;
            this.keyClass = keyClass;
            this.valueClass = valueClass;
            this.curDBPart = curDBPart;
        }

        /**
         * Perform the shutdown sequence for this Processor.
         * There is a lot of file-moving and edit-sorting that
         * is common across all the 4 tables.
         *
         * Returns how many items were written out by this close().
         */
        long closeDown(File workingDir, File outputDir) throws IOException {
            //
            // Done adding edits, so close edit-writer.
            //
            editWriter.close();

            //
            // Where the output is going
            //
            File sectionDir = new File(outputDir, "dbsection." + machineNum);
            File newDbFile = new File(sectionDir, basename);

            //
            // Grab all the edits that we need to process.  We build an EditSectionGroupReader
            // and aim it at the right location.  The ESR will wait until all its
            // component Sections are written and completed before returning from
            // any method (other than the constructor).  So we expect to possibly wait
            // inside the call to numEdits().
            //
            EditSectionGroupReader edits = new EditSectionGroupReader(nfs, basename, machineNum, totalMachines);
            int numEdits = edits.numEdits();

            // If there are edits, then process them.
            if (numEdits != 0) {
                File mergedEditsFile = new File(sectionDir, "mergedEdits");
                edits.mergeSectionComponents(mergedEditsFile);
                File sortedEditsFile = new File(mergedEditsFile.getPath() + ".sorted");

                // Sort the edits
                long startSort = System.currentTimeMillis();
                sorter.sort(mergedEditsFile.getPath(), sortedEditsFile.getPath());
                long endSort = System.currentTimeMillis();

                LOG.info("Processing " + basename + ": Sorted " + numEdits + " instructions in " + ((endSort - startSort) / 1000.0) + " seconds.");
                LOG.info("Processing " + basename + ": Sorted " + (numEdits / ((endSort - startSort) / 1000.0)) + " instructions/second");
            
                // Delete old file
                nfs.delete(mergedEditsFile);

                // Read the sorted edits.  That means read all
                // the edits from the local subsection of the
                // database.  We must merge every machine's
                // contribution to the edit-list first (which
                // also means waiting until each machine has
                // completed that step).

                // Read the sorted edits
                SequenceFile.Reader sortedEdits = new SequenceFile.Reader(nfs, sortedEditsFile.getPath());

                // Create a brand-new output db for the integrated data
                MapFile.Writer newDb = (comparator == null) ? new MapFile.Writer(nfs, newDbFile.getPath(), keyClass, valueClass) : new MapFile.Writer(nfs, newDbFile.getPath(), comparator, valueClass);

                // Iterate through the edits, and merge changes with existing
                // db into the brand-new file
                oldDb.reset();
            
                // Merge the edits.  We did it!
                long startMerge = System.currentTimeMillis();
                mergeEdits(oldDb, sortedEdits, newDb);
                long endMerge = System.currentTimeMillis();
                LOG.info("Processing " + basename + ": Merged to new DB containing " + itemsWritten + " records in " + ((endMerge - startMerge) / 1000.0) + " seconds");

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
色婷婷国产精品| 久久久777精品电影网影网| 亚洲男人天堂一区| 成人动漫一区二区| 欧美韩国一区二区| 国产成人在线观看| 国产香蕉久久精品综合网| 国内精品免费**视频| xnxx国产精品| 国产老肥熟一区二区三区| 久久精品人人做人人综合 | 国产a视频精品免费观看| 亚洲精品一区二区三区四区高清| 久久99精品视频| 精品国产91洋老外米糕| 国产原创一区二区| 久久久噜噜噜久噜久久综合| 国产成人免费av在线| 国产欧美一区二区三区在线看蜜臀 | 国产片一区二区| 粉嫩一区二区三区性色av| 国产精品伦一区二区三级视频| 成人理论电影网| 亚洲欧美国产高清| 欧美三电影在线| 琪琪一区二区三区| 久久先锋影音av鲁色资源网| 国产91精品在线观看| 中文字幕亚洲在| 欧美中文字幕久久| 日本怡春院一区二区| 久久在线免费观看| 成人h动漫精品| 亚洲激情网站免费观看| 欧美精品国产精品| 国产综合色产在线精品| 国产精品久久精品日日| 欧美性大战久久| 免费成人你懂的| 国产精品天干天干在观线 | 国产自产视频一区二区三区| 国产日韩影视精品| 色噜噜久久综合| 视频一区二区三区中文字幕| 亚洲精品一线二线三线无人区| 岛国精品在线播放| 亚洲已满18点击进入久久| 欧美一区二区日韩| 国产69精品一区二区亚洲孕妇| 一区二区三区**美女毛片| 欧美一级视频精品观看| 成人性色生活片| 亚洲国产日韩a在线播放| 精品国免费一区二区三区| www.99精品| 日韩电影在线观看网站| 国产精品麻豆久久久| 777欧美精品| 成人免费高清视频在线观看| 亚洲一二三四在线观看| 久久久美女艺术照精彩视频福利播放| 日本高清视频一区二区| 精品一区二区在线看| 自拍av一区二区三区| 日韩女优电影在线观看| 91老师片黄在线观看| 免费精品视频最新在线| 亚洲欧洲韩国日本视频| 777xxx欧美| caoporm超碰国产精品| 日本欧美大码aⅴ在线播放| 中文字幕在线观看一区| 91精品国产91久久综合桃花 | 色菇凉天天综合网| 激情深爱一区二区| 一区二区三区.www| 亚洲国产精品成人综合色在线婷婷| 欧美在线视频日韩| 成人h动漫精品一区二| 麻豆精品在线视频| 一二三四区精品视频| 国产日产欧美一区| 日韩丝袜情趣美女图片| 一本久久a久久免费精品不卡| 国产一区二区三区在线观看精品 | 色呦呦一区二区三区| 国产一区二区成人久久免费影院| 亚洲午夜激情av| 中文字幕国产一区二区| 日韩欧美在线123| 欧美三级电影网| 91小视频在线| 粉嫩久久99精品久久久久久夜| 免费xxxx性欧美18vr| 一区二区三区日韩精品视频| 国产清纯在线一区二区www| 91精品在线麻豆| 欧美最猛黑人xxxxx猛交| 丰满白嫩尤物一区二区| 国产在线播放一区三区四| 水野朝阳av一区二区三区| 一区二区在线看| 中文字幕精品一区二区三区精品| 精品久久久久久久久久久久久久久久久| 美腿丝袜亚洲色图| 五月天一区二区| 亚洲一区二区中文在线| 亚洲色图视频免费播放| 日本一区二区三区dvd视频在线| 欧洲一区在线观看| 久久免费电影网| 日韩伦理免费电影| 国产欧美日韩综合| 久久亚洲精品小早川怜子| 欧美一级视频精品观看| 4438成人网| 欧美精品第1页| 欧美精品亚洲二区| 欧美日韩在线观看一区二区 | 午夜精品一区二区三区电影天堂 | 欧美色精品天天在线观看视频| 99re在线精品| 成a人片国产精品| 丁香六月综合激情| 粉嫩aⅴ一区二区三区四区| 国产经典欧美精品| 国产一区二区按摩在线观看| 男人的j进女人的j一区| 全部av―极品视觉盛宴亚洲| 日韩精品1区2区3区| 日本网站在线观看一区二区三区| 日韩av电影天堂| 七七婷婷婷婷精品国产| 日本视频免费一区| 狂野欧美性猛交blacked| 欧美aaa在线| 极品美女销魂一区二区三区免费| 久久国产麻豆精品| 国产在线精品一区二区不卡了 | 成人永久看片免费视频天堂| 丁香五精品蜜臀久久久久99网站| 国产99一区视频免费| 成人中文字幕电影| 不卡电影免费在线播放一区| 91在线观看视频| 在线视频中文字幕一区二区| 欧美伦理电影网| 日韩一区二区三区四区| 精品久久99ma| 日本一区二区电影| 亚洲男同1069视频| 日韩精品一卡二卡三卡四卡无卡| 蜜臀精品一区二区三区在线观看 | 日韩亚洲欧美在线| 26uuu国产一区二区三区| 日本一区二区视频在线| 国产精品美女久久久久久久久久久| 亚洲欧洲韩国日本视频| 亚洲国产三级在线| 久久99精品国产| www.亚洲人| 欧美日韩国产高清一区| 亚洲精品一区二区三区蜜桃下载 | 亚洲综合视频在线观看| 亚洲乱码国产乱码精品精98午夜 | 国产91丝袜在线观看| 色综合久久综合| 7777精品伊人久久久大香线蕉完整版| 欧美tickle裸体挠脚心vk| 国产精品污污网站在线观看| 亚洲伦在线观看| 日本成人在线不卡视频| 国产激情视频一区二区三区欧美 | 亚洲欧美成人一区二区三区| 亚洲.国产.中文慕字在线| 精品亚洲欧美一区| 成人18视频日本| 欧美精品在线一区二区三区| 久久久亚洲高清| 一区二区免费看| 国产一区在线观看视频| 99re66热这里只有精品3直播| 欧美日韩一区小说| 久久综合九色综合欧美98| 亚洲人成精品久久久久久| 日韩国产精品大片| 成人av在线电影| 欧美精品一级二级| 国产精品三级视频| 日本不卡在线视频| 不卡视频免费播放| 777xxx欧美| 亚洲色图在线播放| 韩国三级中文字幕hd久久精品| 91久久精品一区二区三| 欧美成人一区二区三区片免费| 国产精品免费免费| 久久精品国产免费看久久精品| 国产欧美一区二区三区沐欲| 亚洲大片在线观看|