Package org.chaidb.db.lock

Examples of org.chaidb.db.lock.Lock


        //add by stanley
        boolean hasPageForOverflow = false;
        PageNumber PgnForOverflow = null;
        DataPage DataPageForOverflow = null;
        Lock lockforOverflow = null;

        PageNumber latestDataPageNumber = buffer.getLatestDataPage(docid, pageNumber.getTreeId(), needLog ? new Integer(txnId) : null);

        Lock lock = null;
        boolean isValidPage;
        while (latestDataPageNumber != null && latestDataPageNumber.getPageNumber() > 0) {

            lock = BTreeLock.acquire(kContext, LockManager.LOCK_WAITING, latestDataPageNumber, LockManager.LOCK_WRITE);
View Full Code Here


     *
     * @return Lock the lock we get
     */
    public static Lock acquire(KernelContext kc, int flag, PageNumber p, int lockType) throws ChaiDBException {
        int locker = kc.getLocker();
        Lock lock = null;


        lock = lm.get(locker, flag, lm.OBJECT_BTREE, p.uniqueID(), lockType);

        if (_debug) {
            logger.debug("[AllLocks]" + "lock:" + lock.getLockID());

        }
        return lock;
    }
View Full Code Here

            needn't downgrade lock,directly return */
        if (ISOLATION_LEVEL == ISOLATION_LEVEL_COMMIT_READ) {
            return lock;
        }
        //here we reacquire a new lock and release the old one.
        Lock newlock = lm.get(kc.getLocker(), LockManager.LOCK_WAITING, lm.OBJECT_BTREE, lock.getLockID(), lockType);
        lm.put(lock);
        return newlock;
    }
View Full Code Here

    private Logger logger = Logger.getLogger(LockableBTree.class);

    protected int id;

    public void acquire(KernelContext kContext, int mode) throws ChaiDBException {
        Lock lock = null;
        try {
            if (mode == IBTreeConst.READ_MODE) {
                lock = BTreeLock.acquire(kContext, LockManager.LOCK_WAITING, new PageNumber(id, 0, 0), LockManager.LOCK_READ);
            } else if (mode == IBTreeConst.WRITE_MODE) {
                lock = BTreeLock.acquire(kContext, LockManager.LOCK_WAITING, new PageNumber(id, 0, 0), LockManager.LOCK_WRITE);
View Full Code Here

    }

    public void release(KernelContext kContext) {
        try {
            Lock lock = kContext.getLock(getBTreeName());
            if (lock != null) {
                if (kContext.getNeedLog()) {
                    if (lock.getMode() == LockManager.LOCK_READ) {
                        BTreeLock.release(kContext, id, lock);

                    } else {
                        lock = BTreeLock.change(kContext, lock, id, LockManager.LOCK_READ);
                    }
View Full Code Here

TOP

Related Classes of org.chaidb.db.lock.Lock

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.