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


      writeUnsignedLong(out, ddv.getRawVersion());
   }

   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

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

      // Actually, it shouldn't have been invalidated, should be null
      // But, this assertion will pass if it is null, and we want
      assertHasBeenInvalidated(cache1.getNode(fqn), "Should have been invalidated");
      assertNull("Should be null", cache2.getNode(fqn));

      cache1.getInvocationContext().getOptionOverrides().setDataVersion(new DefaultDataVersion());
      cache1.put(fqn, "key", "value");

      assertEquals("value", cache1.getNode(fqn).get("key"));
      assertHasBeenInvalidated(cache2.getNode(fqn), "Should have been invalidated");
   }
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);
      cache[1].getInvocationContext().getOptionOverrides().setDataVersion(version);
      cache[1].put(fqn, key, "value2");
      mgr.commit();
   }
View Full Code Here

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

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

      version = new DefaultDataVersion(100);
      cache[1].getInvocationContext().getOptionOverrides().setDataVersion(version);
      cache[1].put(fqn, key, "value2");
      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, ((NodeSPI) cache[0].getNode(fqn)).getVersion());
      assertEquals(expected, ((NodeSPI) cache[1].getNode(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, ((NodeSPI) cache[0].getNode(fqn)).getVersion());
      assertEquals(expected, ((NodeSPI) cache[1].getNode(fqn)).getVersion());
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

      writeUnsignedLong(out, ddv.getRawVersion());
   }

   protected DefaultDataVersion unmarshallDefaultDataVersion(ObjectInputStream in) throws Exception
   {
      return new DefaultDataVersion(readUnsignedLong(in));
   }
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.