Examples of DataVersion


Examples of org.jboss.cache.optimistic.DataVersion

//            }
           
            regionRoot = jbcCache.getRoot().getChild( regionFqn );
            if (regionRoot == null || !regionRoot.isValid()) {
               // Establish the region root node with a non-locking data version
               DataVersion version = optimistic ? NonLockingDataVersion.INSTANCE : null;
               regionRoot = CacheHelper.addNode(jbcCache, regionFqn, true, true, version);
            }
            else if (optimistic && regionRoot instanceof NodeSPI) {
                // FIXME Hacky workaround to JBCACHE-1202
                if ( !( ( ( NodeSPI ) regionRoot ).getVersion() instanceof NonLockingDataVersion ) ) {
View Full Code Here

Examples of org.jboss.cache.optimistic.DataVersion

                 // Make sure the root node for the region exists and
                 // has a DataVersion that never complains
                 newRoot = jbcCache.getRoot().getChild( regionFqn );
                 if (newRoot == null || !newRoot.isValid()) {               
                     // Establish the region root node with a non-locking data version
                     DataVersion version = optimistic ? NonLockingDataVersion.INSTANCE : null;
                     newRoot = CacheHelper.addNode(jbcCache, regionFqn, true, true, version);   
                 }
                 else if (newRoot instanceof NodeSPI) {
                     // FIXME Hacky workaround to JBCACHE-1202
                     if ( !( ( ( NodeSPI ) newRoot ).getVersion() instanceof NonLockingDataVersion ) ) {
View Full Code Here

Examples of org.jboss.cache.optimistic.DataVersion

    {
       synchronized (currentView) {
          Transaction tx = suspend();
          try {
             for (Object member : currentView) {
                DataVersion version = optimistic ? NonLockingDataVersion.INSTANCE : null;
                Fqn f = Fqn.fromRelativeElements(internalFqn, member);
                CacheHelper.addNode(jbcCache, f, true, false, version);
             }
          }
          finally {
View Full Code Here

Examples of org.jboss.cache.optimistic.DataVersion

   }

   public void writeUpdate(Object key, Object value, Object currentVersion, Object previousVersion) {
      try {
         Option option = new Option();
         DataVersion dv = ( source != null && source.isVersioned() )
         ? new DataVersionAdapter( currentVersion, previousVersion, source.getVersionComparator(), source.toString() )
         : NonLockingDataVersion.INSTANCE;
         option.setDataVersion( dv );
         option.setCacheModeLocal(queryCacheLocalWritesOnly);
         cache.put( new Fqn( regionFqn, key ), ITEM, value, option );
View Full Code Here

Examples of org.jboss.cache.optimistic.DataVersion

         option.setCacheModeLocal(queryCacheLocalWritesOnly || localPutsOnly);
         cache.remove( new Fqn( regionFqn, key ), "ITEM", option );

         option = new Option();
         option.setFailSilently( true );
         DataVersion dv = ( source != null && source.isVersioned() )
         ? new DataVersionAdapter( currentVersion, currentVersion, source.getVersionComparator(), source.toString() )
         : NonLockingDataVersion.INSTANCE;
         option.setDataVersion( dv );
         option.setCacheModeLocal(queryCacheLocalWritesOnly || localPutsOnly);
         cache.put( new Fqn( regionFqn, key ), ITEM, value, option );
View Full Code Here

Examples of org.jboss.cache.optimistic.DataVersion

      }
   }

   public void testSimplePut() throws Exception
   {
      DataVersion version = new TestVersion("99");
      cache.getInvocationContext().getOptionOverrides().setDataVersion(version);
      cache.put(fqn, key, "value");

      //now retrieve the data from the cache.
      assertEquals("value", cache.get(fqn, key));

      // get a hold of the node
      NodeSPI<String, String> node = cache.getNode(fqn);
      DataVersion versionFromCache = node.getVersion();

      assertEquals(TestVersion.class, versionFromCache.getClass());
      assertEquals("99", ((TestVersion) versionFromCache).getInternalVersion());
   }
View Full Code Here

Examples of org.jboss.cache.optimistic.DataVersion

      assertEquals("99", ((TestVersion) versionFromCache).getInternalVersion());
   }

   public void testFailingPut() throws Exception
   {
      DataVersion version = new TestVersion("99");
      cache.getInvocationContext().getOptionOverrides().setDataVersion(version);
      cache.put(fqn, key, "value");

      version = new TestVersion("25");
      cache.getInvocationContext().getOptionOverrides().setDataVersion(version);
View Full Code Here

Examples of org.jboss.cache.optimistic.DataVersion

      }
   }

   public void testIncompatibleVersionTypes() throws Exception
   {
      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));
View Full Code Here

Examples of org.jboss.cache.optimistic.DataVersion

  }

  public void writeUpdate(Object key, Object value, Object currentVersion, Object previousVersion) {
    try {
      Option option = new Option();
      DataVersion dv = ( source != null && source.isVersioned() )
                       ? new DataVersionAdapter( currentVersion, previousVersion, source.getVersionComparator(), source.toString() )
                       : NonLockingDataVersion.INSTANCE;
      option.setDataVersion( dv );
      cache.put( new Fqn( regionFqn, key ), ITEM, value, option );
    }
View Full Code Here

Examples of org.jboss.cache.optimistic.DataVersion

      option.setDataVersion( NonLockingDataVersion.INSTANCE );
      cache.remove( new Fqn( regionFqn, key ), "ITEM", option );

      option = new Option();
      option.setFailSilently( true );
      DataVersion dv = ( source != null && source.isVersioned() )
                       ? new DataVersionAdapter( currentVersion, currentVersion, source.getVersionComparator(), source.toString() )
                       : NonLockingDataVersion.INSTANCE;
      option.setDataVersion( dv );
      cache.put( new Fqn( regionFqn, key ), ITEM, value, option );
    }
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.