Examples of BookKeeper


Examples of org.apache.bookkeeper.client.BookKeeper

       
        /*
         * Create new ledger for adding records
         */
        try{
            bk = new BookKeeper(new ClientConfiguration(), zk);
        } catch (Exception e) {
            LOG.error("Exception while initializing bookkeeper", e);
            throw new LoggerException.BKOpFailedException()
        }
       
View Full Code Here

Examples of org.apache.bookkeeper.client.BookKeeper

        }
       
        LOG.info("Creating bookkeeper client");
       
        try{
            bk = new BookKeeper(new ClientConfiguration(), this.zk);   
        } catch (Exception e) {
            LOG.error("Error while creating bookkeeper object", e);
            return null;
        }
       
View Full Code Here

Examples of org.apache.bookkeeper.client.BookKeeper

        }
       
        @Override
        public void run() {
            LedgerHandle lh = null;
            BookKeeper bk = null;
            try {
                barrier.await();
                while(true) {
                    try {
                        bk = new BookKeeper(new ClientConfiguration(baseClientConf), bkc.getZkHandle());
                       
                        lh = bk.openLedger(ledgerId,
                                           digestType, "".getBytes());
                        lastConfirmedEntry = lh.getLastAddConfirmed();
                        lh.close();
                        break;
                    } catch (BKException.ZKException zke) {
                        LOG.info("Contention with someone else recovering");
                    } catch (BKException.BKLedgerRecoveryException bkre) {
                        LOG.info("Contention with someone else recovering");
                    } finally {
                        if (lh != null) {
                            lh.close();
                        }
                        if (bk != null) {
                            bk.close();
                            bk = null;
                        }
                    }
                }
            } catch (Exception e) {
View Full Code Here

Examples of org.apache.bookkeeper.client.BookKeeper

        StubCallback<Void> stubCallback = new StubCallback<Void>();
        bkpm.acquiredTopic(topic, stubCallback, null);
        assertNull(ConcurrencyUtils.take(stubCallback.queue).right());
        // now abandon, and try another time, the prev ledger should be dirty

        bkpm = new BookkeeperPersistenceManager(new BookKeeper(bktb.getZkHostPort()), bktb.getZooKeeperClient(), tm,
                                                conf, scheduler);
        bkpm.acquiredTopic(topic, stubCallback, null);
        assertNull(ConcurrencyUtils.take(stubCallback.queue).right());
        assertEquals(0, bkpm.topicInfos.get(topic).ledgerRanges.size());
    }
View Full Code Here

Examples of org.apache.bookkeeper.client.BookKeeper

    BookKeeper bk;
    LedgerHandle[] lh;

    public BookkeeperBenchmark(String zkHostPort) throws Exception {
        bk = new BookKeeper(zkHostPort);
        int numLedgers = Integer.getInteger("nLedgers",5);
        lh = new LedgerHandle[numLedgers];
        int quorumSize = Integer.getInteger("quorum", 2);
        int ensembleSize = Integer.getInteger("ensemble", 4);
        DigestType digestType = DigestType.valueOf(System.getProperty("digestType", "CRC32"));
View Full Code Here

Examples of org.apache.bookkeeper.client.BookKeeper

        for (int i = 0; i < numBookies; i++) {
            startUpNewBookieServer();
        }

        // Create the BookKeeper client
        bk = new BookKeeper(hostPort);
    }
View Full Code Here

Examples of org.apache.bookkeeper.client.BookKeeper

        } else {
            try {
                ClientConfiguration bkConf = new ClientConfiguration();
                bkConf.addConfiguration(conf.getConf());
                bk = new BookKeeper(bkConf, zk, clientChannelFactory);
            } catch (KeeperException e) {
                logger.error("Could not instantiate bookkeeper client", e);
                throw new IOException(e);
            }
            underlyingPM = new BookkeeperPersistenceManager(bk, zk, topicMgr, conf, scheduler);
View Full Code Here

Examples of org.apache.bookkeeper.client.BookKeeper

        map = new HashMap<Integer, Integer>();
    }

    public TestClient(String servers) throws KeeperException, IOException, InterruptedException {
        this();
        x = new BookKeeper(servers);
        try {
            lh = x.createLedger(DigestType.MAC, new byte[] {'a', 'b'});
        } catch (BKException e) {
            LOG.error(e.toString());
        }
View Full Code Here

Examples of org.apache.bookkeeper.client.BookKeeper

    }

    public TestClient(String servers, int ensSize, int qSize)
            throws KeeperException, IOException, InterruptedException {
        this();
        x = new BookKeeper(servers);
        try {
            lh = x.createLedger(ensSize, qSize, DigestType.MAC, new byte[] {'a', 'b'});
        } catch (BKException e) {
            LOG.error(e.toString());
        }
View Full Code Here

Examples of org.apache.bookkeeper.client.BookKeeper

     *
     * @throws {@link IOException}, {@link KeeperException}
     */
    @Test
    public void testStreamingClients() throws IOException, KeeperException, BKException, InterruptedException {
        bkc = new BookKeeper("127.0.0.1");
        lh = bkc.createLedger(digestType, ledgerPassword);
        // write a string so that we cna
        // create a buffer of a single bytes
        // and check for corner cases
        String toWrite = "we need to check for this string to match " + "and for the record mahadev is the best";
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.