From: Jozef Bacigal Date: Wed, 20 Jul 2016 12:15:46 +0000 (+0000) Subject: Merge "Create empty match only once" X-Git-Tag: release/boron~86 X-Git-Url: https://git.opendaylight.org/gerrit/gitweb?a=commitdiff_plain;h=1bab9badd1a0aabec7dbd2b094a554988543e41c;hp=9c42c490338edaeee58826f2c208edf54e7abe83;p=openflowplugin.git Merge "Create empty match only once" --- diff --git a/openflowplugin-impl/src/main/java/org/opendaylight/openflowplugin/impl/registry/flow/FlowRegistryKeyFactory.java b/openflowplugin-impl/src/main/java/org/opendaylight/openflowplugin/impl/registry/flow/FlowRegistryKeyFactory.java index 1a9948a2bd..4130bb35cc 100644 --- a/openflowplugin-impl/src/main/java/org/opendaylight/openflowplugin/impl/registry/flow/FlowRegistryKeyFactory.java +++ b/openflowplugin-impl/src/main/java/org/opendaylight/openflowplugin/impl/registry/flow/FlowRegistryKeyFactory.java @@ -36,12 +36,13 @@ public class FlowRegistryKeyFactory { private final int priority; private final BigInteger cookie; private final Match match; + private static final Match EMPTY_MATCH = new MatchBuilder().build(); public FlowRegistryKeyDto(final Flow flow) { //TODO: mandatory flow input values (or default values) should be specified via yang model tableId = Preconditions.checkNotNull(flow.getTableId(), "flow tableId must not be null"); priority = MoreObjects.firstNonNull(flow.getPriority(), OFConstants.DEFAULT_FLOW_PRIORITY); - match = flow.getMatch()==null? new MatchBuilder().build(): flow.getMatch(); + match = flow.getMatch()==null ? EMPTY_MATCH : flow.getMatch(); cookie = MoreObjects.firstNonNull(flow.getCookie(), OFConstants.DEFAULT_FLOW_COOKIE).getValue(); }