[jbosscache-commits] JBoss Cache SVN: r6948 - in core/branches/flat/src: main/java/org/jboss/starobrno/marshall and 3 other directories.

jbosscache-commits at lists.jboss.org jbosscache-commits at lists.jboss.org
Tue Oct 14 13:54:06 EDT 2008


Author: mircea.markus
Date: 2008-10-14 13:54:06 -0400 (Tue, 14 Oct 2008)
New Revision: 6948

Removed:
   core/branches/flat/src/main/java/org/jboss/starobrno/marshall/MarshalledValue2.java
   core/branches/flat/src/main/java/org/jboss/starobrno/marshall/MarshalledValueHelper2.java
Modified:
   core/branches/flat/src/main/java/org/jboss/starobrno/interceptors/MarshalledValueInterceptor.java
   core/branches/flat/src/main/java/org/jboss/starobrno/marshall/CacheMarshallerStarobrno.java
   core/branches/flat/src/main/java/org/jboss/starobrno/marshall/MarshalledValueMap.java
   core/branches/flat/src/test/java/org/jboss/starobrno/BasicTest.java
   core/branches/flat/src/test/java/org/jboss/starobrno/api/mvcc/LockAssert.java
   core/branches/flat/src/test/java/org/jboss/starobrno/api/mvcc/LockTestBase.java
   core/branches/flat/src/test/java/org/jboss/starobrno/lock/LockContainerHashingTest.java
Log:
added support for replication

Modified: core/branches/flat/src/main/java/org/jboss/starobrno/interceptors/MarshalledValueInterceptor.java
===================================================================
--- core/branches/flat/src/main/java/org/jboss/starobrno/interceptors/MarshalledValueInterceptor.java	2008-10-14 17:50:19 UTC (rev 6947)
+++ core/branches/flat/src/main/java/org/jboss/starobrno/interceptors/MarshalledValueInterceptor.java	2008-10-14 17:54:06 UTC (rev 6948)
@@ -27,9 +27,9 @@
 import org.jboss.starobrno.commands.write.RemoveCommand;
 import org.jboss.starobrno.context.InvocationContext;
 import org.jboss.starobrno.interceptors.base.CommandInterceptor;
-import org.jboss.starobrno.marshall.MarshalledValue2;
-import org.jboss.starobrno.marshall.MarshalledValueHelper2;
-//import org.jboss.starobrno.marshall.MarshalledValueHelper2;
+import org.jboss.starobrno.marshall.MarshalledValue;
+import org.jboss.starobrno.marshall.MarshalledValueHelper;
+//import org.jboss.starobrno.marshall.MarshalledValueHelper;
 
 import java.io.IOException;
 import java.io.NotSerializableException;
@@ -40,14 +40,14 @@
 import java.util.Set;
 
 /**
- * Interceptor that handles the wrapping and unwrapping of cached data using {@link org.jboss.starobrno.marshall.MarshalledValue2}s.
+ * Interceptor that handles the wrapping and unwrapping of cached data using {@link org.jboss.starobrno.marshall.MarshalledValue}s.
  * Known "excluded" types are not wrapped/unwrapped, which at this time include {@link String}, Java primitives
  * and their Object wrappers, as well as arrays of excluded types.
  * <p/>
- * The {@link org.jboss.starobrno.marshall.MarshalledValue2} wrapper handles lazy deserialization from byte array representations.
+ * The {@link org.jboss.starobrno.marshall.MarshalledValue} wrapper handles lazy deserialization from byte array representations.
  *
  * @author Manik Surtani (<a href="mailto:manik at jboss.org">manik at jboss.org</a>)
- * @see org.jboss.starobrno.marshall.MarshalledValue2
+ * @see org.jboss.starobrno.marshall.MarshalledValue
  * @since 2.1.0
  */
 public class MarshalledValueInterceptor extends CommandInterceptor
@@ -55,7 +55,7 @@
    @Override
    public Object visitPutMapCommand(InvocationContext ctx, PutMapCommand command) throws Throwable
    {
-      Set<MarshalledValue2> marshalledValues = new HashSet<MarshalledValue2>();
+      Set<MarshalledValue> marshalledValues = new HashSet<MarshalledValue>();
 
       command.setMap(wrapMap(command.getMap(), marshalledValues, ctx));
       Object retVal = invokeNextInterceptor(ctx, command);
@@ -65,13 +65,13 @@
    @Override
    public Object visitPutKeyValueCommand(InvocationContext ctx, PutKeyValueCommand command) throws Throwable
    {
-      Set<MarshalledValue2> marshalledValues = new HashSet<MarshalledValue2>();
-      if (!MarshalledValueHelper2.isTypeExcluded(command.getKey().getClass()))
+      Set<MarshalledValue> marshalledValues = new HashSet<MarshalledValue>();
+      if (!MarshalledValueHelper.isTypeExcluded(command.getKey().getClass()))
       {
          Object newKey = createAndAddMarshalledValue(command.getKey(), marshalledValues, ctx);
          command.setKey(newKey);
       }
-      if (!MarshalledValueHelper2.isTypeExcluded(command.getValue().getClass()))
+      if (!MarshalledValueHelper.isTypeExcluded(command.getValue().getClass()))
       {
          Object value = createAndAddMarshalledValue(command.getValue(), marshalledValues, ctx);
          command.setValue(value);
@@ -83,8 +83,8 @@
    @Override
    public Object visitRemoveCommand(InvocationContext ctx, RemoveCommand command) throws Throwable
    {
-      Set<MarshalledValue2> marshalledValues = new HashSet<MarshalledValue2>();
-      if (!MarshalledValueHelper2.isTypeExcluded(command.getKey().getClass()))
+      Set<MarshalledValue> marshalledValues = new HashSet<MarshalledValue>();
+      if (!MarshalledValueHelper.isTypeExcluded(command.getKey().getClass()))
       {
          Object value = createAndAddMarshalledValue(command.getKey(), marshalledValues, ctx);
          command.setKey(value);
@@ -96,8 +96,8 @@
    @Override
    public Object visitGetKeyValueCommand(InvocationContext ctx, GetKeyValueCommand command) throws Throwable
    {
-      Set<MarshalledValue2> marshalledValues = new HashSet<MarshalledValue2>();
-      if (!MarshalledValueHelper2.isTypeExcluded(command.getKey().getClass()))
+      Set<MarshalledValue> marshalledValues = new HashSet<MarshalledValue>();
+      if (!MarshalledValueHelper.isTypeExcluded(command.getKey().getClass()))
       {
          Object value = createAndAddMarshalledValue(command.getKey(), marshalledValues, ctx);
          command.setKey(value);
@@ -106,11 +106,11 @@
       return compactAndProcessRetVal(marshalledValues, retVal);
    }
 
-   private Object compactAndProcessRetVal(Set<MarshalledValue2> marshalledValues, Object retVal)
+   private Object compactAndProcessRetVal(Set<MarshalledValue> marshalledValues, Object retVal)
          throws IOException, ClassNotFoundException
    {
       if (trace) log.trace("Compacting MarshalledValues created");
-      for (MarshalledValue2 mv : marshalledValues) mv.compact(false, false);
+      for (MarshalledValue mv : marshalledValues) mv.compact(false, false);
 
       return processRetVal(retVal);
    }
@@ -118,16 +118,16 @@
    private Object processRetVal(Object retVal)
          throws IOException, ClassNotFoundException
    {
-      if (retVal instanceof MarshalledValue2)
+      if (retVal instanceof MarshalledValue)
       {
-         if (trace) log.trace("Return value is a MarshalledValue2.  Unwrapping.");
-         retVal = ((MarshalledValue2) retVal).get();
+         if (trace) log.trace("Return value is a MarshalledValue.  Unwrapping.");
+         retVal = ((MarshalledValue) retVal).get();
       }
       return retVal;
    }
 
    @SuppressWarnings("unchecked")
-   protected Map wrapMap(Map<Object, Object> m, Set<MarshalledValue2> marshalledValues, InvocationContext ctx) throws NotSerializableException
+   protected Map wrapMap(Map<Object, Object> m, Set<MarshalledValue> marshalledValues, InvocationContext ctx) throws NotSerializableException
    {
       if (m == null)
       {
@@ -140,15 +140,15 @@
       {
          Object key = me.getKey();
          Object value = me.getValue();
-         copy.put((key == null || MarshalledValueHelper2.isTypeExcluded(key.getClass())) ? key : createAndAddMarshalledValue(key, marshalledValues, ctx),
-               (value == null || MarshalledValueHelper2.isTypeExcluded(value.getClass())) ? value : createAndAddMarshalledValue(value, marshalledValues, ctx));
+         copy.put((key == null || MarshalledValueHelper.isTypeExcluded(key.getClass())) ? key : createAndAddMarshalledValue(key, marshalledValues, ctx),
+               (value == null || MarshalledValueHelper.isTypeExcluded(value.getClass())) ? value : createAndAddMarshalledValue(value, marshalledValues, ctx));
       }
       return copy;
    }
 
-   protected MarshalledValue2 createAndAddMarshalledValue(Object toWrap, Set<MarshalledValue2> marshalledValues, InvocationContext ctx) throws NotSerializableException
+   protected MarshalledValue createAndAddMarshalledValue(Object toWrap, Set<MarshalledValue> marshalledValues, InvocationContext ctx) throws NotSerializableException
    {
-      MarshalledValue2 mv = new MarshalledValue2(toWrap);
+      MarshalledValue mv = new MarshalledValue(toWrap);
       marshalledValues.add(mv);
       if (!ctx.isOriginLocal()) mv.setEqualityPreferenceForInstance(false);
       return mv;

Modified: core/branches/flat/src/main/java/org/jboss/starobrno/marshall/CacheMarshallerStarobrno.java
===================================================================
--- core/branches/flat/src/main/java/org/jboss/starobrno/marshall/CacheMarshallerStarobrno.java	2008-10-14 17:50:19 UTC (rev 6947)
+++ core/branches/flat/src/main/java/org/jboss/starobrno/marshall/CacheMarshallerStarobrno.java	2008-10-14 17:54:06 UTC (rev 6948)
@@ -243,7 +243,7 @@
             if (useRefs) refMap.putReferencedObject(reference, retVal);
             return retVal;
          case MAGICNUMBER_MARSHALLEDVALUE:
-            MarshalledValue2 mv = new MarshalledValue2();
+            MarshalledValue mv = new MarshalledValue();
             mv.readExternal(in);
             return mv;
          case MAGICNUMBER_METHODCALL:

Deleted: core/branches/flat/src/main/java/org/jboss/starobrno/marshall/MarshalledValue2.java
===================================================================
--- core/branches/flat/src/main/java/org/jboss/starobrno/marshall/MarshalledValue2.java	2008-10-14 17:50:19 UTC (rev 6947)
+++ core/branches/flat/src/main/java/org/jboss/starobrno/marshall/MarshalledValue2.java	2008-10-14 17:54:06 UTC (rev 6948)
@@ -1,229 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source.
- * Copyright 2000 - 2008, Red Hat Middleware LLC, and individual contributors
- * as indicated by the @author tags. See the copyright.txt file in the
- * distribution for a full listing of individual contributors.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
-package org.jboss.starobrno.marshall;
-
-import org.jboss.starobrno.CacheException;
-import org.jboss.util.stream.MarshalledValueInputStream;
-
-import java.io.ByteArrayInputStream;
-import java.io.ByteArrayOutputStream;
-import java.io.Externalizable;
-import java.io.IOException;
-import java.io.NotSerializableException;
-import java.io.ObjectInput;
-import java.io.ObjectInputStream;
-import java.io.ObjectOutput;
-import java.io.ObjectOutputStream;
-import java.io.Serializable;
-import java.util.Arrays;
-
-/**
- * Wrapper that wraps cached data, providing lazy deserialization using the calling thread's context class loader.
- * <p/>
- * The {@link org.jboss.cache.interceptors.MarshalledValueInterceptor} handles transparent
- * wrapping/unwrapping of cached data.
- * <p/>
- *
- * @author Manik Surtani (<a href="mailto:manik at jboss.org">manik at jboss.org</a>)
- * @see org.jboss.cache.interceptors.MarshalledValueInterceptor
- * @since 2.1.0
- */
-public class MarshalledValue2 implements Externalizable
-{
-   protected Object instance;
-   protected byte[] raw;
-   private int cachedHashCode = 0;
-   // by default equals() will test on the istance rather than the byte array if conversion is required.
-   private transient boolean equalityPreferenceForInstance = true;
-
-   public MarshalledValue2(Object instance) throws NotSerializableException
-   {
-      if (instance == null) throw new NullPointerException("Null values cannot be wrapped as MarshalledValues!");
-
-      if (instance instanceof Serializable)
-         this.instance = instance;
-      else
-         throw new NotSerializableException("Marshalled values can only wrap Objects that are serializable!  Instance of " + instance.getClass() + " won't Serialize.");
-   }
-
-   public MarshalledValue2()
-   {
-      // empty ctor for serialization
-   }
-
-   public void setEqualityPreferenceForInstance(boolean equalityPreferenceForInstance)
-   {
-      this.equalityPreferenceForInstance = equalityPreferenceForInstance;
-   }
-
-   public synchronized void serialize()
-   {
-      if (raw == null)
-      {
-         try
-         {
-            ByteArrayOutputStream baos = new ByteArrayOutputStream();
-            ObjectOutputStream oos = new ObjectOutputStream(baos);
-            oos.writeObject(instance);
-            oos.close();
-            baos.close();
-            // Do NOT set instance to null over here, since it may be used elsewhere (e.g., in a cache listener).
-            // this will be compacted by the MarshalledValueInterceptor when the call returns.
-//            instance = null;
-            raw = baos.toByteArray();
-         }
-         catch (Exception e)
-         {
-            throw new CacheException("Unable to marshall value " + instance, e);
-         }
-      }
-   }
-
-   public synchronized void deserialize()
-   {
-      if (instance == null)
-      {
-         try
-         {
-            ByteArrayInputStream bais = new ByteArrayInputStream(raw);
-            // use a MarshalledValueInputStream since it needs to be aware of any context class loaders on the current thread.
-            ObjectInputStream ois = new MarshalledValueInputStream(bais);
-            instance = ois.readObject();
-            ois.close();
-            bais.close();
-//            raw = null;
-         }
-         catch (Exception e)
-         {
-            throw new CacheException("Unable to unmarshall value", e);
-         }
-      }
-   }
-
-   /**
-    * Compacts the references held by this class to a single reference.  If only one representation exists this method
-    * is a no-op unless the 'force' parameter is used, in which case the reference held is forcefully switched to the
-    * 'preferred representation'.
-    * <p/>
-    * Either way, a call to compact() will ensure that only one representation is held.
-    * <p/>
-    *
-    * @param preferSerializedRepresentation if true and both representations exist, the serialized representation is favoured.  If false, the deserialized representation is preferred.
-    * @param force                          ensures the preferred representation is maintained and the other released, even if this means serializing or deserializing.
-    */
-   public void compact(boolean preferSerializedRepresentation, boolean force)
-   {
-      // reset the equalityPreference
-      equalityPreferenceForInstance = true;
-      if (force)
-      {
-         if (preferSerializedRepresentation && raw == null) serialize();
-         else if (!preferSerializedRepresentation && instance == null) deserialize();
-      }
-
-      if (instance != null && raw != null)
-      {
-         // need to lose one representation!
-
-         if (preferSerializedRepresentation)
-         {
-            instance = null;
-         }
-         else
-         {
-            raw = null;
-         }
-      }
-   }
-
-   public void writeExternal(ObjectOutput out) throws IOException
-   {
-      if (raw == null) serialize();
-      out.writeInt(raw.length);
-      out.write(raw);
-      out.writeInt(hashCode());
-   }
-
-   public void readExternal(ObjectInput in) throws IOException, ClassNotFoundException
-   {
-      int size = in.readInt();
-      raw = new byte[size];
-      cachedHashCode = 0;
-      in.readFully(raw);
-      cachedHashCode = in.readInt();
-   }
-
-   public Object get() throws IOException, ClassNotFoundException
-   {
-      if (instance == null) deserialize();
-      return instance;
-   }
-
-   @Override
-   public boolean equals(Object o)
-   {
-      if (this == o) return true;
-      if (o == null || getClass() != o.getClass()) return false;
-
-      MarshalledValue2 that = (MarshalledValue2) o;
-
-      // if both versions are serialized or deserialized, just compare the relevant representations.
-      if (raw != null && that.raw != null) return Arrays.equals(raw, that.raw);
-      if (instance != null && that.instance != null) return instance.equals(that.instance);
-
-      // if conversion of one representation to the other is necessary, then see which we prefer converting.
-      if (equalityPreferenceForInstance)
-      {
-         if (instance == null) deserialize();
-         if (that.instance == null) that.deserialize();
-         return instance.equals(that.instance);
-      }
-      else
-      {
-         if (raw == null) serialize();
-         if (that.raw == null) that.serialize();
-         return Arrays.equals(raw, that.raw);
-      }
-   }
-
-   @Override
-   public int hashCode()
-   {
-      if (cachedHashCode == 0)
-      {
-         // always calculate the hashcode based on the instance since this is where we're getting the equals()
-         if (instance == null) deserialize();
-         cachedHashCode = instance.hashCode();
-         if (cachedHashCode == 0) // degenerate case
-         {
-            cachedHashCode = 0xFEED;
-         }
-      }
-      return cachedHashCode;
-   }
-
-   @Override
-   public String toString()
-   {
-      return "MarshalledValue2(cachedHashCode=" + cachedHashCode + "; serialized=" + (raw != null) + ")";
-   }
-}

Deleted: core/branches/flat/src/main/java/org/jboss/starobrno/marshall/MarshalledValueHelper2.java
===================================================================
--- core/branches/flat/src/main/java/org/jboss/starobrno/marshall/MarshalledValueHelper2.java	2008-10-14 17:50:19 UTC (rev 6947)
+++ core/branches/flat/src/main/java/org/jboss/starobrno/marshall/MarshalledValueHelper2.java	2008-10-14 17:54:06 UTC (rev 6948)
@@ -1,56 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source.
- * Copyright 2000 - 2008, Red Hat Middleware LLC, and individual contributors
- * as indicated by the @author tags. See the copyright.txt file in the
- * distribution for a full listing of individual contributors.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
-package org.jboss.starobrno.marshall;
-
-import org.jboss.cache.Fqn;
-import org.jboss.cache.commands.ReplicableCommand;
-import org.jboss.cache.transaction.GlobalTransaction;
-import org.jboss.starobrno.marshall.MarshalledValue2;
-import org.jgroups.Address;
-
-/**
- * Common functionality used by the {@link org.jboss.cache.interceptors.MarshalledValueInterceptor} and the {@link org.jboss.cache.marshall.MarshalledValueMap}.
- *
- * @author Manik Surtani (<a href="mailto:manik at jboss.org">manik at jboss.org</a>)
- * @see MarshalledValue2
- * @see org.jboss.cache.interceptors.MarshalledValueInterceptor
- * @see org.jboss.cache.marshall.MarshalledValueMap
- * @since 2.1.0
- */
-public class MarshalledValueHelper2
-{
-   /**
-    * Tests whether the type should be excluded from MarshalledValue wrapping.
-    *
-    * @param type type to test.  Should not be null.
-    * @return true if it should be excluded from MarshalledValue wrapping.
-    */
-   public static boolean isTypeExcluded(Class type)
-   {
-      return type.equals(String.class) || type.isPrimitive() ||
-            type.equals(Void.class) || type.equals(Boolean.class) || type.equals(Character.class) ||
-            type.equals(Byte.class) || type.equals(Short.class) || type.equals(Integer.class) ||
-            type.equals(Long.class) || type.equals(Float.class) || type.equals(Double.class) ||
-            (type.isArray() && isTypeExcluded(type.getComponentType())) || type.equals(Fqn.class) || type.equals(GlobalTransaction.class) || type.equals(Address.class) ||
-            ReplicableCommand.class.isAssignableFrom(type) || type.equals(MarshalledValue2.class);
-   }
-}

Modified: core/branches/flat/src/main/java/org/jboss/starobrno/marshall/MarshalledValueMap.java
===================================================================
--- core/branches/flat/src/main/java/org/jboss/starobrno/marshall/MarshalledValueMap.java	2008-10-14 17:50:19 UTC (rev 6947)
+++ core/branches/flat/src/main/java/org/jboss/starobrno/marshall/MarshalledValueMap.java	2008-10-14 17:54:06 UTC (rev 6948)
@@ -42,7 +42,7 @@
  * <p/>
  *
  * @author Manik Surtani (<a href="mailto:manik at jboss.org">manik at jboss.org</a>)
- * @see MarshalledValue2
+ * @see MarshalledValue
  * @since 2.1.0
  */
 @Immutable
@@ -145,7 +145,7 @@
    {
       try
       {
-         return o instanceof MarshalledValue2 ? ((MarshalledValue2) o).get() : o;
+         return o instanceof MarshalledValue ? ((MarshalledValue) o).get() : o;
       }
       catch (Exception e)
       {

Modified: core/branches/flat/src/test/java/org/jboss/starobrno/BasicTest.java
===================================================================
--- core/branches/flat/src/test/java/org/jboss/starobrno/BasicTest.java	2008-10-14 17:50:19 UTC (rev 6947)
+++ core/branches/flat/src/test/java/org/jboss/starobrno/BasicTest.java	2008-10-14 17:54:06 UTC (rev 6948)
@@ -61,4 +61,44 @@
          cm.stop();
       }
    }
+
+   public void testBasicReplication()
+   {
+      Configuration configuration = new Configuration();
+      configuration.setCacheMode(Configuration.CacheMode.REPL_SYNC);
+
+      CacheManager firstManager = new CacheManager(configuration);
+      CacheManager secondManager = new CacheManager(configuration);
+
+      try
+      {
+         firstManager.start();
+         secondManager.start();
+
+         Cache firstCache = firstManager.createCache("test");
+         Cache secondCache = firstManager.createCache("test");
+
+         firstCache.put("key","value");
+         assert secondCache.get("key").equals("value");
+         assert firstCache.get("key").equals("value");
+         secondCache.put("key", "value2");
+         assert firstCache.get("key").equals("value2");
+         firstCache.remove("key");
+         assert secondCache.get("key") == null;
+      } finally
+      {
+         firstManager.destroyCache("test");
+         secondManager.destroyCache("test");
+      }
+   }
+
+   public void concurrentMapMethodTest()
+   {
+
+   }
+
+   public void transactionalTest()
+   {
+
+   }
 }

Modified: core/branches/flat/src/test/java/org/jboss/starobrno/api/mvcc/LockAssert.java
===================================================================
--- core/branches/flat/src/test/java/org/jboss/starobrno/api/mvcc/LockAssert.java	2008-10-14 17:50:19 UTC (rev 6947)
+++ core/branches/flat/src/test/java/org/jboss/starobrno/api/mvcc/LockAssert.java	2008-10-14 17:54:06 UTC (rev 6948)
@@ -1,9 +1,9 @@
 package org.jboss.starobrno.api.mvcc;
 
-import org.jboss.cache.util.concurrent.locks.LockContainer;
 import org.jboss.starobrno.invocation.InvocationContextContainer;
 import org.jboss.starobrno.lock.LockManager;
 import org.jboss.starobrno.util.TestingUtil;
+import org.jboss.starobrno.util.concurrent.locks.LockContainer;
 
 /**
  * Helper class to assert lock status in MVCC

Modified: core/branches/flat/src/test/java/org/jboss/starobrno/api/mvcc/LockTestBase.java
===================================================================
--- core/branches/flat/src/test/java/org/jboss/starobrno/api/mvcc/LockTestBase.java	2008-10-14 17:50:19 UTC (rev 6947)
+++ core/branches/flat/src/test/java/org/jboss/starobrno/api/mvcc/LockTestBase.java	2008-10-14 17:54:06 UTC (rev 6948)
@@ -4,12 +4,12 @@
 import org.apache.commons.logging.LogFactory;
 import org.jboss.cache.DefaultCacheFactory;
 import org.jboss.cache.lock.IsolationLevel;
-import org.jboss.cache.lock.TimeoutException;
 import org.jboss.cache.transaction.DummyTransactionManagerLookup;
 import org.jboss.starobrno.Cache;
 import org.jboss.starobrno.config.Configuration;
 import org.jboss.starobrno.invocation.InvocationContextContainer;
 import org.jboss.starobrno.lock.LockManager;
+import org.jboss.starobrno.lock.TimeoutException;
 import org.jboss.starobrno.util.TestingUtil;
 import org.testng.annotations.AfterMethod;
 import org.testng.annotations.BeforeMethod;

Modified: core/branches/flat/src/test/java/org/jboss/starobrno/lock/LockContainerHashingTest.java
===================================================================
--- core/branches/flat/src/test/java/org/jboss/starobrno/lock/LockContainerHashingTest.java	2008-10-14 17:50:19 UTC (rev 6947)
+++ core/branches/flat/src/test/java/org/jboss/starobrno/lock/LockContainerHashingTest.java	2008-10-14 17:54:06 UTC (rev 6948)
@@ -21,8 +21,8 @@
  */
 package org.jboss.starobrno.lock;
 
-import org.jboss.cache.util.concurrent.locks.LockContainer;
-import org.jboss.cache.util.concurrent.locks.ReentrantLockContainer;
+import org.jboss.starobrno.util.concurrent.locks.LockContainer;
+import org.jboss.starobrno.util.concurrent.locks.ReentrantLockContainer;
 import org.testng.annotations.BeforeMethod;
 import org.testng.annotations.Test;
 
@@ -69,10 +69,10 @@
 
       // cannot be larger than the number of locks
       System.out.println("dist size: " + distribution.size());
-      System.out.println("num shared locks: " + stripedLock.getSize());
-      assert distribution.size() <= stripedLock.getSize();
+      System.out.println("num shared locks: " + stripedLock.getNumLocksHeld());
+      assert distribution.size() <= stripedLock.getNumLocksHeld();
       // assume at least a 2/3rd spread
-      assert distribution.size() * 1.5 >= stripedLock.getSize();
+      assert distribution.size() * 1.5 >= stripedLock.getNumLocksHeld();
    }
 
    private List<String> createRandomKeys(int number)




More information about the jbosscache-commits mailing list