diff options
author | Robert Varga <nite@hq.sk> | 2016-02-12 18:21:22 +0100 |
---|---|---|
committer | Gerrit Code Review <gerrit@fd.io> | 2016-03-02 06:15:36 +0000 |
commit | 3f7b03ab3d6c1c479da05265bb28fe5a732c21a6 (patch) | |
tree | 6f2b1bab58ed59a02691b23fb1ca61d9fd47b3d8 /v3po | |
parent | 112ae6ab6ac03eb884594240500bc824d9fb4eb8 (diff) |
Use Guava Splitter to split IP address
Using String.split() forces compilation of the regex, which is slow. Use
a thread-safe Splitter to perform the same job.
Change-Id: Icbc326a376bc9aaea692f80d01439e81a302bc5f
Signed-off-by: Robert Varga <nite@hq.sk>
Diffstat (limited to 'v3po')
-rw-r--r-- | v3po/impl/src/main/java/io/fd/honeycomb/v3po/impl/VppIetfInterfaceListener.java | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/v3po/impl/src/main/java/io/fd/honeycomb/v3po/impl/VppIetfInterfaceListener.java b/v3po/impl/src/main/java/io/fd/honeycomb/v3po/impl/VppIetfInterfaceListener.java index 9b84a00f4..481c0ef60 100644 --- a/v3po/impl/src/main/java/io/fd/honeycomb/v3po/impl/VppIetfInterfaceListener.java +++ b/v3po/impl/src/main/java/io/fd/honeycomb/v3po/impl/VppIetfInterfaceListener.java @@ -16,6 +16,7 @@ package io.fd.honeycomb.v3po.impl; +import com.google.common.base.Splitter; import java.util.Collection; import org.opendaylight.controller.md.sal.binding.api.DataBroker; import org.opendaylight.controller.md.sal.binding.api.DataObjectModification; @@ -52,6 +53,7 @@ import org.slf4j.LoggerFactory; public class VppIetfInterfaceListener implements DataTreeChangeListener<Interface>, AutoCloseable { private static final Logger LOG = LoggerFactory.getLogger(VppIetfInterfaceListener.class); + private static final Splitter DOT_SPLITTER = Splitter.on('.'); private final ListenerRegistration<VppIetfInterfaceListener> registration; private final DataBroker db; @@ -220,7 +222,7 @@ public class VppIetfInterfaceListener implements DataTreeChangeListener<Interfac int result = 0; // iterate over each octet - for (String part : address.split("\\.")) { + for (String part : DOT_SPLITTER.split(address)) { // shift the previously parsed bits over by 1 byte result = result << 8; // set the low order bits to the current octet |