Package org.jboss.cache.lock

Examples of org.jboss.cache.lock.IdentityLock


    * @param lockChildren <code>true</code> if this method should be recursively
    *                     applied to <code>node</code>'s children.
    */
   protected void forceAcquireLock(DataNode node, Object newOwner, boolean lockChildren)
   {
      IdentityLock lock = node.getLock();
      boolean acquired = lock.isOwner(newOwner);

      if (!acquired && log.isDebugEnabled())
         log.debug("Force acquiring lock on node " + node.getFqn());

      while (!acquired)
      {
         Object curOwner = null;
         boolean attempted = false;

         // Keep breaking write locks until we acquire a read lock
         // or there are no more write locks
         while (!acquired && ((curOwner = lock.getWriterOwner()) != null))
         {
            acquired = acquireLockFromOwner(node, lock, curOwner, newOwner);
            attempted = true;
         }

         // If no more write locks, but we haven't acquired, see if we
         // need to break read locks as well
         if (!acquired && isolationLevel == IsolationLevel.SERIALIZABLE)
         {
            Iterator it = lock.getReaderOwners().iterator();
            if (it.hasNext())
            {
               curOwner = it.next();
               acquired = acquireLockFromOwner(node, lock, it.next(), newOwner);
               attempted = true;
View Full Code Here


    * @param lockChildren <code>true</code> if this method should be recursively
    *                     applied to <code>node</code>'s children.
    */
   protected void forceAcquireLock(DataNode node, Object newOwner, boolean lockChildren)
   {
      IdentityLock lock = node.getLock();
      boolean acquired = lock.isOwner(newOwner);

      if (!acquired && log.isDebugEnabled())
         log.debug("Force acquiring lock on node " + node.getFqn());

      while (!acquired)
      {
         Object curOwner = null;
         boolean attempted = false;

         // Keep breaking write locks until we acquire a read lock
         // or there are no more write locks
         while (!acquired && ((curOwner = lock.getWriterOwner()) != null))
         {
            acquired = acquireLockFromOwner(node, lock, curOwner, newOwner);
            attempted = true;
         }

         // If no more write locks, but we haven't acquired, see if we
         // need to break read locks as well
         if (!acquired && isolationLevel == IsolationLevel.SERIALIZABLE)
         {
            Iterator it = lock.getReaderOwners().iterator();
            if (it.hasNext())
            {
               curOwner = it.next();
               acquired = acquireLockFromOwner(node, lock, it.next(), newOwner);
               attempted = true;
View Full Code Here

   private void removeLocksForDeadMembers(DataNode node,
                                          Vector deadMembers)
   {
      Set deadOwners = new HashSet();
      IdentityLock lock = node.getLock();
      Object owner = lock.getWriterOwner();

      if (isLockOwnerDead(owner, deadMembers))
      {
         deadOwners.add(owner);
      }

      Iterator iter = lock.getReaderOwners().iterator();
      while (iter.hasNext())
      {
         owner = iter.next();
         if (isLockOwnerDead(owner, deadMembers))
         {
View Full Code Here

    * @param lockChildren <code>true</code> if this method should be recursively
    *                     applied to <code>node</code>'s children.
    */
   protected void forceAcquireLock(DataNode node, Object newOwner, boolean lockChildren)
   {
      IdentityLock lock = node.getLock();
      boolean acquired = lock.isOwner(newOwner);

      if (!acquired && log.isDebugEnabled())
         log.debug("Force acquiring lock on node " + node.getFqn());

      while (!acquired)
      {
         Object curOwner = null;
         boolean attempted = false;

         // Keep breaking write locks until we acquire a read lock
         // or there are no more write locks
         while (!acquired && ((curOwner = lock.getWriterOwner()) != null))
         {
            acquired = acquireLockFromOwner(node, lock, curOwner, newOwner);
            attempted = true;
         }

         // If no more write locks, but we haven't acquired, see if we
         // need to break read locks as well
         if (!acquired && isolationLevel == IsolationLevel.SERIALIZABLE)
         {
            Iterator it = lock.getReaderOwners().iterator();
            if (it.hasNext())
            {
               curOwner = it.next();
               acquired = acquireLockFromOwner(node, lock, it.next(), newOwner);
               attempted = true;
View Full Code Here

   private void removeLocksForDeadMembers(DataNode node,
                                          Vector deadMembers)
   {
      Set deadOwners = new HashSet();
      IdentityLock lock = node.getLock();
      Object owner = lock.getWriterOwner();

      if (isLockOwnerDead(owner, deadMembers))
      {
         deadOwners.add(owner);
      }

      Iterator iter = lock.getReaderOwners().iterator();
      while (iter.hasNext())
      {
         owner = iter.next();
         if (isLockOwnerDead(owner, deadMembers))
         {
View Full Code Here

   }

   private synchronized void initLock()
   {
      if (lock_ == null)
         lock_ = new IdentityLock(cache, fqn);
   }
View Full Code Here

TOP

Related Classes of org.jboss.cache.lock.IdentityLock

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.