[Webfunds-commits] java/webfunds/store AppendFileStore.java

Ian Grigg iang@cypherpunks.ai
Fri, 6 Oct 2000 21:16:12 -0400 (AST)


iang        00/10/06 21:16:12

  Modified:    webfunds/store AppendFileStore.java
  Log:
  commentary and culling of silly code

Revision  Changes    Path
1.15      +19 -14    java/webfunds/store/AppendFileStore.java

Index: AppendFileStore.java
===================================================================
RCS file: /home/webfunds/cvsroot/java/webfunds/store/AppendFileStore.java,v
retrieving revision 1.14
retrieving revision 1.15
diff -u -r1.14 -r1.15
--- AppendFileStore.java	2000/09/30 18:41:17	1.14
+++ AppendFileStore.java	2000/10/07 01:16:11	1.15
@@ -1,5 +1,5 @@
 /*
- * $Id: AppendFileStore.java,v 1.14 2000/09/30 18:41:17 iang Exp $
+ * $Id: AppendFileStore.java,v 1.15 2000/10/07 01:16:11 iang Exp $
  *
  * Copyright (c) Systemics Ltd 1995-2000 on behalf of
  * the WebFunds Development Team.  All Rights Reserved.
@@ -640,11 +640,15 @@
 ////// Hashtable //////////////////////////////////
 
     /**
-     * (Re)sets a (file) object into the hashtable.
-     * Conducts some checking to see if it changed first,
-     * and syncs the file to disk if it has changed.
-     * @param value is an Encodable object
-     * @param key is the String name of the object
+     *  (Re)sets a (file) object into the hashtable.
+     *  and syncs the file to disk if it has changed.
+     *
+     *  As we mostly deal in copied refs of the Object rather than
+     *  copies of the Object, it is the caller's responsibility to
+     *  ensure that it needs put'ing.
+     *
+     *  @param value is an Encodable object
+     *  @param key is the String name of the object
      */
     public synchronized Object put(Object key, Object value)
     {
@@ -652,15 +656,16 @@
             throw new RuntimeException("key must be String: " + key);
 
         logmsg("append.put("+(String)key+", "+value.getClass().toString()+")");
-        Object old = get(key);
-        if (old instanceof byte[] && value instanceof byte[])
-        {
-            if (new String((byte[])value).equals(new String((byte[])old)))
-            {
-                return value;
-            }
-        }
 
+// Damn, also might be same object and have changed in place.
+//        Object old = get(key);
+//        if (old instanceof byte[] && value instanceof byte[])
+//        {
+//            if (new String((byte[])value).equals(new String((byte[])old)))
+//            {
+//                return value;
+//            }
+//        }
 // Damn, Store returns same object so gets changed in place, this never saves.
 //        if (value.equals(old))
 //        {