Update of /var/cvs/src/org/mmbase/core/event
In directory james.mmbase.org:/tmp/cvs-serv24836
Modified Files:
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.33
retrieving revision 1.34
diff -u -b -r1.33 -r1.34
--- NodeEvent.java 26 Jul 2007 11:45:54 -0000 1.33
+++ NodeEvent.java 6 Feb 2008 15:50:46 -0000 1.34
@@ -6,9 +6,14 @@
*/
package org.mmbase.core.event;
+import java.io.*;
import java.util.*;
import org.mmbase.util.HashCodeUtil;
+import org.mmbase.cache.Cache;
+import org.mmbase.cache.CacheManager;
+import org.mmbase.util.logging.Logger;
+import org.mmbase.util.logging.Logging;
/**
* This class communicates a node event. in case of a change event, it contains
@@ -17,9 +22,10 @@
*
* @author Ernst Bunders
* @since MMBase-1.8
- * @version $Id: NodeEvent.java,v 1.33 2007/07/26 11:45:54 michiel Exp $
+ * @version $Id: NodeEvent.java,v 1.34 2008/02/06 15:50:46 michiel Exp $
*/
public class NodeEvent extends Event {
+ private static final Logger log =
Logging.getLoggerInstance(NodeEvent.class);
private static final long serialVersionUID = 1L;
@@ -86,6 +92,8 @@
return newValues.get(fieldName);
}
+
+
/**
* @return Returns the builderName.
*/
@@ -226,6 +234,37 @@
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<Integer, Integer> typeCache =
CacheManager.getCache("TypeCache");
+ if (typeCache != null) {
+ Integer type = new Integer("" + otype);
+ Integer cachedType = typeCache.get(nodeNumber);
+ if (cachedType == null) {
+ log.debug("Putting in type cache " + nodeNumber + " ->
" + type);
+ typeCache.put(nodeNumber, 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