summaryrefslogtreecommitdiffstats
path: root/v3po/impl
diff options
context:
space:
mode:
authorRobert Varga <nite@hq.sk>2016-02-12 18:21:22 +0100
committerGerrit Code Review <gerrit@fd.io>2016-03-02 06:15:36 +0000
commit013d345ef6710abe4a8db3778b1e67f602ffc659 (patch)
treef4abc0388500a798f0742cf3961ce85b3027d58d /v3po/impl
parent8271a6f8eda61dadb5aa86dcad2f23dea5a42568 (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/impl')
-rw-r--r--v3po/impl/src/main/java/io/fd/honeycomb/v3po/impl/VppIetfInterfaceListener.java4
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