Examples of OrderedSafeExecutor


Examples of org.apache.bookkeeper.util.OrderedSafeExecutor

        this.conf = conf;
        this.zk = zk;
        this.channelFactory = channelFactory;
        this.scheduler = Executors.newSingleThreadScheduledExecutor();

        mainWorkerPool = new OrderedSafeExecutor(conf.getNumWorkerThreads());
        bookieClient = new BookieClient(conf, channelFactory, mainWorkerPool);
        bookieWatcher = new BookieWatcher(conf, scheduler, this);
        bookieWatcher.readBookiesBlocking();

        ledgerManagerFactory = LedgerManagerFactory.newLedgerManagerFactory(conf, zk);
View Full Code Here

Examples of org.apache.bookkeeper.util.OrderedSafeExecutor

        long begin = System.currentTimeMillis();

        LoopbackClient lb;
        ClientSocketChannelFactory channelFactory = new NioClientSocketChannelFactory(Executors.newCachedThreadPool(), Executors
                .newCachedThreadPool());
        OrderedSafeExecutor executor = new OrderedSafeExecutor(2);
        try {
            InetSocketAddress addr = new InetSocketAddress("127.0.0.1", Integer.valueOf(args[2]).intValue());
            lb = new LoopbackClient(channelFactory, executor, begin, limit.intValue());

            for (int i = 0; i < limit; i++) {
View Full Code Here

Examples of org.apache.bookkeeper.util.OrderedSafeExecutor

        // for the zkServers input parameter when constructing the BookieServer.
        bs = new BookieServer(port, null, tmpDir, new File[] { tmpDir });
        bs.start();
        channelFactory = new NioClientSocketChannelFactory(Executors.newCachedThreadPool(), Executors
                .newCachedThreadPool());
        executor = new OrderedSafeExecutor(2);
    }
View Full Code Here

Examples of org.apache.bookkeeper.util.OrderedSafeExecutor

        Counter counter = new Counter();
        byte hello[] = "hello".getBytes();
        long ledger = Long.parseLong(args[2]);
        ClientSocketChannelFactory channelFactory = new NioClientSocketChannelFactory(Executors.newCachedThreadPool(), Executors
                .newCachedThreadPool());
        OrderedSafeExecutor executor = new OrderedSafeExecutor(1);
        BookieClient bc = new BookieClient(channelFactory, executor);
        InetSocketAddress addr = new InetSocketAddress(args[0], Integer.parseInt(args[1]));

        for (int i = 0; i < 100000; i++) {
            counter.inc();
            bc.addEntry(addr, ledger, new byte[0], i, ChannelBuffers.wrappedBuffer(hello), cb, counter);
        }
        counter.wait(0);
        System.out.println("Total = " + counter.total());
        channelFactory.releaseExternalResources();
        executor.shutdown();
    }
View Full Code Here

Examples of org.apache.bookkeeper.util.OrderedSafeExecutor

            throw KeeperException.create(KeeperException.Code.CONNECTIONLOSS);
        }

        this.channelFactory = new NioClientSocketChannelFactory(Executors.newCachedThreadPool(),
                                                                Executors.newCachedThreadPool());
        mainWorkerPool = new OrderedSafeExecutor(conf.getNumWorkerThreads());
        bookieClient = new BookieClient(conf, channelFactory, mainWorkerPool);
        bookieWatcher = new BookieWatcher(conf, this);
        bookieWatcher.readBookiesBlocking();

        ledgerManager = LedgerManagerFactory.newLedgerManager(conf, zk);
View Full Code Here

Examples of org.apache.bookkeeper.util.OrderedSafeExecutor

        }
        this.conf = conf;
        this.zk = zk;
        this.channelFactory = channelFactory;

        mainWorkerPool = new OrderedSafeExecutor(conf.getNumWorkerThreads());
        bookieClient = new BookieClient(conf, channelFactory, mainWorkerPool);
        bookieWatcher = new BookieWatcher(conf, this);
        bookieWatcher.readBookiesBlocking();

        ledgerManager = LedgerManagerFactory.newLedgerManager(conf, zk);
View Full Code Here

Examples of org.apache.bookkeeper.util.OrderedSafeExecutor

            .setLedgerDirNames(new String[] { tmpDir.getPath() });
        bs = new BookieServer(conf);
        bs.start();
        channelFactory = new NioClientSocketChannelFactory(Executors.newCachedThreadPool(), Executors
                .newCachedThreadPool());
        executor = new OrderedSafeExecutor(2);
    }
View Full Code Here

Examples of org.apache.bookkeeper.util.OrderedSafeExecutor

        Counter counter = new Counter();
        byte hello[] = "hello".getBytes();
        long ledger = Long.parseLong(args[2]);
        ClientSocketChannelFactory channelFactory = new NioClientSocketChannelFactory(Executors.newCachedThreadPool(), Executors
                .newCachedThreadPool());
        OrderedSafeExecutor executor = new OrderedSafeExecutor(1);
        BookieClient bc = new BookieClient(new ClientConfiguration(), channelFactory, executor);
        InetSocketAddress addr = new InetSocketAddress(args[0], Integer.parseInt(args[1]));

        for (int i = 0; i < 100000; i++) {
            counter.inc();
            bc.addEntry(addr, ledger, new byte[0], i, ChannelBuffers.wrappedBuffer(hello), cb, counter, 0);
        }
        counter.wait(0);
        System.out.println("Total = " + counter.total());
        channelFactory.releaseExternalResources();
        executor.shutdown();
    }
View Full Code Here

Examples of org.apache.bookkeeper.util.OrderedSafeExecutor

        this.channelFactory = new NioClientSocketChannelFactory(Executors.newCachedThreadPool(),
                                                                Executors.newCachedThreadPool());
        this.scheduler = Executors.newSingleThreadScheduledExecutor();

        mainWorkerPool = new OrderedSafeExecutor(conf.getNumWorkerThreads());
        bookieClient = new BookieClient(conf, channelFactory, mainWorkerPool);
        bookieWatcher = new BookieWatcher(conf, scheduler, this);
        bookieWatcher.readBookiesBlocking();

        ledgerManagerFactory = LedgerManagerFactory.newLedgerManagerFactory(conf, zk);
View Full Code Here

Examples of org.apache.bookkeeper.util.OrderedSafeExecutor

        this.conf = conf;
        this.zk = zk;
        this.channelFactory = channelFactory;
        this.scheduler = Executors.newSingleThreadScheduledExecutor();

        mainWorkerPool = new OrderedSafeExecutor(conf.getNumWorkerThreads());
        bookieClient = new BookieClient(conf, channelFactory, mainWorkerPool);
        bookieWatcher = new BookieWatcher(conf, scheduler, this);
        bookieWatcher.readBookiesBlocking();

        ledgerManagerFactory = LedgerManagerFactory.newLedgerManagerFactory(conf, zk);
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.