ode-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From boisv...@apache.org
Subject svn commit: r545260 - /incubator/ode/trunk/jacob/src/main/java/org/apache/ode/jacob/vpu/ExecutionQueueImpl.java
Date Thu, 07 Jun 2007 18:34:44 GMT
Author: boisvert
Date: Thu Jun  7 11:34:44 2007
New Revision: 545260

URL: http://svn.apache.org/viewvc?view=rev&rev=545260
Log:
Cache ObjectStreamClass objects

Modified:
    incubator/ode/trunk/jacob/src/main/java/org/apache/ode/jacob/vpu/ExecutionQueueImpl.java

Modified: incubator/ode/trunk/jacob/src/main/java/org/apache/ode/jacob/vpu/ExecutionQueueImpl.java
URL: http://svn.apache.org/viewvc/incubator/ode/trunk/jacob/src/main/java/org/apache/ode/jacob/vpu/ExecutionQueueImpl.java?view=diff&rev=545260&r1=545259&r2=545260
==============================================================================
--- incubator/ode/trunk/jacob/src/main/java/org/apache/ode/jacob/vpu/ExecutionQueueImpl.java
(original)
+++ incubator/ode/trunk/jacob/src/main/java/org/apache/ode/jacob/vpu/ExecutionQueueImpl.java
Thu Jun  7 11:34:44 2007
@@ -55,6 +55,7 @@
 import java.util.LinkedList;
 import java.util.Map;
 import java.util.Set;
+import java.util.concurrent.ConcurrentHashMap;
 import java.util.zip.GZIPInputStream;
 import java.util.zip.GZIPOutputStream;
 
@@ -67,6 +68,9 @@
 
     private ClassLoader _classLoader;
 
+    private static ConcurrentHashMap<String, ObjectStreamClass> _classDescriptors
+        = new ConcurrentHashMap<String, ObjectStreamClass>();
+
     /**
      * Cached set of enqueued {@link Continuation} objects (i.e. those read using
      * {@link #enqueueReaction(org.apache.ode.jacob.soup.Continuation)}).
@@ -522,7 +526,7 @@
         public String toString() {
             StringBuffer buf = new StringBuffer(32);
             buf.append("{CFRAME ");
-            buf.append(ObjectPrinter.getShortClassName(type));
+            buf.append(type.getSimpleName());
             buf.append(':');
             buf.append(description);
             buf.append('#');
@@ -720,7 +724,12 @@
             boolean ser = readBoolean();
             if (ser) {
                 String clsName = readUTF();
-                return ObjectStreamClass.lookup(Class.forName(clsName, true, _classLoader));
+                ObjectStreamClass cached = _classDescriptors.get(clsName);
+                if (cached == null) {
+                    cached = ObjectStreamClass.lookup(Class.forName(clsName, true, _classLoader));
+                    _classDescriptors.put(clsName, cached);
+                }
+                return cached;
             }
             return super.readClassDescriptor();
         }



Mime
View raw message