Limit the amont of work that happens on netty event loop threads.
Currently we are kryo serializing/deserializing the message envelope which can potentially limit throughput.
Change-Id: I0ae9dab53bbb765b7618ceaefda1edf4f77b0b59
diff --git a/utils/netty/src/main/java/org/onlab/netty/Endpoint.java b/utils/netty/src/main/java/org/onlab/netty/Endpoint.java
index 50bc58d..ecbb08f 100644
--- a/utils/netty/src/main/java/org/onlab/netty/Endpoint.java
+++ b/utils/netty/src/main/java/org/onlab/netty/Endpoint.java
@@ -15,8 +15,12 @@
*/
package org.onlab.netty;
+import static com.google.common.base.Preconditions.*;
+
import java.util.Objects;
+import org.onlab.packet.IpAddress;
+
import com.google.common.base.MoreObjects;
/**
@@ -25,15 +29,15 @@
public final class Endpoint {
private final int port;
- private final String host;
+ private final IpAddress ip;
- public Endpoint(String host, int port) {
- this.host = host;
+ public Endpoint(IpAddress host, int port) {
+ this.ip = checkNotNull(host);
this.port = port;
}
- public String host() {
- return host;
+ public IpAddress host() {
+ return ip;
}
public int port() {
@@ -43,14 +47,14 @@
@Override
public String toString() {
return MoreObjects.toStringHelper(getClass())
- .add("host", host)
+ .add("ip", ip)
.add("port", port)
.toString();
}
@Override
public int hashCode() {
- return Objects.hash(host, port);
+ return Objects.hash(ip, port);
}
@Override
@@ -66,6 +70,6 @@
}
Endpoint that = (Endpoint) obj;
return Objects.equals(this.port, that.port) &&
- Objects.equals(this.host, that.host);
+ Objects.equals(this.ip, that.ip);
}
}