BUG-994: fix QName not sharing QNameModule 90/9090/1
authorRobert Varga <rovarga@cisco.com>
Wed, 16 Jul 2014 18:18:18 +0000 (20:18 +0200)
committerRobert Varga <rovarga@cisco.com>
Wed, 16 Jul 2014 18:19:47 +0000 (20:19 +0200)
Fixes the most obvious offender. With this patch >105000 QNameModule
instances are eliminated, bringing down the base memory use by about 8MB.

Change-Id: I63cd091ee9ce4292d0ad8066d01bf0a6120802b8
Signed-off-by: Robert Varga <rovarga@cisco.com>
yang/yang-common/src/main/java/org/opendaylight/yangtools/yang/common/QName.java

index 1ab33ade491179856532239d0582b53538c1f276..d2ccf637d78ec6096daeb56ddbf2a3b3380ffc76 100644 (file)
@@ -144,7 +144,7 @@ public final class QName implements Immutable, Serializable, Comparable<QName> {
      */
     @Deprecated
     public QName(final QName base, final String localName) {
-        this(base.getNamespace(), base.getRevision(), base.getPrefix(), localName);
+        this(base.getModule(), base.getPrefix(), localName);
     }
 
     /**
@@ -281,7 +281,7 @@ public final class QName implements Immutable, Serializable, Comparable<QName> {
     }
 
     public static QName create(final QName base, final String localName) {
-        return new QName(base, localName);
+        return new QName(base.getModule(), base.getPrefix(), localName);
     }
 
     /**