cxf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From dk...@apache.org
Subject svn commit: r1331472 - /cxf/trunk/api/src/main/java/org/apache/cxf/staxutils/StaxUtils.java
Date Fri, 27 Apr 2012 15:38:29 GMT
Author: dkulp
Date: Fri Apr 27 15:38:28 2012
New Revision: 1331472

URL: http://svn.apache.org/viewvc?rev=1331472&view=rev
Log:
Use a singleton for another stateless object to avoid 100's of them
being created.

Modified:
    cxf/trunk/api/src/main/java/org/apache/cxf/staxutils/StaxUtils.java

Modified: cxf/trunk/api/src/main/java/org/apache/cxf/staxutils/StaxUtils.java
URL: http://svn.apache.org/viewvc/cxf/trunk/api/src/main/java/org/apache/cxf/staxutils/StaxUtils.java?rev=1331472&r1=1331471&r2=1331472&view=diff
==============================================================================
--- cxf/trunk/api/src/main/java/org/apache/cxf/staxutils/StaxUtils.java (original)
+++ cxf/trunk/api/src/main/java/org/apache/cxf/staxutils/StaxUtils.java Fri Apr 27 15:38:28
2012
@@ -1130,13 +1130,7 @@ public final class StaxUtils {
                             return sysId;
                         }
                     };
-                    node.setUserData("location", loc2, new UserDataHandler() {
-                        public void handle(short operation, String key, Object data, Node
src, Node dst) {
-                            if (operation == NODE_CLONED) {
-                                dst.setUserData(key, data, this);
-                            }
-                        }
-                    });
+                    node.setUserData("location", loc2, LocationUserDataHandler.INSTANCE);
                 } catch (Exception ex) {
                     //possibly not DOM level 3, won't be able to record this then
                     return false;
@@ -1145,6 +1139,16 @@ public final class StaxUtils {
         }
         return recordLoc;
     }
+    
+    private static class LocationUserDataHandler implements UserDataHandler {
+        public static final LocationUserDataHandler INSTANCE = new LocationUserDataHandler();
+        
+        public void handle(short operation, String key, Object data, Node src, Node dst)
{
+            if (operation == NODE_CLONED) {
+                dst.setUserData(key, data, this);
+            }
+        }
+    }
 
     private static void declare(Element node, String uri, String prefix) {
         String qualname;



Mime
View raw message