Package org.jboss.cache.optimistic

Examples of org.jboss.cache.optimistic.DataVersion


    *
    * @throws Exception
    */
   public void testCompatibleVersionTypes1() throws Exception
   {
      DataVersion version = new TestVersion("99");
      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();
View Full Code Here


    *
    * @throws Exception
    */
   public void testCompatibleVersionTypesOutDatedVersion1() throws Exception
   {
      DataVersion version = new TestVersion("99");
      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();
View Full Code Here

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

      // explicitly set data version
      DataVersion version = new TestVersion("99");
      cache[1].getInvocationContext().getOptionOverrides().setDataVersion(version);

      try
      {
         cache[1].put(fqn, key, "value2");
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();
View Full Code Here

  public void writeUpdate(Object key, Object value, Object currentVersion, Object previousVersion) {
    try {
            ensureRegionRootExists();
           
      Option option = new Option();
      DataVersion dv = ( source != null && source.isVersioned() )
                       ? new DataVersionAdapter( currentVersion, previousVersion, source.getVersionComparator(), source.toString() )
                       : NonLockingDataVersion.INSTANCE;
      option.setDataVersion( dv );
      if (localOnlyQueries && key instanceof QueryKey)
               option.setCacheModeLocal(true);
View Full Code Here

  @SuppressWarnings("unchecked")
    public void writeLoad(Object key, Object value, Object currentVersion) {
     Transaction tx = null;
     try {
        Option option = new Option();
        DataVersion dv = ( source != null && source.isVersioned() )
                             ? new DataVersionAdapter( currentVersion, currentVersion, source.getVersionComparator(), source.toString() )
                             : NonLockingDataVersion.INSTANCE;
        option.setDataVersion( dv );

        if (forTimestamps)
View Full Code Here

      Node toReturn = findInternal(fqn, false);

      if (toReturn != null && version != null)
      {
         // we need to check the version of the data node...
         DataVersion nodeVersion = ((OptimisticTreeNode) toReturn).getVersion();
         if (log.isDebugEnabled())
            log.debug("looking for optimistic node [" + fqn + "] with version [" + version + "].  My version is [" + nodeVersion + "]");
         if (nodeVersion.newerThan(version))
         {
            // we have a versioning problem; throw an exception!
            throw new CacheException("Unable to validate versions.");
         }
View Full Code Here

         {
            // use explicit versioning
            if (ctx.getOptionOverrides() != null && ctx.getOptionOverrides().getDataVersion() != null)
            {
               workspace.setVersioningImplicit(false);
               DataVersion version = ctx.getOptionOverrides().getDataVersion();

               workspaceNode.setVersion(version);
               if (log.isTraceEnabled()) log.trace("Setting versioning for node " + workspaceNode.getFqn() + " to explicit");
               workspaceNode.setVersioningImplicit(false);
            }
View Full Code Here

   }

   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

TOP

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

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.