Needed to add timeout to hashcode and equals.
Project: http://git-wip-us.apache.org/repos/asf/incubator-blur/repo Commit: http://git-wip-us.apache.org/repos/asf/incubator-blur/commit/761486cc Tree: http://git-wip-us.apache.org/repos/asf/incubator-blur/tree/761486cc Diff: http://git-wip-us.apache.org/repos/asf/incubator-blur/diff/761486cc Branch: refs/heads/master Commit: 761486cce816a8c9e9345827154f7c7a02ceac15 Parents: e96e11a Author: Aaron McCurry <[email protected]> Authored: Thu Aug 29 23:16:16 2013 -0400 Committer: Aaron McCurry <[email protected]> Committed: Thu Aug 29 23:16:16 2013 -0400 ---------------------------------------------------------------------- .../java/org/apache/blur/thrift/Connection.java | 17 +++++++---------- 1 file changed, 7 insertions(+), 10 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/incubator-blur/blob/761486cc/blur-thrift/src/main/java/org/apache/blur/thrift/Connection.java ---------------------------------------------------------------------- diff --git a/blur-thrift/src/main/java/org/apache/blur/thrift/Connection.java b/blur-thrift/src/main/java/org/apache/blur/thrift/Connection.java index e2c5e5f..7145a83 100644 --- a/blur-thrift/src/main/java/org/apache/blur/thrift/Connection.java +++ b/blur-thrift/src/main/java/org/apache/blur/thrift/Connection.java @@ -33,7 +33,7 @@ public class Connection { int indexOfTimeout = connectionStr.indexOf("#"); if (indexOfTimeout > 0) { _timeout = Integer.parseInt(connectionStr.substring(indexOfTimeout + 1)); - connectionStr = connectionStr.substring(0,indexOfTimeout); + connectionStr = connectionStr.substring(0, indexOfTimeout); } else { _timeout = DEFAULT_TIMEOUT; } @@ -120,6 +120,7 @@ public class Connection { result = prime * result + (_proxy ? 1231 : 1237); result = prime * result + ((_proxyHost == null) ? 0 : _proxyHost.hashCode()); result = prime * result + _proxyPort; + result = prime * result + _timeout; return result; } @@ -148,19 +149,15 @@ public class Connection { return false; if (_proxyPort != other._proxyPort) return false; + if (_timeout != other._timeout) + return false; return true; } - @Override - public String toString() { - return "Connection [_host=" + _host + ", _port=" + _port + ", _proxy=" + _proxy + ", _proxyHost=" + _proxyHost - + ", _proxyPort=" + _proxyPort + "]"; - } - - public Object getConnectionStr() { + public String getConnectionStr() { if (_proxyHost != null) { - return _host + ":" + _port + "/" + _proxyHost + ":" + _proxyPort; + return _host + ":" + _port + "/" + _proxyHost + ":" + _proxyPort + "#" + _timeout; } - return _host + ":" + _port; + return _host + ":" + _port + "#" + _timeout; } }
