Package org.apache.bookkeeper.client

Examples of org.apache.bookkeeper.client.BookieHandle


    private void setBookies(ArrayList<InetSocketAddress> bookies)
    throws InterruptedException {
        for(InetSocketAddress a : bookies){
            LOG.debug("Opening bookieHandle: " + a);
            try{
                BookieHandle bh = new BookieHandle(this, a);
                this.bookies.add(bh);
            } catch(ConnectException e){
                LOG.error(e + "(bookie: " + a + ")");
               
                InetSocketAddress addr = null;
View Full Code Here


     *
     * @param addr  socket address
     */
    void addBookie(InetSocketAddress addr)
    throws IOException {
        BookieHandle bh = new BookieHandle(this, addr);
        this.bookies.add(bh);
       
        if(bookies.size() > qSize) setThreshold();
    }
View Full Code Here

       
        if(addr == null){
            throw BKException.create(Code.NoBookieAvailableException);
        } else {          
            try{
                BookieHandle bh = new BookieHandle(this, addr);
               
                /*
                 * TODO: Read from current bookies, and write to this one
                 */
               
View Full Code Here

                   
                    int tmpId = (((int) entryId) + lh.getQuorumSize()) % (lh.getBookies().size() + 1);
                    int newId = tmpId % lh.getBookies().size();
                    //LOG.info("Sending a new add operation to bookie: " + newId + ", " + lh.getBookies().get(newId).addr);
                   
                    BookieHandle bh = lh.getBookies().get(newId);
                   
                    //LOG.info("Got handle for " + newId);
                   
                    bh.sendAdd(lh, new SubAddOp(sAdd.op,
                            pOp,
                            newId,
                            this), entryId);
              
                    //LOG.info("Ended " + entryId + ", " + newId);
View Full Code Here

        //BookieHandle bh = new BookieHandle(this, addr);
        try{
            this.bookies.add(bk.getBookieHandle(this, addr));
        } catch (IOException e){
            LOG.info("Inserting a decoy bookie handle");
            this.bookies.add(new BookieHandle(addr, false));
        }
        if(bookies.size() > qSize) setThreshold();
        return (this.bookies.size() - 1);
    }
View Full Code Here

     */
   
    synchronized BookieHandle getBookieHandle(LedgerHandle lh, InetSocketAddress a)
    throws ConnectException, IOException {
      if(!bhMap.containsKey(a)){
          BookieHandle bh = new BookieHandle(a, true);
        bhMap.put(a, bh);
        bh.start();
      }
      bhMap.get(a).incRefCount(lh);
     
      return bhMap.get(a);
    }
View Full Code Here

     * remove it from the list.
     */
   
    synchronized void haltBookieHandles(LedgerHandle lh, ArrayList<BookieHandle> bookies){
        while(bookies.size() > 0){
            BookieHandle bh = bookies.remove(0);
            if(bh.halt(lh) <= 0)
                bhMap.remove(bh.addr);
        }
    }
View Full Code Here

TOP

Related Classes of org.apache.bookkeeper.client.BookieHandle

Copyright © 2018 www.massapicom. 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.