You are viewing a plain text version of this content. The canonical link for it is here.
Posted to xindice-dev@xml.apache.org by vg...@apache.org on 2007/11/13 18:21:25 UTC

svn commit: r594588 - in /xml/xindice/trunk/java/src/org/apache/xindice/core: Collection.java cache/DocumentCacheImpl.java data/Entry.java

Author: vgritsenko
Date: Tue Nov 13 09:21:25 2007
New Revision: 594588

URL: http://svn.apache.org/viewvc?rev=594588&view=rev
Log:
make meta unmodifiable in createMetaMap

Modified:
    xml/xindice/trunk/java/src/org/apache/xindice/core/Collection.java
    xml/xindice/trunk/java/src/org/apache/xindice/core/cache/DocumentCacheImpl.java
    xml/xindice/trunk/java/src/org/apache/xindice/core/data/Entry.java

Modified: xml/xindice/trunk/java/src/org/apache/xindice/core/Collection.java
URL: http://svn.apache.org/viewvc/xml/xindice/trunk/java/src/org/apache/xindice/core/Collection.java?rev=594588&r1=594587&r2=594588&view=diff
==============================================================================
--- xml/xindice/trunk/java/src/org/apache/xindice/core/Collection.java (original)
+++ xml/xindice/trunk/java/src/org/apache/xindice/core/Collection.java Tue Nov 13 09:21:25 2007
@@ -885,7 +885,6 @@
                 Document document;
                 if (compressed) {
                     document = new DocumentImpl(value.getData(), symbols, new NodeSource(this, key));
-                    flushSymbolTable();
                     if (log.isTraceEnabled()) {
                         log.trace(localDebugHeader +
                                   "Compressed XML document=<" + TextWriter.toString(document) + ">");
@@ -902,13 +901,15 @@
 
                     // FIXME There should be no reason here to re-compress the document & flush symbols table?
                     document = parseDocument(key, documentChars);
-                    flushSymbolTable();
 
                     if (cache != null) {
                         cache.putEntry(this, key, DocumentCache.UNCOMPRESSED, value, entryMeta);
                     }
                 }
 
+                // Symbol table could have been updated above, flush it to the disk.
+                flushSymbolTable();
+
                 DBObserver.getInstance().loadDocument(this, record, document);
                 return new Entry(key, document, entryMeta);
             } else {
@@ -1256,7 +1257,6 @@
 
         byte[] documentBytes;
 
-        // FIXME: concurrent symbol table access.
         if (compressed) {
             // Create compressed document bytes to be stored in the filer
             documentBytes = DOMCompressor.compress(document, symbols);

Modified: xml/xindice/trunk/java/src/org/apache/xindice/core/cache/DocumentCacheImpl.java
URL: http://svn.apache.org/viewvc/xml/xindice/trunk/java/src/org/apache/xindice/core/cache/DocumentCacheImpl.java?rev=594588&r1=594587&r2=594588&view=diff
==============================================================================
--- xml/xindice/trunk/java/src/org/apache/xindice/core/cache/DocumentCacheImpl.java (original)
+++ xml/xindice/trunk/java/src/org/apache/xindice/core/cache/DocumentCacheImpl.java Tue Nov 13 09:21:25 2007
@@ -103,7 +103,7 @@
 
         switch (e.getType()) {
             case DocumentCache.COMPRESSED:
-                {
+                {           
                     SymbolTable s = col.getSymbols();
                     NodeSource ns = new NodeSource(col, key);
                     Document doc =  new DocumentImpl(e.getValue().getData(), s, ns);
@@ -140,7 +140,7 @@
         if (e == null) {
             return null;
         }
-        
+
         return new Entry(key, e.getMeta());
     }
 

Modified: xml/xindice/trunk/java/src/org/apache/xindice/core/data/Entry.java
URL: http://svn.apache.org/viewvc/xml/xindice/trunk/java/src/org/apache/xindice/core/data/Entry.java?rev=594588&r1=594587&r2=594588&view=diff
==============================================================================
--- xml/xindice/trunk/java/src/org/apache/xindice/core/data/Entry.java (original)
+++ xml/xindice/trunk/java/src/org/apache/xindice/core/data/Entry.java Tue Nov 13 09:21:25 2007
@@ -85,7 +85,7 @@
     }
 
     public Map getMeta() {
-        return Collections.unmodifiableMap(meta);
+        return meta;
     }
 
     public long getCreationTime() {
@@ -99,9 +99,9 @@
     }
 
     public static Map createMetaMap(Record record) {
-        Map entryMeta = new HashMap();
+        Map entryMeta = new HashMap(5);
         entryMeta.put(Entry.CREATED,  record.getMetaData(Record.CREATED));
         entryMeta.put(Entry.MODIFIED, record.getMetaData(Record.MODIFIED));
-        return entryMeta;
+        return Collections.unmodifiableMap(entryMeta);
     }
 }