Examples of Lockable


Examples of org.apache.derby.iapi.services.locks.Lockable

  {
    LockSet clone = new LockSet(factory);

    for (Enumeration e = keys(); e.hasMoreElements(); )
    {
      Lockable lockable = (Lockable)e.nextElement();
      Control control = getControl(lockable);

      clone.put(lockable, control.shallowClone());
    }
View Full Code Here

Examples of org.apache.derby.iapi.services.locks.Lockable

    if (isUnlocked())
      return true;

        boolean grantLock    = false;

    Lockable lref = ref;
    List lgranted = granted;

        {
            // Check to see if the only locks on the granted queue that
            // we are incompatible with are locks we own.
            boolean selfCompatible = lref.lockerAlwaysCompatible();

      int index = 0;
      int endIndex = firstGrant == null ? lgranted.size() : 0;
      do {

        Lock gl = firstGrant == null ? (Lock) lgranted.get(index) : firstGrant;

                boolean sameSpace =
                    (gl.getCompatabilitySpace().equals(compatabilitySpace));

                if (sameSpace && selfCompatible)
                {
                    // if it's one of our locks and we are always compatible
                    // with our own locks then yes, we can be granted.
                   
                    grantLock = true;
                    continue;
                }
                else if (!lref.requestCompatible(qualifier, gl.getQualifier()))
                {
                    // If we are not compatible with some already granted lock
                    // then we can't be granted, give up right away.
                   
                    grantLock = false;
View Full Code Here

Examples of org.apache.derby.iapi.services.locks.Lockable

    // jump past it.
    boolean grantLock = false;   
    boolean otherWaiters = (firstWaiter() != null);

    Lock lockItem = null;
    Lockable lref = ref;

    // If we haven't been able to grant the lock yet then see if we hold a
        // lock already that we are compatible with and there are no granted
        // incompatible locks. If the object appears unlocked (due to a just
        // released lock, but the first waiter hasn't woken yet)
    // then we obviously don't hold a lock, so just join the wait queue.
    boolean spaceHasALock = false;
    boolean noGrantAtAll = false;
    if (!grantLock && !isUnlocked()) {

      boolean selfCompatible = lref.lockerAlwaysCompatible();
     
      int index = 0;
      int endIndex = firstGrant == null ? granted.size() : 0;
      do {

        Lock gl = firstGrant == null ? (Lock) granted.get(index) : firstGrant;


        boolean sameSpace = (gl.getCompatabilitySpace().equals(compatabilitySpace));

        // if it's one of our locks and we are always compatible with
                // our own locks then yes, we can be granted.
        if (sameSpace && selfCompatible) {

          spaceHasALock = true;

          if (noGrantAtAll)
            break;

          if (qualifier == gl.getQualifier())
            lockItem = gl;

          grantLock = true;
          continue;
        }
       
        // If we are not compatible with some already granted lock
                // then we can't be granted, give up right away.
        if (!lref.requestCompatible(qualifier, gl.getQualifier())) {
          grantLock = false;
          lockItem = null;

          // we can't give up rightaway if spaceHasALock is false
          // because we need to ensure that canSkip is set correctly
View Full Code Here

Examples of org.apache.derby.iapi.services.locks.Lockable

  {
    HashMap clone = new HashMap();

    for (Iterator it = locks.keySet().iterator(); it.hasNext(); )
    {
      Lockable lockable = (Lockable) it.next();
      Control control = getControl(lockable);

      clone.put(lockable, control.shallowClone());
    }
View Full Code Here

Examples of org.apache.derby.iapi.services.locks.Lockable


    // 4 things we are interested in from the lockable:
    // containerId, segmentId, pageNum, recId

    Lockable lockable = lock.getLockable();

    // see if this lockable object wants to participate
    if (!lockable.lockAttributes(flag, attributes))
      return null;       

    // if it does, the lockable object must have filled in the following
    // fields
    if (SanityManager.DEBUG)
View Full Code Here

Examples of org.apache.derby.iapi.services.locks.Lockable

    {
        Hashtable<String,Object> attributes = new Hashtable<String,Object>(17);
        Object lock_type = currentLock.getQualifier();

        // want containerId, segmentId, pageNum, recId from locktable
        Lockable lockable = currentLock.getLockable();

        // See if the lockable object wants to participate
        if( !lockable.lockAttributes(ALL, attributes) )
        {
            currentRow = null;
            return;
        }
View Full Code Here

Examples of org.apache.derby.iapi.services.locks.Lockable

    if (isUnlocked())
      return true;

        boolean grantLock    = false;

    Lockable lref = ref;
    List<Lock> lgranted = granted;

        {
            // Check to see if the only locks on the granted queue that
            // we are incompatible with are locks we own.
            boolean selfCompatible = lref.lockerAlwaysCompatible();

      int index = 0;
      int endIndex = firstGrant == null ? lgranted.size() : 0;
      do {

        Lock gl = firstGrant == null ? lgranted.get(index) : firstGrant;

                boolean sameSpace =
                    (gl.getCompatabilitySpace() == compatibilitySpace);

                if (sameSpace && selfCompatible)
                {
                    // if it's one of our locks and we are always compatible
                    // with our own locks then yes, we can be granted.
                   
                    grantLock = true;
                    continue;
                }
                else if (!lref.requestCompatible(qualifier, gl.getQualifier()))
                {
                    // If we are not compatible with some already granted lock
                    // then we can't be granted, give up right away.
                   
                    grantLock = false;
View Full Code Here

Examples of org.apache.derby.iapi.services.locks.Lockable

    // jump past it.
    boolean grantLock = false;   
    boolean otherWaiters = (firstWaiter() != null);

    Lock lockItem = null;
    Lockable lref = ref;

    // If we haven't been able to grant the lock yet then see if we hold a
        // lock already that we are compatible with and there are no granted
        // incompatible locks. If the object appears unlocked (due to a just
        // released lock, but the first waiter hasn't woken yet)
    // then we obviously don't hold a lock, so just join the wait queue.
    boolean spaceHasALock = false;
    boolean noGrantAtAll = false;
    if (!isUnlocked()) {

      boolean selfCompatible = lref.lockerAlwaysCompatible();
     
      int index = 0;
      int endIndex = firstGrant == null ? granted.size() : 0;
      do {

        Lock gl = firstGrant == null ? granted.get(index) : firstGrant;


        boolean sameSpace =
          (gl.getCompatabilitySpace() == compatibilitySpace);

        // if it's one of our locks and we are always compatible with
                // our own locks then yes, we can be granted.
        if (sameSpace && selfCompatible) {

          spaceHasALock = true;

          if (noGrantAtAll)
            break;

          if (qualifier == gl.getQualifier())
            lockItem = gl;

          grantLock = true;
          continue;
        }
       
        // If we are not compatible with some already granted lock
                // then we can't be granted, give up right away.
        if (!lref.requestCompatible(qualifier, gl.getQualifier())) {
          grantLock = false;
          lockItem = null;

          // we can't give up rightaway if spaceHasALock is false
          // because we need to ensure that canSkip is set correctly
View Full Code Here

Examples of org.apache.derby.iapi.services.locks.Lockable

  {
    HashMap clone = new HashMap();

    for (Iterator it = locks.keySet().iterator(); it.hasNext(); )
    {
      Lockable lockable = (Lockable) it.next();
      Control control = getControl(lockable);

      clone.put(lockable, control.shallowClone());
    }
View Full Code Here

Examples of org.apache.jackrabbit.ocm.testmodel.Lockable


            // --------------------------------------------------------------------------------
            // Create an object which is associated to the
            // --------------------------------------------------------------------------------
            Lockable lockable = new Lockable();
            lockable.setPath("/test");
            lockable.setA1("a1");
            lockable.setA2("a2");
            ocm.insert(lockable);
            ocm.save();
           

            // --------------------------------------------------------------------------------
            // Get the object
            // --------------------------------------------------------------------------------          
            lockable = (Lockable) ocm.getObject("/test");
            assertNotNull("a is null", lockable);
           
            // --------------------------------------------------------------------------------
            // Check if the object is locked
            // --------------------------------------------------------------------------------
            assertFalse("the object is locked", ocm.isLocked("/test"));
            assertNull("Attribute lockowner is not null", lockable.getLockOwner());
            // --------------------------------------------------------------------------------
            // Lock the object
            // --------------------------------------------------------------------------------                      
            Lock lock = ocm.lock("/test", true, false);
           
            // --------------------------------------------------------------------------------
            // Check if the object is locked
            // --------------------------------------------------------------------------------
            assertTrue("the object is not locked", ocm.isLocked("/test"));
           
            // --------------------------------------------------------------------------------
            // Unlock the object
            // --------------------------------------------------------------------------------          
            ocm.unlock("/test", lock.getLockToken());

            // --------------------------------------------------------------------------------
            // Check if the object is locked
            // --------------------------------------------------------------------------------
            assertFalse("the object is locked", ocm.isLocked("/test"));


            // --------------------------------------------------------------------------------
            // Lock & update
            // --------------------------------------------------------------------------------
            lock = ocm.lock("/test", true, false);
            assertTrue("the object is not locked", ocm.isLocked("/test"));
            lockable = (Lockable) ocm.getObject("/test");
            assertNotNull("Attribute lockowner is null", lockable.getLockOwner());
            lockable.setA1("new a1 Value");
            ocm.update(lockable);
            ocm.save();
            ocm.unlock("/test", lock.getLockToken());
           
           
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.