Examples of DBException


Examples of xbird.storage.DbException

            if(_fileHeader._fhDirty) {
                _fileHeader.write();
            }
            _fc.force(true);
        } catch (IOException e) {
            throw new DbException(e);
        }
    }
View Full Code Here

Examples of xbird.storage.DbException

            // if still not found we need to create it and add it to the page cache.
            p = new Page(pageNum);
            try {
                p.read(); // Load the page from disk if necessary
            } catch (IOException e) {
                throw new DbException(e);
            }
            _pages.put(pageNum, new WeakReference<Page>(p));
        }
        return p;
    }
View Full Code Here

Examples of xbird.storage.DbException

        PageHeader hdr = page.getPageHeader();
        hdr.setRecordLength(value.getLength());
        try {
            page.readData(is);
        } catch (IOException e) {
            throw new DbException(e);
        }

        // Write out the rest of the value onto any needed overflow pages
        Page lastPage = page;
        while(true) {
            final int available;
            try {
                available = is.available();
            } catch (IOException e) {
                throw new DbException(e);
            }
            if(available == 0) {
                break;
            }
            LOG.debug("page overflowed");

            Page lpage = lastPage;
            PageHeader lhdr = hdr;

            // Find an overflow page to use
            long np = lhdr.getNextPage();
            if(np != NO_PAGE) {
                // Use an existing page
                lastPage = getPage(np);
            } else {
                // Create a new overflow page
                lastPage = getFreePage();
                lhdr.setNextPage(lastPage.getPageNum());
            }

            // Mark the page as an overflow page
            hdr = lastPage.getPageHeader();
            hdr.setStatus(OVERFLOW);

            // Write some more of the value to the overflow page
            try {
                lastPage.readData(is);
            } catch (IOException e) {
                throw new DbException(e);
            }
            lpage.write();
        }

        // Cleanup any unused overflow pages. i.e. the value is smaller then the
View Full Code Here

Examples of xbird.storage.DbException

        while(true) {
            // Add the contents of the page onto the stream
            try {
                p.writeData(bos);
            } catch (IOException e) {
                throw new DbException(e);
            }
            // Continue following the list of pages until we get to the end
            PageHeader ph = p.getPageHeader();
            long nextPage = ph.getNextPage();
            if(nextPage == NO_PAGE) {
View Full Code Here

Examples of xbird.storage.DbException

            _pageHeader.write(_pageData);
            try {
                _raf.seek(_pageOffset);
                _raf.write(_pageData.array());
            } catch (IOException e) {
                throw new DbException(e);
            }
        }
View Full Code Here

Examples of xbird.storage.DbException

            Page p = getPage(pageNum);
            dataPage = new DataPage(p);
            try {
                dataPage.read();
            } catch (IOException e) {
                throw new DbException("failed to read page#" + pageNum, e);
            }
            dataCache.put(pageNum, dataPage);
        }
        return dataPage;
    }
View Full Code Here

Examples of xbird.storage.DbException

            _rootNode.ph.setStatus(LEAF);
            _rootNode.set(new Value[0], new long[0]);
            try {
                _rootNode.write();
            } catch (IOException e) {
                throw new DbException(e);
            }
            synchronized(_cache) {
                _cache.put(_rootNode.page.getPageNum(), _rootNode);
            }
            if(close) {
View Full Code Here

Examples of xbird.storage.DbException

     */
    public synchronized long addValue(Value value, long pointer) throws DbException {
        try {
            return _rootNode.addValue(value, pointer);
        } catch (IOException e) {
            throw new DbException(e);
        }
    }
View Full Code Here

Examples of xbird.storage.DbException

     */
    public synchronized long removeValue(Value value) throws DbException {
        try {
            return _rootNode.removeValue(value);
        } catch (IOException e) {
            throw new DbException(e);
        }
    }
View Full Code Here

Examples of xbird.storage.DbException

    public synchronized long[] removeValue(Value value, long pointer) throws DbException {
        try {
            return _rootNode.removeValue(value, pointer);
        } catch (IOException e) {
            throw new DbException(e);
        }
    }
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.