Package org.jboss.cache.optimistic

Examples of org.jboss.cache.optimistic.DataVersioningException


      else
      if (dataVersion != null && node.getVersion().newerThan(dataVersion)) // dataVersion *could* be null if the invalidate was triggered by removing a node that did not exist in the first place.
      {
         String errMsg = new StringBuilder("Node found, but version is not equal to or less than the expected [").append(dataVersion).append("].  Is [").append(node.getVersion()).append("] instead!").toString();
         log.warn(errMsg);
         throw new DataVersioningException(errMsg);
      }

      removeData(node, ctx);
      invalidateNode(node);
      node.setVersion(dataVersion);
View Full Code Here


   {
      NodeSPI n = ctx.lookUpNode(fqn);
      if (n != null && isVersioned() && n.getVersion().newerThan(dataVersion))
      {
         String errMsg = new StringBuilder("Node found, but version is not equal to or less than the expected [").append(dataVersion).append("].  Is [").append(n.getVersion()).append("] instead!").toString();
         throw new DataVersioningException(errMsg);
      }
      return n;
   }
View Full Code Here

         if (underlyingNode != null && underlyingNode != node)
         {
            String errormsg = new StringBuilder().append("Detected write skew on Fqn [").append(fqn).append("].  Another process has changed the node since we last read it!").toString();
            if (log.isWarnEnabled()) log.warn(errormsg + ".  Unable to copy node for update.");
            throw new DataVersioningException(errormsg);
         }
      }

      // make a backup copy
      backup = node;
View Full Code Here

            // if this is a newly created node then we expect the underlying node to be null.
            // also, if the node has been deleted in the WS and the underlying node is null, this *may* be ok ... will test again later when comparing versions
            // if not, we have a problem...
            if (underlyingNode == null && !workspaceNode.isCreated() && !workspaceNode.isRemoved())
            {
               throw new DataVersioningException("Underlying node for " + fqn + " is null, and this node wasn't newly created in this transaction!  We have a concurrent deletion event.");
            }

            // needs to have been created AND modified - we allow concurrent creation if no data is put into the node
            if (underlyingNode != null && underlyingNode.isValid() && workspaceNode.isCreated() && workspaceNode.isModified())
            {
               throw new DataVersioningException("Transaction attempted to create " + fqn + " anew.  It has already been created since this transaction started, by another (possibly remote) transaction.  We have a concurrent creation event.");
            }

            if (underlyingNode != null && !underlyingNode.isValid())
            {
               // we havea  tombstone
               if (!workspaceNode.isCreated() && !workspaceNode.isRemoved())
                  throw new DataVersioningException("Underlying node doesn't exist but a tombstone does; workspace node should be marked as created!");
               if (underlyingNode.getVersion().newerThan(workspaceNode.getVersion()))
               {
                  // we have an out of date node here
                  throw new DataVersioningException("Version mismatch for node " + fqn + ": underlying node with version " + workspaceNode.getNode().getVersion() + " is newer than workspace node, with version " + workspaceNode.getVersion());
               }
            }

            if (!workspaceNode.isCreated() && (workspaceNode.isRemoved() || workspaceNode.isModified()))
            {
               // if the real node is null, throw a DVE
               if (underlyingNode == null)
               {
                  // but not if the WSN has also been deleted
                  if (!workspaceNode.isRemoved())
                     throw new DataVersioningException("Unable to compare versions since the underlying node has been deleted by a concurrent transaction!");
                  else if (trace)
                     log.trace("The data node [" + fqn + "] is null, but this is ok since the workspace node is marked as deleted as well");
               }
               // if there is a DataVersion type mismatch here, leave it up to the DataVersion impl to barf if necessary.  - JBCACHE-962
               else if (underlyingNode.getVersion().newerThan(workspaceNode.getVersion()))
               {
                  // we have an out of date node here
                  throw new DataVersioningException("Version mismatch for node " + fqn + ": underlying node with version " + workspaceNode.getNode().getVersion() + " is newer than workspace node, with version " + workspaceNode.getVersion());
               }
            }
         }
         else
         {
View Full Code Here

         if (underlyingNode != null && underlyingNode != node)
         {
            String errormsg = new StringBuilder().append("Detected write skew on Fqn [").append(fqn).append("].  Another process has changed the node since we last read it!").toString();
            if (log.isWarnEnabled()) log.warn(errormsg + ".  Unable to copy node for update.");
            throw new DataVersioningException(errormsg);
         }
      }

      // make a backup copy
      backup = node;
View Full Code Here

               // if this is a newly created node then we expect the underlying node to be null.
               // also, if the node has been deleted in the WS and the underlying node is null, this *may* be ok ... will test again later when comparing versions
               // if not, we have a problem...
               if (realNode == null && !workspaceNode.isCreated() && !workspaceNode.isDeleted())
               {
                   throw new DataVersioningException("Real node for " + fqn + " is null, and this wasn't newly created in this tx!");
               }

              // needs to have been created AND modified - we allow concurrent creation if no data is put into the node
              if (realNode != null && workspaceNode.isCreated() && workspaceNode.isModified())
              {
                 throw new DataVersioningException("Tx attempted to create " + fqn + " anew.  It has already been created since this tx started by another (possibly remote) tx.");
              }

               if (!workspaceNode.isCreated() && (workspaceNode.isDeleted() || workspaceNode.isModified()))
               {
                  // if the real node is null, throw a DVE
                  if (realNode == null)
                  {
                     // but not if the WSN has also been deleted
                     if (!workspaceNode.isDeleted())
                        throw new DataVersioningException("Unable to compare versions since the underlying node has been deleted by a concurrent transaction!");
                     else
                        if (trace) log.trace("The data node ["+fqn+"] is null, but this is ok since the workspace node is marked as deleted as well");
                  }
                  else if (realNode.getVersion().newerThan( workspaceNode.getVersion() ))
                  {
                     // newerThan() will internally test if the DataVersion types being compared tally up, and will barf if
                     // necessary with an appropriate DataVersioningException.
                     // we have an out of date node here
                     throw new DataVersioningException("DataNode [" + fqn + "] version " + ((OptimisticTreeNode)workspaceNode.getNode()).getVersion() + " is newer than workspace node " + workspaceNode.getVersion());
                  }
               }
           }
           else
           {
View Full Code Here

            // if this is a newly created node then we expect the underlying node to be null.
            // also, if the node has been deleted in the WS and the underlying node is null, this *may* be ok ... will test again later when comparing versions
            // if not, we have a problem...
            if (underlyingNode == null && !workspaceNode.isCreated() && !workspaceNode.isDeleted())
            {
               throw new DataVersioningException("Underlying node for " + fqn + " is null, and this node wasn't newly created in this transaction!  We have a concurrent deletion event.");
            }

            // needs to have been created AND modified - we allow concurrent creation if no data is put into the node
            if (underlyingNode != null && underlyingNode.isValid() && workspaceNode.isCreated() && workspaceNode.isModified())
            {
               throw new DataVersioningException("Transaction attempted to create " + fqn + " anew.  It has already been created since this transaction started, by another (possibly remote) transaction.  We have a concurrent creation event.");
            }

            if (underlyingNode != null && !underlyingNode.isValid())
            {
               // we havea  tombstone
               if (!workspaceNode.isCreated() && !workspaceNode.isDeleted())
                  throw new DataVersioningException("Underlying node doesn't exist but a tombstone does; workspace node should be marked as created!");
               if (underlyingNode.getVersion().newerThan(workspaceNode.getVersion()))
               {
                  // we have an out of date node here
                  throw new DataVersioningException("Version mismatch for node " + fqn + ": underlying node with version " + workspaceNode.getNode().getVersion() + " is newer than workspace node, with version " + workspaceNode.getVersion());
               }
            }

            if (!workspaceNode.isCreated() && (workspaceNode.isDeleted() || workspaceNode.isModified()))
            {
               // if the real node is null, throw a DVE
               if (underlyingNode == null)
               {
                  // but not if the WSN has also been deleted
                  if (!workspaceNode.isDeleted())
                     throw new DataVersioningException("Unable to compare versions since the underlying node has been deleted by a concurrent transaction!");
                  else if (trace)
                     log.trace("The data node [" + fqn + "] is null, but this is ok since the workspace node is marked as deleted as well");
               }
               // if there is a DataVersion type mismatch here, leave it up to the DataVersion impl to barf if necessary.  - JBCACHE-962
               else if (underlyingNode.getVersion().newerThan(workspaceNode.getVersion()))
               {
                  // we have an out of date node here
                  throw new DataVersioningException("Version mismatch for node " + fqn + ": underlying node with version " + workspaceNode.getNode().getVersion() + " is newer than workspace node, with version " + workspaceNode.getVersion());
               }
            }
         }
         else
         {
View Full Code Here

            // if this is a newly created node then we expect the underlying node to be null.
            // also, if the node has been deleted in the WS and the underlying node is null, this *may* be ok ... will test again later when comparing versions
            // if not, we have a problem...
            if (underlyingNode == null && !workspaceNode.isCreated() && !workspaceNode.isDeleted())
            {
               throw new DataVersioningException("Underlying node for " + fqn + " is null, and this node wasn't newly created in this transaction!  We have a concurrent deletion event.");
            }

            // needs to have been created AND modified - we allow concurrent creation if no data is put into the node
            if (underlyingNode != null && underlyingNode.isValid() && workspaceNode.isCreated() && workspaceNode.isModified())
            {
               throw new DataVersioningException("Transaction attempted to create " + fqn + " anew.  It has already been created since this transaction started, by another (possibly remote) transaction.  We have a concurrent creation event.");
            }

            if (underlyingNode != null && !underlyingNode.isValid())
            {
               // we havea  tombstone
               if (!workspaceNode.isCreated() && !workspaceNode.isDeleted())
                  throw new DataVersioningException("Underlying node doesn't exist but a tombstone does; workspace node should be marked as created!");
               if (underlyingNode.getVersion().newerThan(workspaceNode.getVersion()))
               {
                  // we have an out of date node here
                  throw new DataVersioningException("Version mismatch for node " + fqn + ": underlying node with version " + workspaceNode.getNode().getVersion() + " is newer than workspace node, with version " + workspaceNode.getVersion());
               }
            }

            if (!workspaceNode.isCreated() && (workspaceNode.isDeleted() || workspaceNode.isModified()))
            {
               // if the real node is null, throw a DVE
               if (underlyingNode == null)
               {
                  // but not if the WSN has also been deleted
                  if (!workspaceNode.isDeleted())
                     throw new DataVersioningException("Unable to compare versions since the underlying node has been deleted by a concurrent transaction!");
                  else if (trace)
                     log.trace("The data node [" + fqn + "] is null, but this is ok since the workspace node is marked as deleted as well");
               }
               // if there is a DataVersion type mismatch here, leave it up to the DataVersion impl to barf if necessary.  - JBCACHE-962
               else if (underlyingNode.getVersion().newerThan(workspaceNode.getVersion()))
               {
                  // we have an out of date node here
                  throw new DataVersioningException("Version mismatch for node " + fqn + ": underlying node with version " + workspaceNode.getNode().getVersion() + " is newer than workspace node, with version " + workspaceNode.getVersion());
               }
            }
         }
         else
         {
View Full Code Here

TOP

Related Classes of org.jboss.cache.optimistic.DataVersioningException

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.