Package org.apache.bookkeeper.client

Examples of org.apache.bookkeeper.client.BookKeeper.openLedger()


                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) {
View Full Code Here


                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.BKMetadataVersionException zke) {
View Full Code Here

        long id = getLedgerToRead(3,2);
        BookKeeper bknospec = createClient(0); // disabled
        BookKeeper bkspec = createClient(2000);

        LedgerHandle lnospec = bknospec.openLedger(id, digestType, passwd);
        LedgerHandle lspec = bkspec.openLedger(id, digestType, passwd);

        // sleep second bookie
        CountDownLatch sleepLatch = new CountDownLatch(1);
        InetSocketAddress second = lnospec.getLedgerMetadata().getEnsembles().get(0L).get(1);
        sleepBookie(second, sleepLatch);
View Full Code Here

    public void testSpeculativeReadMultipleReplicasDown() throws Exception {
        long id = getLedgerToRead(5,5);
        int timeout = 5000;
        BookKeeper bkspec = createClient(timeout);

        LedgerHandle l = bkspec.openLedger(id, digestType, passwd);

        // sleep bookie 1, 2 & 4
        CountDownLatch sleepLatch = new CountDownLatch(1);
        sleepBookie(l.getLedgerMetadata().getEnsembles().get(0L).get(1), sleepLatch);
        sleepBookie(l.getLedgerMetadata().getEnsembles().get(0L).get(2), sleepLatch);
View Full Code Here

    public void testSpeculativeReadFirstReadCompleteIsOk() throws Exception {
        long id = getLedgerToRead(2,2);
        int timeout = 1000;
        BookKeeper bkspec = createClient(timeout);

        LedgerHandle l = bkspec.openLedger(id, digestType, passwd);

        // sleep bookies
        CountDownLatch sleepLatch0 = new CountDownLatch(1);
        CountDownLatch sleepLatch1 = new CountDownLatch(1);
        sleepBookie(l.getLedgerMetadata().getEnsembles().get(0L).get(0), sleepLatch0);
View Full Code Here

    public void testSpeculativeReadScheduling() throws Exception {
        long id = getLedgerToRead(3,2);
        int timeout = 1000;
        BookKeeper bkspec = createClient(timeout);

        LedgerHandle l = bkspec.openLedger(id, digestType, passwd);

        ArrayList<InetSocketAddress> ensemble = l.getLedgerMetadata().getEnsembles().get(0L);
        Set<InetSocketAddress> allHosts = new HashSet(ensemble);
        Set<InetSocketAddress> noHost = new HashSet();
        Set<InetSocketAddress> secondHostOnly = new HashSet();
View Full Code Here

       
        /*
         * Try to open ledger.
         */
        try{
            LedgerHandle afterlh = bk.openLedger(beforelh.getId(), "".getBytes());
           
            /*
             * Check if has recovered properly.
             */
            assertTrue("Has not recovered correctly: " + afterlh.getLast(), afterlh.getLast() == 1000);
View Full Code Here

                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) {
View Full Code Here

                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.BKMetadataVersionException zke) {
View Full Code Here

        long id = getLedgerToRead(3,2);
        BookKeeper bknospec = createClient(0); // disabled
        BookKeeper bkspec = createClient(2000);

        LedgerHandle lnospec = bknospec.openLedger(id, digestType, passwd);
        LedgerHandle lspec = bkspec.openLedger(id, digestType, passwd);

        // sleep second bookie
        CountDownLatch sleepLatch = new CountDownLatch(1);
        InetSocketAddress second = lnospec.getLedgerMetadata().getEnsembles().get(0L).get(1);
        sleepBookie(second, sleepLatch);
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.