BUG-3157: performance tuning - Skip int->Integer boxing 57/21357/3
authorRobert Varga <rovarga@cisco.com>
Tue, 26 May 2015 17:16:30 +0000 (19:16 +0200)
committermichal rehak <mirehak@cisco.com>
Fri, 29 May 2015 14:58:16 +0000 (14:58 +0000)
We really need the integer object, so don't keep it as a primitive type.
Also make sure we run equals on a constant reference. Finally do not
instantiate a zero integer.

Change-Id: I64875984c66e6a2ae54d9ce3acefb529d500e4f2
Signed-off-by: Robert Varga <rovarga@cisco.com>
openflowplugin/src/main/java/org/opendaylight/openflowplugin/openflow/md/core/sal/convertor/match/MatchConvertorImpl.java
openflowplugin/src/main/java/org/opendaylight/openflowplugin/openflow/md/core/sal/convertor/match/MatchConvertorV10Impl.java

index ad03deda13ad5dd9af017d272f993025a69eb507..84fb61722beb5d8d2cabd247301469d5799ce95d 100644 (file)
@@ -356,7 +356,7 @@ public class MatchConvertorImpl implements MatchConvertor<List<MatchEntry>> {
                 VlanVidCaseBuilder vlanVidCaseBuilder = new VlanVidCaseBuilder();
                 VlanVidBuilder vlanVidBuilder = new VlanVidBuilder();
                 boolean setCfiBit = false;
-                Integer vidEntryValue = new Integer(0);
+                Integer vidEntryValue = 0;
                 boolean hasmask = false;
                 if (Boolean.TRUE.equals(vlanId.isVlanIdPresent())) {
                     setCfiBit = true;
@@ -940,7 +940,7 @@ public class MatchConvertorImpl implements MatchConvertor<List<MatchEntry>> {
 
                 ipv4PrefixStr += IpConversionUtil.PREFIX_SEPARATOR + "32";
             }
-            if (!ipv4PrefixStr.equals(noIp)) {
+            if (!noIp.equals(ipv4PrefixStr)) {
                 ipv4MatchBuilder.setIpv4Source(new Ipv4Prefix(ipv4PrefixStr));
                 matchBuilder.setLayer3Match(ipv4MatchBuilder.build());
             }
@@ -957,7 +957,7 @@ public class MatchConvertorImpl implements MatchConvertor<List<MatchEntry>> {
 
                 ipv4PrefixStr += IpConversionUtil.PREFIX_SEPARATOR + "32";
             }
-            if (!ipv4PrefixStr.equals(noIp)) {
+            if (!noIp.equals(ipv4PrefixStr)) {
                 ipv4MatchBuilder.setIpv4Destination(new Ipv4Prefix(ipv4PrefixStr));
                 matchBuilder.setLayer3Match(ipv4MatchBuilder.build());
             }
index d3b65d7d0f78e902e03ca5b54d3f85506758ef92..0a5a4b7a3fc2f8e5a6b1de523920e208517eceb5 100644 (file)
@@ -46,7 +46,7 @@ public class MatchConvertorV10Impl implements MatchConvertor<MatchV10> {
      * The value 0xffff (OFP_VLAN_NONE) is used to indicate
      * that no VLAN ID is set for OF Flow.
      */
-    private static final int OFP_VLAN_NONE = 0xffff;
+    private static final Integer OFP_VLAN_NONE = 0xffff;
 
     /**
      * Method builds openflow 1.0 specific match (MatchV10) from MD-SAL match.