Package org.chaidb.db.exception

Examples of org.chaidb.db.exception.ChaiDBException


            /* set flags of different page type */
            System.arraycopy(ByteTool.intToBytes(pageFlag), 0, page, BTreeSpec.OFF_FLAGS, 4);

        } catch (Exception e) {
            logger.debug(e);
            throw new ChaiDBException(ErrorCode.LOG_REDO_FAILED, e.toString());
        }
        return true;
    }
View Full Code Here


                bp.removeLatestDataPage(docId, treeId, super.getPageNum(), new Integer(super.getTxnId()));

            //add 1 on the free page number in metadata page of file if it's not in freelist
        } catch (Exception e) {
            logger.debug(e);
            throw new ChaiDBException(ErrorCode.LOG_UNDO_FAILED, e.toString());
        }
        return true;
    }
View Full Code Here

        // init bitMap from file
        try {
            init();
        } catch (IOException e) {
            throw new ChaiDBException(ErrorCode.BTREE_INVALID);
        }
    }
View Full Code Here

        // init bitMap from file
        try {
            init();
        } catch (IOException e) {
            throw new ChaiDBException(ErrorCode.BTREE_INVALID);
        }
    }
View Full Code Here

        RandomAccessFile raf = null;
        int flag;
        try {
            if (!f.exists()) { // this would not be run
                if (reading) {
                    throw new ChaiDBException(ErrorCode.BTREE_TRACKFILE_IO_ERROR);
                }
                raf = new RandomAccessFile(trackName, "rw");
                raf.setLength(4);
                flag = OBSOLETE_FLAG;
                raf.writeInt(flag);
                return;
            } else {
                raf = new RandomAccessFile(trackName, "rw");
                if (!isRightFile(raf) && reading) { // when reading track file, it's bad
                    throw new ChaiDBException(ErrorCode.BTREE_TRACKFILE_IO_ERROR);
                } else {
                    if (f.length() < 8) {
                        if (reading) {
                            throw new ChaiDBException(ErrorCode.BTREE_TRACKFILE_IO_ERROR);
                        } else {
                            raf.setLength(8);
                            flag = OBSOLETE_FLAG;
                            raf.seek(FLAG_OFF);
                            raf.writeInt(flag);
                            if (!reading) {
                                raf.writeInt(treeid);
                            } else { // should read a empty track file when backup, it's bad, throw exception
                                throw new ChaiDBException(ErrorCode.BTREE_TRACKFILE_IO_ERROR);
                            }
                        }
                        return;
                    } else {
View Full Code Here

            while (it.hasNext()) {
                ((BitMap) it.next()).flush(raf);
            }
            endFlush(raf);
        } catch (IOException e) {
            throw new ChaiDBException(ErrorCode.BTREE_TRACKFILE_IO_ERROR);
        } finally {
            if (raf != null) {
                try {
                    raf.close();
                } catch (IOException e) {
                    throw new ChaiDBException(ErrorCode.BTREE_TRACKFILE_IO_ERROR);
                }
            }
        }
    }
View Full Code Here

                }
                readed += endpos;
            }
            //stream will be closed by outer method
        } catch (IOException e) {
            throw new ChaiDBException(ErrorCode.BTREE_TRACKFILE_IO_ERROR);
        } catch (ChaiDBException e) {
            throw e;
        }
    }
View Full Code Here

        DataOutputStream out = null;
        try {
            out = new DataOutputStream(new BufferedOutputStream(new FileOutputStream(dstpath)));
            backupChanges(out);
        } catch (FileNotFoundException e) {
            throw new ChaiDBException(ErrorCode.BTREE_TRACKFILE_IO_ERROR);
        } finally {
            if (out != null) {
                try {
                    out.close();
                } catch (IOException e) {
View Full Code Here

                StorageProxy.writePages(btreepath, pnos, writed, pages, 0, endpos - writed);
                writed = endpos;
            }
            in.close();
        } catch (IOException e) {
            throw new ChaiDBException(ErrorCode.BTREE_TRACKFILE_IO_ERROR);
        } catch (ChaiDBException e) {
            throw e;
        }
    }
View Full Code Here

        try {
            DataInputStream in = new DataInputStream(new BufferedInputStream(new FileInputStream(srcpath)));
            restoreChanges(btreepath, in);
        } catch (FileNotFoundException e) {
            throw new ChaiDBException(ErrorCode.BTREE_TRACKFILE_IO_ERROR);
        }
    }
View Full Code Here

TOP

Related Classes of org.chaidb.db.exception.ChaiDBException

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.