Package com.flaptor.hounder.crawler.pagedb

Examples of com.flaptor.hounder.crawler.pagedb.PageDB.open()


            new DBCloser(0).start();
            new DBCloser(1).start();
            while (done < 2) Execute.sleep(100);

            PageDB db = new PageDB(dbNames[0]);
            db.open(DPageDB.READ);
            Iterator<Page> pages = db.iterator();
            assertTrue("The first distributed pagedb should have two pages, yet it has none.", pages.hasNext());
            Page page1 = pages.next();
            assertTrue("One of the pages in the first distributed pagedb is not expected: "+page1.getUrl(), page1.equals(page00) || page1.equals(page10));
            assertTrue("The first distributed pagedb should have two pages, yet it has one.", pages.hasNext());
View Full Code Here


            assertFalse("One of the pages in the first distributed pagedb has been cloned:"+page1.getUrl(), page1.equals(page2));
            assertFalse("The first distributed pagedb should have two pages, yet it has more.", pages.hasNext());
            db.close();

            db = new PageDB(dbNames[1]);
            db.open(DPageDB.READ);
            pages = db.iterator();
            assertTrue("The second distributed pagedb should have two pages, yet it has none.", pages.hasNext());
            page1 = pages.next();
            assertTrue("One of the pages in the second distributed pagedb is not expected: "+page1.getUrl(), page1.equals(page01) || page1.equals(page11));
            assertTrue("The second distributed pagedb should have two pages, yet it has one.", pages.hasNext());
View Full Code Here

    public void close () throws IOException {
        if ((mode & 0x0F) != READ) {
            logger.info("DPageDB ready for close. Will merge "+pageCatcher.catches()+" catched pages.");
            if (pageCatcher.catches() > 0) {
                PageDB db = pageCatcher.getCatch();
                db.open(READ);
                for (Page page : db) {
                    page.setLocal(true);
                    super.addPage (page);
                }
                Execute.close(db);
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.