Update of /var/cvs/src/org/mmbase/core/event
In directory james.mmbase.org:/tmp/cvs-serv24699

Modified Files:
      Tag: MMBase-1_8
        NodeEvent.java 
Log Message:
performance improvent: use info in event to fill typecache if possible


See also: http://cvs.mmbase.org/viewcvs/src/org/mmbase/core/event


Index: NodeEvent.java
===================================================================
RCS file: /var/cvs/src/org/mmbase/core/event/NodeEvent.java,v
retrieving revision 1.27.2.1
retrieving revision 1.27.2.2
diff -u -b -r1.27.2.1 -r1.27.2.2
--- NodeEvent.java      19 Nov 2007 15:43:39 -0000      1.27.2.1
+++ NodeEvent.java      6 Feb 2008 15:45:46 -0000       1.27.2.2
@@ -11,6 +11,7 @@
 import java.util.*;
 
 import org.mmbase.util.HashCodeUtil;
+import org.mmbase.cache.Cache;
 import org.mmbase.module.core.MMBase;
 import org.mmbase.util.logging.Logger;
 import org.mmbase.util.logging.Logging;
@@ -23,7 +24,7 @@
  *
  * @author  Ernst Bunders
  * @since   MMBase-1.8
- * @version $Id: NodeEvent.java,v 1.27.2.1 2007/11/19 15:43:39 michiel Exp $
+ * @version $Id: NodeEvent.java,v 1.27.2.2 2008/02/06 15:45:46 michiel Exp $
  */
 public class NodeEvent extends Event {
 
@@ -235,6 +236,38 @@
         return newValues;
     }
 
+    private void readObject(ObjectInputStream in) throws IOException, 
ClassNotFoundException {
+        in.defaultReadObject();
+        try {
+            Object otype = oldValues.get("otype");
+            if (otype == null) otype = newValues.get("otype");
+            if (otype != null) {
+                Cache typeCache = Cache.getCache("TypeCache");
+                if (typeCache != null) {
+                    Integer node = new Integer(nodeNumber);
+                    Integer type = new Integer("" + otype);
+                    Integer cachedType = (Integer) typeCache.get(node);
+                    if (cachedType == null) {
+                        log.debug("Putting in type cache " + node + " -> " + 
type);
+                        typeCache.put(node, type);
+                    } else {
+                        if (type.equals(cachedType)) {
+                            log.debug("Type already cached");
+                        } else {
+                            log.warn("Type in event not the same as in cache " 
+ type + " != " + cachedType);
+                        }
+                    }
+                } else {
+                    log.service("No typecache?");
+                }
+
+            }
+        } catch (Exception e) {
+             log.error(e);
+        }
+
+    }
+
 
     public static void main(String[] args) {
         //test serializable
_______________________________________________
Cvs mailing list
[email protected]
http://lists.mmbase.org/mailman/listinfo/cvs

Reply via email to