Examples of LockNotGrantedException


Examples of org.exolab.castor.jdo.LockNotGrantedException

                LinkedTx read;

                // Is the blocked transaction blocked by the transaction locking
                // this object? This is a deadlock.
                if ( waitOn._writeLock == waitingTx ) {
                    throw new LockNotGrantedException( "persist.deadlock" );
                }
                read = waitOn._readLock;
                while ( read != null ) {
                    if ( read.tx == waitingTx )
                        throw new LockNotGrantedException( "persist.deadlock" );
                    read = read.next;
                }
                waitOn.detectDeadlock( waitingTx, numOfRec - 1 );
            }
        } else {
            LinkedTx lock;

            lock = _readLock;
            while ( lock != null ) {
                // T1 trying to acquire lock on O1, which is locked by T2
                // T2 trying to acauire lock on O1, T1 is waiting on O1

                // lock is the blocking transaction. We are only interested in
                // a blocked transacrtion.
                waitOn = lock.tx.getWaitOnLock();
                if ( waitOn != null && lock.tx != waitingTx ) {
                    LinkedTx read;

                    if ( waitOn._writeLock == waitingTx ) {
                        throw new LockNotGrantedException( "persist.deadlock" );
                    }
                    read = waitOn._readLock;
                    while ( read != null ) {
                        if ( read.tx == waitingTx )
                            throw new LockNotGrantedException( "persist.deadlock" );
                        read = read.next;
                    }
                    waitOn.detectDeadlock( waitingTx, numOfRec - 1 );
                }
                lock = lock.next;
View Full Code Here

Examples of org.exolab.castor.jdo.LockNotGrantedException

                entry = (ObjectLock) locks.get( orgoid );
                newentry = (ObjectLock) locks.get( newoid );

                // validate locks
                if ( orgoid == newoid )
                    throw new LockNotGrantedException("Locks are the same");
                if ( entry == null )
                    throw new LockNotGrantedException("Lock doesn't exsit!");
                if ( !entry.isExclusivelyOwned( tx ) )
                    throw new LockNotGrantedException("Lock to be renamed is not own exclusively by transaction!");
                if ( entry.isEntered() )
                    throw new LockNotGrantedException("Lock to be renamed is being acquired by another transaction!");
                if ( newentry != null )
                    throw new LockNotGrantedException("Lock is already existed for the new oid.");

                entry = (ObjectLock) locks.remove( orgoid );
                entry.setOID( newoid );
                locks.put( newoid, entry );
View Full Code Here

Examples of org.exolab.castor.jdo.LockNotGrantedException

                entry = (ObjectLock) locks.get( orgoid );
                newentry = (ObjectLock) locks.get( newoid );

                // validate locks
                if ( orgoid == newoid )
                    throw new LockNotGrantedException("Locks are the same");
                if ( entry == null )
                    throw new LockNotGrantedException("Lock doesn't exsit!");
                if ( !entry.isExclusivelyOwned( tx ) )
                    throw new LockNotGrantedException("Lock to be renamed is not own exclusively by transaction!");
                if ( entry.isEntered() )
                    throw new LockNotGrantedException("Lock to be renamed is being acquired by another transaction!");
                if ( newentry != null )
                    throw new LockNotGrantedException("Lock is already existed for the new oid.");

                entry = (ObjectLock) locks.remove( orgoid );
                entry.setOID( newoid );
                locks.put( newoid, entry );
View Full Code Here

Examples of org.odmg.LockNotGrantedException

                    throw (LockNotGrantedException) t;
                }
                else
                {
                    log.error("Unexpected failure while locking", t);
                    throw new LockNotGrantedException("Locking failed for "
                            + rtObject.getIdentity()+ ", nested exception is: [" + t.getClass().getName()
                            + ": " + t.getMessage() + "]");
                }
            }
            if(cascade)
View Full Code Here

Examples of org.odmg.LockNotGrantedException

            if (lockMode == Transaction.READ)
            {
                if (log.isDebugEnabled()) log.debug("Do READ lock on object: " + oid);
                if(!lm.readLock(this, oid, obj))
                {
                    throw new LockNotGrantedException("Can not lock for READ: " + oid);
                }
            }
            else if (lockMode == Transaction.WRITE)
            {
                if (log.isDebugEnabled()) log.debug("Do WRITE lock on object: " + oid);
                if(!lm.writeLock(this, oid, obj))
                {
                    throw new LockNotGrantedException("Can not lock for WRITE: " + oid);
                }
            }
            else if (lockMode == Transaction.UPGRADE)
            {
                if (log.isDebugEnabled()) log.debug("Do UPGRADE lock on object: " + oid);
                if(!lm.upgradeLock(this, oid, obj))
                {
                    throw new LockNotGrantedException("Can not lock for UPGRADE: " + oid);
                }
            }
        }
        else
        {
View Full Code Here

Examples of org.odmg.LockNotGrantedException

            lockAndRegister(rt, Transaction.READ, isImplicitLocking(), getRegistrationList());
        }
        catch (Throwable t)
        {
            log.error("Register materialized object with this tx failed", t);
            throw new LockNotGrantedException(t.getMessage());
        }
        unregisterFromIndirectionHandler(handler);
    }
View Full Code Here

Examples of org.odmg.LockNotGrantedException

            {
                // make error log to show the full stack trace one time
                log.error("Optimistic lock exception while write objects", e);
                // PB OptimisticLockException should be clearly signalled to the user
                Object sourceObject = ((OptimisticLockException) e).getSourceObject();
                throw new LockNotGrantedException("Optimistic lock exception occur, source object was (" + sourceObject + ")," +
                        " message was (" + e.getMessage() + ")");
            }
            else if(!(e instanceof RuntimeException))
            {
                log.warn("Error while write objects for tx " + transaction, e);
View Full Code Here

Examples of org.odmg.LockNotGrantedException

            connMan.clearBatch();
            log.error("Commit on object level failed for tx " + transaction, t);
            if (t instanceof OptimisticLockException)
            {
              // PB OptimisticLockException should be clearly signalled to the user
              throw new LockNotGrantedException(t.getMessage());
            }
            else
            {
                    throw new TransactionAbortedExceptionOJB(t);
            }
View Full Code Here

Examples of org.odmg.LockNotGrantedException

        LockManager lm = LockManagerFactory.getLockManager();
        if (lockMode == Transaction.READ)
        {
            if (!lm.readLock(this, obj))
            {
                throw new LockNotGrantedException("Can not lock for READ: " + obj);
            }
        }
        else if (lockMode == Transaction.WRITE)
        {
            if (!lm.writeLock(this, obj))
            {
                throw new LockNotGrantedException("Can not lock for WRITE: " + obj);
            }
        }
        else if (lockMode == Transaction.UPGRADE)
        {
            if (!lm.upgradeLock(this, obj))
            {
                throw new LockNotGrantedException("Can not lock for UPGRADE: " + obj);
            }
        }
        try
        {
            if (log.isDebugEnabled()) log.debug("registering lock on object at " + System.currentTimeMillis());
            register(obj, lockMode);
        }
        catch (Throwable t)
        {
            log.error("Locking obj " + obj + " with lock mode " + lockMode + " failed", t);
            lm.releaseLock(this, obj);
            throw new LockNotGrantedException(t.getMessage());
        }
    }
View Full Code Here

Examples of org.odmg.LockNotGrantedException

            register(materializedObject, READ);
        }
        catch (Throwable t)
        {
            log.error("Register materialized object with this tx failed", t);
            throw new LockNotGrantedException(t.getMessage());
        }
        unregisterFromIndirectionHandler(handler);
    }
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.