Package org.jboss.cache.optimistic

Examples of org.jboss.cache.optimistic.DefaultDataVersion


      NodeSPI observerNode = (NodeSPI) observer.getRoot().getChild(parent);
      assert observerNode == null : "Should be removed";

      // now try a put on a with a newer data version; should work
      modifier.getInvocationContext().getOptionOverrides().setDataVersion(new DefaultDataVersion(1));
      try
      {
         modifier.put(parent, K, V);
         assert false : "Should have barfed!";
      }
View Full Code Here


   }

   @SuppressWarnings("deprecation")
   protected DefaultDataVersion unmarshallDefaultDataVersion(ObjectInputStream in) throws Exception
   {
      return new DefaultDataVersion(readUnsignedLong(in));
   }
View Full Code Here

            if (trace) log.trace("Fqn " + f + " not found in workspace; not using a data version.");
            return null;
         }
         if (n.isVersioningImplicit())
         {
            DefaultDataVersion v = (DefaultDataVersion) n.getVersion();
            if (trace)
               log.trace("Fqn " + f + " has implicit versioning.  Broadcasting an incremented version.");

            // potential bug here - need to check if we *need* to increment at all, because of Configuration.isLockParentForChildInsertRemove()
            return v.increment();
         }
         else
         {
            if (trace) log.trace("Fqn " + f + " has explicit versioning.  Broadcasting the version as-is.");
            return n.getVersion();
View Full Code Here

      cache[0].put(fqn, key, "value"); // TestVersion-99 should be on both caches now

      TransactionManager mgr = cache[0].getTransactionManager();
      mgr.begin();

      DataVersion version = new DefaultDataVersion(300);
      option.setDataVersion(version);
      cache[1].put(fqn, key, "value2", option);
      mgr.commit();
   }
View Full Code Here

    *
    * @throws Exception
    */
   public void testCompatibleVersionTypesOutDatedVersion2() throws Exception
   {
      DataVersion version = new DefaultDataVersion(200);
      option.setDataVersion(version);
      cache[0].put(fqn, key, "value", option); // TestVersion-99 should be on both caches now

      TransactionManager mgr = cache[0].getTransactionManager();
      mgr.begin();

      version = new DefaultDataVersion(100);
      option.setDataVersion(version);
      cache[1].put(fqn, key, "value2", option);
      try
      {
         // this call will use implicit versioning and will hence fail.
View Full Code Here

      }
   }

   public void testPropagationOfDefaultVersions() throws Exception
   {
      DefaultDataVersion expected = new DefaultDataVersion();
      expected = (DefaultDataVersion) expected.increment();

      cache[0].put(fqn, key, "value");

      assertEquals("value", cache[0].get(fqn, key));
      assertEquals("value", cache[1].get(fqn, key));
      assertEquals(expected, ((OptimisticTreeNode) cache[0].get(fqn)).getVersion());
      assertEquals(expected, ((OptimisticTreeNode) cache[1].get(fqn)).getVersion());

      cache[1].put(fqn, key, "value2");
      expected = (DefaultDataVersion) expected.increment();

      assertEquals("value2", cache[0].get(fqn, key));
      assertEquals("value2", cache[1].get(fqn, key));
      assertEquals(expected, ((OptimisticTreeNode) cache[0].get(fqn)).getVersion());
      assertEquals(expected, ((OptimisticTreeNode) cache[1].get(fqn)).getVersion());
View Full Code Here

        DataVersion version = new TestVersion("99");
        option.setDataVersion(version);
        cache.put(fqn, key, "value", option);
        TransactionManager mgr = cache.getTransactionManager();
        mgr.begin();
        option.setDataVersion(new DefaultDataVersion(777));
        cache.put(fqn, key, "value2", option);
        try
        {
            // this call will use implicit versioning and will hence fail.
            mgr.commit();
View Full Code Here

         if (log.isTraceEnabled()) log.trace("Fqn " + f + " not found in workspace; not using a data version.");
         return null;
      }
      if (n.isVersioningImplicit())
      {
         DefaultDataVersion v = (DefaultDataVersion) n.getVersion();
         if (log.isTraceEnabled()) log.trace("Fqn " + f + " has implicit versioning.  Broadcasting an incremented version.");
         return v.increment();
      }
      else
      {
         if (log.isTraceEnabled()) log.trace("Fqn " + f + " has explicit versioning.  Broadcasting the version as-is.");
         return n.getVersion();
View Full Code Here

   }

   @SuppressWarnings("deprecation")
   protected DefaultDataVersion unmarshallDefaultDataVersion(ObjectInputStream in) throws Exception
   {
      return new DefaultDataVersion(readUnsignedLong(in));
   }
View Full Code Here

      NodeSPI observerNode = (NodeSPI) observer.getRoot().getChild(parent);
      assert observerNode == null : "Should be removed";

      // now try a put on a with a newer data version; should work
      modifier.getInvocationContext().getOptionOverrides().setDataVersion(new DefaultDataVersion(10));
      modifier.put(parent, K, V);

      NodeSPI modifierNode = (NodeSPI) modifier.getRoot().getChild(parent);
      assert modifierNode != null : "Should not be null";
      assert modifierNode.isValid() : "No longer a tombstone";
View Full Code Here

TOP

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

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.