Examples of BookieServer


Examples of org.apache.bookkeeper.proto.BookieServer

    int port = 13645;
    protected void setUp() throws Exception {
        tmpDir = File.createTempFile("bookie", "test");
        tmpDir.delete();
        tmpDir.mkdir();
        bs = new BookieServer(port, tmpDir, new File[] { tmpDir });
        bs.start();
    }
View Full Code Here

Examples of org.apache.bookkeeper.proto.BookieServer

    for(int i = 0; i < numberOfBookies; i++){
      tmpDirs[i] = File.createTempFile("bookie" + Integer.toString(i), "test");
      tmpDirs[i].delete();
      tmpDirs[i].mkdir();
     
      bs[i] = new BookieServer(initialPort + i, tmpDirs[i], new File[]{tmpDirs[i]});
      bs[i].start();
    }   
  }
View Full Code Here

Examples of org.apache.bookkeeper.proto.BookieServer

    for(int i = 0; i < numberOfBookies; i++){
      tmpDirs[i] = File.createTempFile("bookie" + Integer.toString(i), "test");
      tmpDirs[i].delete();
      tmpDirs[i].mkdir();
     
      bs[i] = new BookieServer(initialPort + i, InetAddress.getLocalHost().getHostAddress() + ":"
                    + ZooKeeperDefaultPort, tmpDirs[i], new File[]{tmpDirs[i]});
      bs[i].start();
    }   
  }
View Full Code Here

Examples of org.apache.bookkeeper.proto.BookieServer

            byte[] data = (""+i).getBytes();
            lh.addEntry(data);
        }
       
        bs.get(3).shutdown();
        BookieServer server = new BookieServer(initialPort + 3, HOSTPORT, tmpDirs.get(3), new File[] { tmpDirs.get(3)});
        server.start();
        bs.set(3, server);

        assertEquals(numEntries - 1 , lh.getLastAddConfirmed());
        Enumeration<LedgerEntry> entries = lh.readEntries(0, lh.getLastAddConfirmed());
       
View Full Code Here

Examples of org.apache.bookkeeper.proto.BookieServer

        tmpDir.delete();
        tmpDir.mkdir();
        // Since this test does not rely on the BookKeeper client needing to
        // know via ZooKeeper which Bookies are available, okay, so pass in null
        // 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.proto.BookieServer

            File f = File.createTempFile("bookie", "test");
            tmpDirs.add(f);
            f.delete();
            f.mkdir();

            BookieServer server = new BookieServer(initialPort + i, HOSTPORT, f, new File[] { f });
            server.start();
            bs.add(server);
        }
        zkc.close();
        bkc = new BookKeeper("127.0.0.1");
        } catch(Exception e) {
View Full Code Here

Examples of org.apache.bookkeeper.proto.BookieServer

    throws IOException, InterruptedException {
        File f = File.createTempFile("bookie", "test");
        tmpDirs.add(f);
        f.delete();
        f.mkdir();
        BookieServer server = new BookieServer(port, HOSTPORT, f, new File[] { f });
        server.start();
        bs.add(server);
        while(!server.isRunning()){
            Thread.sleep(500);
        }
        LOG.info("New bookie on port " + port + " has been created.");
    }
View Full Code Here

Examples of org.apache.bookkeeper.proto.BookieServer

     *          Socket Address
     * @return the configuration of killed bookie
     * @throws InterruptedException
     */
    public ServerConfiguration killBookie(InetSocketAddress addr) throws InterruptedException {
        BookieServer toRemove = null;
        int toRemoveIndex = 0;
        for (BookieServer server : bs) {
            if (server.getLocalAddress().equals(addr)) {
                server.shutdown();
                toRemove = server;
View Full Code Here

Examples of org.apache.bookkeeper.proto.BookieServer

     */
    public ServerConfiguration killBookie(int index) throws InterruptedException, IOException {
        if (index >= bs.size()) {
            throw new IOException("Bookie does not exist");
        }
        BookieServer server = bs.get(index);
        server.shutdown();
        bs.remove(server);
        return bsConfs.remove(index);
    }
View Full Code Here

Examples of org.apache.bookkeeper.proto.BookieServer

     *            Server Configuration Object
     *
     */
    protected BookieServer startBookie(ServerConfiguration conf)
            throws IOException, InterruptedException, KeeperException, BookieException {
        BookieServer server = new BookieServer(conf);
        server.start();

        int port = conf.getBookiePort();
        while(bkc.getZkHandle().exists("/ledgers/available/" + InetAddress.getLocalHost().getHostAddress() + ":" + port, false) == null) {
            Thread.sleep(500);
        }
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.