hbase-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From git-site-r...@apache.org
Subject [49/51] [partial] hbase-site git commit: Published site at f3d1c021de2264301f68eadb9ef126ff83d7ef53.
Date Thu, 24 May 2018 14:49:09 GMT
http://git-wip-us.apache.org/repos/asf/hbase-site/blob/883dde2f/apidocs/src-html/org/apache/hadoop/hbase/ServerName.html
----------------------------------------------------------------------
diff --git a/apidocs/src-html/org/apache/hadoop/hbase/ServerName.html b/apidocs/src-html/org/apache/hadoop/hbase/ServerName.html
index ba6f5fd..f9b4f3e 100644
--- a/apidocs/src-html/org/apache/hadoop/hbase/ServerName.html
+++ b/apidocs/src-html/org/apache/hadoop/hbase/ServerName.html
@@ -241,186 +241,190 @@
 <span class="sourceLineNo">233</span>    return this.address.getHostname();<a
name="line.233"></a>
 <span class="sourceLineNo">234</span>  }<a name="line.234"></a>
 <span class="sourceLineNo">235</span><a name="line.235"></a>
-<span class="sourceLineNo">236</span>  public int getPort() {<a name="line.236"></a>
-<span class="sourceLineNo">237</span>    return this.address.getPort();<a
name="line.237"></a>
+<span class="sourceLineNo">236</span>  public String getHostnameLowerCase() {<a
name="line.236"></a>
+<span class="sourceLineNo">237</span>    return this.address.getHostname().toLowerCase(Locale.ROOT);<a
name="line.237"></a>
 <span class="sourceLineNo">238</span>  }<a name="line.238"></a>
 <span class="sourceLineNo">239</span><a name="line.239"></a>
-<span class="sourceLineNo">240</span>  public long getStartcode() {<a name="line.240"></a>
-<span class="sourceLineNo">241</span>    return startcode;<a name="line.241"></a>
+<span class="sourceLineNo">240</span>  public int getPort() {<a name="line.240"></a>
+<span class="sourceLineNo">241</span>    return this.address.getPort();<a
name="line.241"></a>
 <span class="sourceLineNo">242</span>  }<a name="line.242"></a>
 <span class="sourceLineNo">243</span><a name="line.243"></a>
-<span class="sourceLineNo">244</span>  /**<a name="line.244"></a>
-<span class="sourceLineNo">245</span>   * For internal use only.<a name="line.245"></a>
-<span class="sourceLineNo">246</span>   * @param hostName<a name="line.246"></a>
-<span class="sourceLineNo">247</span>   * @param port<a name="line.247"></a>
-<span class="sourceLineNo">248</span>   * @param startcode<a name="line.248"></a>
-<span class="sourceLineNo">249</span>   * @return Server name made of the concatenation
of hostname, port and<a name="line.249"></a>
-<span class="sourceLineNo">250</span>   * startcode formatted as &lt;code&gt;&amp;lt;hostname&amp;gt;
',' &amp;lt;port&amp;gt; ',' &amp;lt;startcode&amp;gt;&lt;/code&gt;<a
name="line.250"></a>
-<span class="sourceLineNo">251</span>   * @deprecated Since 2.0. Use {@link ServerName#valueOf(String,
int, long)} instead.<a name="line.251"></a>
-<span class="sourceLineNo">252</span>   */<a name="line.252"></a>
-<span class="sourceLineNo">253</span>  @Deprecated<a name="line.253"></a>
-<span class="sourceLineNo">254</span>  // TODO: Make this private in hbase-3.0.<a
name="line.254"></a>
-<span class="sourceLineNo">255</span>  static String getServerName(String hostName,
int port, long startcode) {<a name="line.255"></a>
-<span class="sourceLineNo">256</span>    final StringBuilder name = new StringBuilder(hostName.length()
+ 1 + 5 + 1 + 13);<a name="line.256"></a>
-<span class="sourceLineNo">257</span>    name.append(hostName.toLowerCase(Locale.ROOT));<a
name="line.257"></a>
-<span class="sourceLineNo">258</span>    name.append(SERVERNAME_SEPARATOR);<a
name="line.258"></a>
-<span class="sourceLineNo">259</span>    name.append(port);<a name="line.259"></a>
-<span class="sourceLineNo">260</span>    name.append(SERVERNAME_SEPARATOR);<a
name="line.260"></a>
-<span class="sourceLineNo">261</span>    name.append(startcode);<a name="line.261"></a>
-<span class="sourceLineNo">262</span>    return name.toString();<a name="line.262"></a>
-<span class="sourceLineNo">263</span>  }<a name="line.263"></a>
-<span class="sourceLineNo">264</span><a name="line.264"></a>
-<span class="sourceLineNo">265</span>  /**<a name="line.265"></a>
-<span class="sourceLineNo">266</span>   * @param hostAndPort String in form of
&amp;lt;hostname&amp;gt; ':' &amp;lt;port&amp;gt;<a name="line.266"></a>
-<span class="sourceLineNo">267</span>   * @param startcode<a name="line.267"></a>
-<span class="sourceLineNo">268</span>   * @return Server name made of the concatenation
of hostname, port and<a name="line.268"></a>
-<span class="sourceLineNo">269</span>   * startcode formatted as &lt;code&gt;&amp;lt;hostname&amp;gt;
',' &amp;lt;port&amp;gt; ',' &amp;lt;startcode&amp;gt;&lt;/code&gt;<a
name="line.269"></a>
-<span class="sourceLineNo">270</span>   * @deprecated Since 2.0. Use {@link ServerName#valueOf(String,
long)} instead.<a name="line.270"></a>
-<span class="sourceLineNo">271</span>   */<a name="line.271"></a>
-<span class="sourceLineNo">272</span>  @Deprecated<a name="line.272"></a>
-<span class="sourceLineNo">273</span>  public static String getServerName(final
String hostAndPort,<a name="line.273"></a>
-<span class="sourceLineNo">274</span>      final long startcode) {<a name="line.274"></a>
-<span class="sourceLineNo">275</span>    int index = hostAndPort.indexOf(":");<a
name="line.275"></a>
-<span class="sourceLineNo">276</span>    if (index &lt;= 0) throw new IllegalArgumentException("Expected
&lt;hostname&gt; ':' &lt;port&gt;");<a name="line.276"></a>
-<span class="sourceLineNo">277</span>    return getServerName(hostAndPort.substring(0,
index),<a name="line.277"></a>
-<span class="sourceLineNo">278</span>      Integer.parseInt(hostAndPort.substring(index
+ 1)), startcode);<a name="line.278"></a>
-<span class="sourceLineNo">279</span>  }<a name="line.279"></a>
-<span class="sourceLineNo">280</span><a name="line.280"></a>
-<span class="sourceLineNo">281</span>  /**<a name="line.281"></a>
-<span class="sourceLineNo">282</span>   * @return Hostname and port formatted
as described at<a name="line.282"></a>
-<span class="sourceLineNo">283</span>   * {@link Addressing#createHostAndPortStr(String,
int)}<a name="line.283"></a>
-<span class="sourceLineNo">284</span>   * @deprecated Since 2.0. Use {@link #getAddress()}
instead.<a name="line.284"></a>
-<span class="sourceLineNo">285</span>   */<a name="line.285"></a>
-<span class="sourceLineNo">286</span>  @Deprecated<a name="line.286"></a>
-<span class="sourceLineNo">287</span>  public String getHostAndPort() {<a
name="line.287"></a>
-<span class="sourceLineNo">288</span>    return this.address.toString();<a
name="line.288"></a>
-<span class="sourceLineNo">289</span>  }<a name="line.289"></a>
-<span class="sourceLineNo">290</span><a name="line.290"></a>
-<span class="sourceLineNo">291</span>  public Address getAddress() {<a name="line.291"></a>
-<span class="sourceLineNo">292</span>    return this.address;<a name="line.292"></a>
+<span class="sourceLineNo">244</span>  public long getStartcode() {<a name="line.244"></a>
+<span class="sourceLineNo">245</span>    return startcode;<a name="line.245"></a>
+<span class="sourceLineNo">246</span>  }<a name="line.246"></a>
+<span class="sourceLineNo">247</span><a name="line.247"></a>
+<span class="sourceLineNo">248</span>  /**<a name="line.248"></a>
+<span class="sourceLineNo">249</span>   * For internal use only.<a name="line.249"></a>
+<span class="sourceLineNo">250</span>   * @param hostName<a name="line.250"></a>
+<span class="sourceLineNo">251</span>   * @param port<a name="line.251"></a>
+<span class="sourceLineNo">252</span>   * @param startcode<a name="line.252"></a>
+<span class="sourceLineNo">253</span>   * @return Server name made of the concatenation
of hostname, port and<a name="line.253"></a>
+<span class="sourceLineNo">254</span>   * startcode formatted as &lt;code&gt;&amp;lt;hostname&amp;gt;
',' &amp;lt;port&amp;gt; ',' &amp;lt;startcode&amp;gt;&lt;/code&gt;<a
name="line.254"></a>
+<span class="sourceLineNo">255</span>   * @deprecated Since 2.0. Use {@link ServerName#valueOf(String,
int, long)} instead.<a name="line.255"></a>
+<span class="sourceLineNo">256</span>   */<a name="line.256"></a>
+<span class="sourceLineNo">257</span>  @Deprecated<a name="line.257"></a>
+<span class="sourceLineNo">258</span>  // TODO: Make this private in hbase-3.0.<a
name="line.258"></a>
+<span class="sourceLineNo">259</span>  static String getServerName(String hostName,
int port, long startcode) {<a name="line.259"></a>
+<span class="sourceLineNo">260</span>    final StringBuilder name = new StringBuilder(hostName.length()
+ 1 + 5 + 1 + 13);<a name="line.260"></a>
+<span class="sourceLineNo">261</span>    name.append(hostName.toLowerCase(Locale.ROOT));<a
name="line.261"></a>
+<span class="sourceLineNo">262</span>    name.append(SERVERNAME_SEPARATOR);<a
name="line.262"></a>
+<span class="sourceLineNo">263</span>    name.append(port);<a name="line.263"></a>
+<span class="sourceLineNo">264</span>    name.append(SERVERNAME_SEPARATOR);<a
name="line.264"></a>
+<span class="sourceLineNo">265</span>    name.append(startcode);<a name="line.265"></a>
+<span class="sourceLineNo">266</span>    return name.toString();<a name="line.266"></a>
+<span class="sourceLineNo">267</span>  }<a name="line.267"></a>
+<span class="sourceLineNo">268</span><a name="line.268"></a>
+<span class="sourceLineNo">269</span>  /**<a name="line.269"></a>
+<span class="sourceLineNo">270</span>   * @param hostAndPort String in form of
&amp;lt;hostname&amp;gt; ':' &amp;lt;port&amp;gt;<a name="line.270"></a>
+<span class="sourceLineNo">271</span>   * @param startcode<a name="line.271"></a>
+<span class="sourceLineNo">272</span>   * @return Server name made of the concatenation
of hostname, port and<a name="line.272"></a>
+<span class="sourceLineNo">273</span>   * startcode formatted as &lt;code&gt;&amp;lt;hostname&amp;gt;
',' &amp;lt;port&amp;gt; ',' &amp;lt;startcode&amp;gt;&lt;/code&gt;<a
name="line.273"></a>
+<span class="sourceLineNo">274</span>   * @deprecated Since 2.0. Use {@link ServerName#valueOf(String,
long)} instead.<a name="line.274"></a>
+<span class="sourceLineNo">275</span>   */<a name="line.275"></a>
+<span class="sourceLineNo">276</span>  @Deprecated<a name="line.276"></a>
+<span class="sourceLineNo">277</span>  public static String getServerName(final
String hostAndPort,<a name="line.277"></a>
+<span class="sourceLineNo">278</span>      final long startcode) {<a name="line.278"></a>
+<span class="sourceLineNo">279</span>    int index = hostAndPort.indexOf(":");<a
name="line.279"></a>
+<span class="sourceLineNo">280</span>    if (index &lt;= 0) throw new IllegalArgumentException("Expected
&lt;hostname&gt; ':' &lt;port&gt;");<a name="line.280"></a>
+<span class="sourceLineNo">281</span>    return getServerName(hostAndPort.substring(0,
index),<a name="line.281"></a>
+<span class="sourceLineNo">282</span>      Integer.parseInt(hostAndPort.substring(index
+ 1)), startcode);<a name="line.282"></a>
+<span class="sourceLineNo">283</span>  }<a name="line.283"></a>
+<span class="sourceLineNo">284</span><a name="line.284"></a>
+<span class="sourceLineNo">285</span>  /**<a name="line.285"></a>
+<span class="sourceLineNo">286</span>   * @return Hostname and port formatted
as described at<a name="line.286"></a>
+<span class="sourceLineNo">287</span>   * {@link Addressing#createHostAndPortStr(String,
int)}<a name="line.287"></a>
+<span class="sourceLineNo">288</span>   * @deprecated Since 2.0. Use {@link #getAddress()}
instead.<a name="line.288"></a>
+<span class="sourceLineNo">289</span>   */<a name="line.289"></a>
+<span class="sourceLineNo">290</span>  @Deprecated<a name="line.290"></a>
+<span class="sourceLineNo">291</span>  public String getHostAndPort() {<a
name="line.291"></a>
+<span class="sourceLineNo">292</span>    return this.address.toString();<a
name="line.292"></a>
 <span class="sourceLineNo">293</span>  }<a name="line.293"></a>
 <span class="sourceLineNo">294</span><a name="line.294"></a>
-<span class="sourceLineNo">295</span>  /**<a name="line.295"></a>
-<span class="sourceLineNo">296</span>   * @param serverName ServerName in form
specified by {@link #getServerName()}<a name="line.296"></a>
-<span class="sourceLineNo">297</span>   * @return The server start code parsed
from &lt;code&gt;servername&lt;/code&gt;<a name="line.297"></a>
-<span class="sourceLineNo">298</span>   * @deprecated Since 2.0. Use instance
of ServerName to pull out start code.<a name="line.298"></a>
-<span class="sourceLineNo">299</span>   */<a name="line.299"></a>
-<span class="sourceLineNo">300</span>  @Deprecated<a name="line.300"></a>
-<span class="sourceLineNo">301</span>  public static long getServerStartcodeFromServerName(final
String serverName) {<a name="line.301"></a>
-<span class="sourceLineNo">302</span>    int index = serverName.lastIndexOf(SERVERNAME_SEPARATOR);<a
name="line.302"></a>
-<span class="sourceLineNo">303</span>    return Long.parseLong(serverName.substring(index
+ 1));<a name="line.303"></a>
-<span class="sourceLineNo">304</span>  }<a name="line.304"></a>
-<span class="sourceLineNo">305</span><a name="line.305"></a>
-<span class="sourceLineNo">306</span>  /**<a name="line.306"></a>
-<span class="sourceLineNo">307</span>   * Utility method to excise the start
code from a server name<a name="line.307"></a>
-<span class="sourceLineNo">308</span>   * @param inServerName full server name<a
name="line.308"></a>
-<span class="sourceLineNo">309</span>   * @return server name less its start
code<a name="line.309"></a>
-<span class="sourceLineNo">310</span>   * @deprecated Since 2.0. Use {@link #getAddress()}<a
name="line.310"></a>
-<span class="sourceLineNo">311</span>   */<a name="line.311"></a>
-<span class="sourceLineNo">312</span>  @Deprecated<a name="line.312"></a>
-<span class="sourceLineNo">313</span>  public static String getServerNameLessStartCode(String
inServerName) {<a name="line.313"></a>
-<span class="sourceLineNo">314</span>    if (inServerName != null &amp;&amp;
inServerName.length() &gt; 0) {<a name="line.314"></a>
-<span class="sourceLineNo">315</span>      int index = inServerName.lastIndexOf(SERVERNAME_SEPARATOR);<a
name="line.315"></a>
-<span class="sourceLineNo">316</span>      if (index &gt; 0) {<a name="line.316"></a>
-<span class="sourceLineNo">317</span>        return inServerName.substring(0,
index);<a name="line.317"></a>
-<span class="sourceLineNo">318</span>      }<a name="line.318"></a>
-<span class="sourceLineNo">319</span>    }<a name="line.319"></a>
-<span class="sourceLineNo">320</span>    return inServerName;<a name="line.320"></a>
-<span class="sourceLineNo">321</span>  }<a name="line.321"></a>
-<span class="sourceLineNo">322</span><a name="line.322"></a>
-<span class="sourceLineNo">323</span>  @Override<a name="line.323"></a>
-<span class="sourceLineNo">324</span>  public int compareTo(ServerName other)
{<a name="line.324"></a>
-<span class="sourceLineNo">325</span>    int compare;<a name="line.325"></a>
-<span class="sourceLineNo">326</span>    if (other == null) {<a name="line.326"></a>
-<span class="sourceLineNo">327</span>      return -1;<a name="line.327"></a>
-<span class="sourceLineNo">328</span>    }<a name="line.328"></a>
-<span class="sourceLineNo">329</span>    if (this.getHostname() == null) {<a
name="line.329"></a>
-<span class="sourceLineNo">330</span>      if (other.getHostname() != null) {<a
name="line.330"></a>
-<span class="sourceLineNo">331</span>        return 1;<a name="line.331"></a>
-<span class="sourceLineNo">332</span>      }<a name="line.332"></a>
-<span class="sourceLineNo">333</span>    } else {<a name="line.333"></a>
-<span class="sourceLineNo">334</span>      if (other.getHostname() == null) {<a
name="line.334"></a>
-<span class="sourceLineNo">335</span>        return -1;<a name="line.335"></a>
+<span class="sourceLineNo">295</span>  public Address getAddress() {<a name="line.295"></a>
+<span class="sourceLineNo">296</span>    return this.address;<a name="line.296"></a>
+<span class="sourceLineNo">297</span>  }<a name="line.297"></a>
+<span class="sourceLineNo">298</span><a name="line.298"></a>
+<span class="sourceLineNo">299</span>  /**<a name="line.299"></a>
+<span class="sourceLineNo">300</span>   * @param serverName ServerName in form
specified by {@link #getServerName()}<a name="line.300"></a>
+<span class="sourceLineNo">301</span>   * @return The server start code parsed
from &lt;code&gt;servername&lt;/code&gt;<a name="line.301"></a>
+<span class="sourceLineNo">302</span>   * @deprecated Since 2.0. Use instance
of ServerName to pull out start code.<a name="line.302"></a>
+<span class="sourceLineNo">303</span>   */<a name="line.303"></a>
+<span class="sourceLineNo">304</span>  @Deprecated<a name="line.304"></a>
+<span class="sourceLineNo">305</span>  public static long getServerStartcodeFromServerName(final
String serverName) {<a name="line.305"></a>
+<span class="sourceLineNo">306</span>    int index = serverName.lastIndexOf(SERVERNAME_SEPARATOR);<a
name="line.306"></a>
+<span class="sourceLineNo">307</span>    return Long.parseLong(serverName.substring(index
+ 1));<a name="line.307"></a>
+<span class="sourceLineNo">308</span>  }<a name="line.308"></a>
+<span class="sourceLineNo">309</span><a name="line.309"></a>
+<span class="sourceLineNo">310</span>  /**<a name="line.310"></a>
+<span class="sourceLineNo">311</span>   * Utility method to excise the start
code from a server name<a name="line.311"></a>
+<span class="sourceLineNo">312</span>   * @param inServerName full server name<a
name="line.312"></a>
+<span class="sourceLineNo">313</span>   * @return server name less its start
code<a name="line.313"></a>
+<span class="sourceLineNo">314</span>   * @deprecated Since 2.0. Use {@link #getAddress()}<a
name="line.314"></a>
+<span class="sourceLineNo">315</span>   */<a name="line.315"></a>
+<span class="sourceLineNo">316</span>  @Deprecated<a name="line.316"></a>
+<span class="sourceLineNo">317</span>  public static String getServerNameLessStartCode(String
inServerName) {<a name="line.317"></a>
+<span class="sourceLineNo">318</span>    if (inServerName != null &amp;&amp;
inServerName.length() &gt; 0) {<a name="line.318"></a>
+<span class="sourceLineNo">319</span>      int index = inServerName.lastIndexOf(SERVERNAME_SEPARATOR);<a
name="line.319"></a>
+<span class="sourceLineNo">320</span>      if (index &gt; 0) {<a name="line.320"></a>
+<span class="sourceLineNo">321</span>        return inServerName.substring(0,
index);<a name="line.321"></a>
+<span class="sourceLineNo">322</span>      }<a name="line.322"></a>
+<span class="sourceLineNo">323</span>    }<a name="line.323"></a>
+<span class="sourceLineNo">324</span>    return inServerName;<a name="line.324"></a>
+<span class="sourceLineNo">325</span>  }<a name="line.325"></a>
+<span class="sourceLineNo">326</span><a name="line.326"></a>
+<span class="sourceLineNo">327</span>  @Override<a name="line.327"></a>
+<span class="sourceLineNo">328</span>  public int compareTo(ServerName other)
{<a name="line.328"></a>
+<span class="sourceLineNo">329</span>    int compare;<a name="line.329"></a>
+<span class="sourceLineNo">330</span>    if (other == null) {<a name="line.330"></a>
+<span class="sourceLineNo">331</span>      return -1;<a name="line.331"></a>
+<span class="sourceLineNo">332</span>    }<a name="line.332"></a>
+<span class="sourceLineNo">333</span>    if (this.getHostname() == null) {<a
name="line.333"></a>
+<span class="sourceLineNo">334</span>      if (other.getHostname() != null) {<a
name="line.334"></a>
+<span class="sourceLineNo">335</span>        return 1;<a name="line.335"></a>
 <span class="sourceLineNo">336</span>      }<a name="line.336"></a>
-<span class="sourceLineNo">337</span>      compare = this.getHostname().compareToIgnoreCase(other.getHostname());<a
name="line.337"></a>
-<span class="sourceLineNo">338</span>      if (compare != 0) {<a name="line.338"></a>
-<span class="sourceLineNo">339</span>        return compare;<a name="line.339"></a>
+<span class="sourceLineNo">337</span>    } else {<a name="line.337"></a>
+<span class="sourceLineNo">338</span>      if (other.getHostname() == null) {<a
name="line.338"></a>
+<span class="sourceLineNo">339</span>        return -1;<a name="line.339"></a>
 <span class="sourceLineNo">340</span>      }<a name="line.340"></a>
-<span class="sourceLineNo">341</span>    }<a name="line.341"></a>
-<span class="sourceLineNo">342</span>    compare = this.getPort() - other.getPort();<a
name="line.342"></a>
-<span class="sourceLineNo">343</span>    if (compare != 0) {<a name="line.343"></a>
-<span class="sourceLineNo">344</span>      return compare;<a name="line.344"></a>
+<span class="sourceLineNo">341</span>      compare = this.getHostname().compareToIgnoreCase(other.getHostname());<a
name="line.341"></a>
+<span class="sourceLineNo">342</span>      if (compare != 0) {<a name="line.342"></a>
+<span class="sourceLineNo">343</span>        return compare;<a name="line.343"></a>
+<span class="sourceLineNo">344</span>      }<a name="line.344"></a>
 <span class="sourceLineNo">345</span>    }<a name="line.345"></a>
-<span class="sourceLineNo">346</span>    return Long.compare(this.getStartcode(),
other.getStartcode());<a name="line.346"></a>
-<span class="sourceLineNo">347</span>  }<a name="line.347"></a>
-<span class="sourceLineNo">348</span><a name="line.348"></a>
-<span class="sourceLineNo">349</span>  @Override<a name="line.349"></a>
-<span class="sourceLineNo">350</span>  public int hashCode() {<a name="line.350"></a>
-<span class="sourceLineNo">351</span>    return getServerName().hashCode();<a
name="line.351"></a>
-<span class="sourceLineNo">352</span>  }<a name="line.352"></a>
-<span class="sourceLineNo">353</span><a name="line.353"></a>
-<span class="sourceLineNo">354</span>  @Override<a name="line.354"></a>
-<span class="sourceLineNo">355</span>  public boolean equals(Object o) {<a
name="line.355"></a>
-<span class="sourceLineNo">356</span>    if (this == o) return true;<a name="line.356"></a>
-<span class="sourceLineNo">357</span>    if (o == null) return false;<a name="line.357"></a>
-<span class="sourceLineNo">358</span>    if (!(o instanceof ServerName)) return
false;<a name="line.358"></a>
-<span class="sourceLineNo">359</span>    return this.compareTo((ServerName)o)
== 0;<a name="line.359"></a>
-<span class="sourceLineNo">360</span>  }<a name="line.360"></a>
-<span class="sourceLineNo">361</span><a name="line.361"></a>
-<span class="sourceLineNo">362</span>  /**<a name="line.362"></a>
-<span class="sourceLineNo">363</span>   * @param left<a name="line.363"></a>
-<span class="sourceLineNo">364</span>   * @param right<a name="line.364"></a>
-<span class="sourceLineNo">365</span>   * @return True if &lt;code&gt;other&lt;/code&gt;
has same hostname and port.<a name="line.365"></a>
-<span class="sourceLineNo">366</span>   */<a name="line.366"></a>
-<span class="sourceLineNo">367</span>  public static boolean isSameAddress(final
ServerName left,<a name="line.367"></a>
-<span class="sourceLineNo">368</span>                                      final
ServerName right) {<a name="line.368"></a>
-<span class="sourceLineNo">369</span>    // TODO: Make this left.getAddress().equals(right.getAddress())<a
name="line.369"></a>
-<span class="sourceLineNo">370</span>    if (left == null) return false;<a
name="line.370"></a>
-<span class="sourceLineNo">371</span>    if (right == null) return false;<a
name="line.371"></a>
-<span class="sourceLineNo">372</span>    return left.getHostname().compareToIgnoreCase(right.getHostname())
== 0 &amp;&amp;<a name="line.372"></a>
-<span class="sourceLineNo">373</span>      left.getPort() == right.getPort();<a
name="line.373"></a>
-<span class="sourceLineNo">374</span>  }<a name="line.374"></a>
-<span class="sourceLineNo">375</span><a name="line.375"></a>
-<span class="sourceLineNo">376</span>  /**<a name="line.376"></a>
-<span class="sourceLineNo">377</span>   * Use this method instantiating a {@link
ServerName} from bytes<a name="line.377"></a>
-<span class="sourceLineNo">378</span>   * gotten from a call to {@link #getVersionedBytes()}.
 Will take care of the<a name="line.378"></a>
-<span class="sourceLineNo">379</span>   * case where bytes were written by an
earlier version of hbase.<a name="line.379"></a>
-<span class="sourceLineNo">380</span>   * @param versionedBytes Pass bytes gotten
from a call to {@link #getVersionedBytes()}<a name="line.380"></a>
-<span class="sourceLineNo">381</span>   * @return A ServerName instance.<a
name="line.381"></a>
-<span class="sourceLineNo">382</span>   * @see #getVersionedBytes()<a name="line.382"></a>
-<span class="sourceLineNo">383</span>   */<a name="line.383"></a>
-<span class="sourceLineNo">384</span>  public static ServerName parseVersionedServerName(final
byte [] versionedBytes) {<a name="line.384"></a>
-<span class="sourceLineNo">385</span>    // Version is a short.<a name="line.385"></a>
-<span class="sourceLineNo">386</span>    short version = Bytes.toShort(versionedBytes);<a
name="line.386"></a>
-<span class="sourceLineNo">387</span>    if (version == VERSION) {<a name="line.387"></a>
-<span class="sourceLineNo">388</span>      int length = versionedBytes.length
- Bytes.SIZEOF_SHORT;<a name="line.388"></a>
-<span class="sourceLineNo">389</span>      return valueOf(Bytes.toString(versionedBytes,
Bytes.SIZEOF_SHORT, length));<a name="line.389"></a>
-<span class="sourceLineNo">390</span>    }<a name="line.390"></a>
-<span class="sourceLineNo">391</span>    // Presume the bytes were written with
an old version of hbase and that the<a name="line.391"></a>
-<span class="sourceLineNo">392</span>    // bytes are actually a String of the
form "'&lt;hostname&gt;' ':' '&lt;port&gt;'".<a name="line.392"></a>
-<span class="sourceLineNo">393</span>    return valueOf(Bytes.toString(versionedBytes),
NON_STARTCODE);<a name="line.393"></a>
-<span class="sourceLineNo">394</span>  }<a name="line.394"></a>
-<span class="sourceLineNo">395</span><a name="line.395"></a>
-<span class="sourceLineNo">396</span>  /**<a name="line.396"></a>
-<span class="sourceLineNo">397</span>   * @param str Either an instance of {@link
ServerName#toString()} or a<a name="line.397"></a>
-<span class="sourceLineNo">398</span>   * "'&amp;lt;hostname&amp;gt;'
':' '&amp;lt;port&amp;gt;'".<a name="line.398"></a>
-<span class="sourceLineNo">399</span>   * @return A ServerName instance.<a
name="line.399"></a>
-<span class="sourceLineNo">400</span>   */<a name="line.400"></a>
-<span class="sourceLineNo">401</span>  public static ServerName parseServerName(final
String str) {<a name="line.401"></a>
-<span class="sourceLineNo">402</span>    return SERVERNAME_PATTERN.matcher(str).matches()?
valueOf(str) :<a name="line.402"></a>
-<span class="sourceLineNo">403</span>        valueOf(str, NON_STARTCODE);<a
name="line.403"></a>
-<span class="sourceLineNo">404</span>  }<a name="line.404"></a>
-<span class="sourceLineNo">405</span><a name="line.405"></a>
-<span class="sourceLineNo">406</span><a name="line.406"></a>
-<span class="sourceLineNo">407</span>  /**<a name="line.407"></a>
-<span class="sourceLineNo">408</span>   * @return true if the String follows
the pattern of {@link ServerName#toString()}, false<a name="line.408"></a>
-<span class="sourceLineNo">409</span>   *  otherwise.<a name="line.409"></a>
-<span class="sourceLineNo">410</span>   */<a name="line.410"></a>
-<span class="sourceLineNo">411</span>  public static boolean isFullServerName(final
String str){<a name="line.411"></a>
-<span class="sourceLineNo">412</span>    if (str == null ||str.isEmpty()) return
false;<a name="line.412"></a>
-<span class="sourceLineNo">413</span>    return SERVERNAME_PATTERN.matcher(str).matches();<a
name="line.413"></a>
-<span class="sourceLineNo">414</span>  }<a name="line.414"></a>
-<span class="sourceLineNo">415</span>}<a name="line.415"></a>
+<span class="sourceLineNo">346</span>    compare = this.getPort() - other.getPort();<a
name="line.346"></a>
+<span class="sourceLineNo">347</span>    if (compare != 0) {<a name="line.347"></a>
+<span class="sourceLineNo">348</span>      return compare;<a name="line.348"></a>
+<span class="sourceLineNo">349</span>    }<a name="line.349"></a>
+<span class="sourceLineNo">350</span>    return Long.compare(this.getStartcode(),
other.getStartcode());<a name="line.350"></a>
+<span class="sourceLineNo">351</span>  }<a name="line.351"></a>
+<span class="sourceLineNo">352</span><a name="line.352"></a>
+<span class="sourceLineNo">353</span>  @Override<a name="line.353"></a>
+<span class="sourceLineNo">354</span>  public int hashCode() {<a name="line.354"></a>
+<span class="sourceLineNo">355</span>    return getServerName().hashCode();<a
name="line.355"></a>
+<span class="sourceLineNo">356</span>  }<a name="line.356"></a>
+<span class="sourceLineNo">357</span><a name="line.357"></a>
+<span class="sourceLineNo">358</span>  @Override<a name="line.358"></a>
+<span class="sourceLineNo">359</span>  public boolean equals(Object o) {<a
name="line.359"></a>
+<span class="sourceLineNo">360</span>    if (this == o) return true;<a name="line.360"></a>
+<span class="sourceLineNo">361</span>    if (o == null) return false;<a name="line.361"></a>
+<span class="sourceLineNo">362</span>    if (!(o instanceof ServerName)) return
false;<a name="line.362"></a>
+<span class="sourceLineNo">363</span>    return this.compareTo((ServerName)o)
== 0;<a name="line.363"></a>
+<span class="sourceLineNo">364</span>  }<a name="line.364"></a>
+<span class="sourceLineNo">365</span><a name="line.365"></a>
+<span class="sourceLineNo">366</span>  /**<a name="line.366"></a>
+<span class="sourceLineNo">367</span>   * @param left<a name="line.367"></a>
+<span class="sourceLineNo">368</span>   * @param right<a name="line.368"></a>
+<span class="sourceLineNo">369</span>   * @return True if &lt;code&gt;other&lt;/code&gt;
has same hostname and port.<a name="line.369"></a>
+<span class="sourceLineNo">370</span>   */<a name="line.370"></a>
+<span class="sourceLineNo">371</span>  public static boolean isSameAddress(final
ServerName left,<a name="line.371"></a>
+<span class="sourceLineNo">372</span>                                      final
ServerName right) {<a name="line.372"></a>
+<span class="sourceLineNo">373</span>    // TODO: Make this left.getAddress().equals(right.getAddress())<a
name="line.373"></a>
+<span class="sourceLineNo">374</span>    if (left == null) return false;<a
name="line.374"></a>
+<span class="sourceLineNo">375</span>    if (right == null) return false;<a
name="line.375"></a>
+<span class="sourceLineNo">376</span>    return left.getHostname().compareToIgnoreCase(right.getHostname())
== 0 &amp;&amp;<a name="line.376"></a>
+<span class="sourceLineNo">377</span>      left.getPort() == right.getPort();<a
name="line.377"></a>
+<span class="sourceLineNo">378</span>  }<a name="line.378"></a>
+<span class="sourceLineNo">379</span><a name="line.379"></a>
+<span class="sourceLineNo">380</span>  /**<a name="line.380"></a>
+<span class="sourceLineNo">381</span>   * Use this method instantiating a {@link
ServerName} from bytes<a name="line.381"></a>
+<span class="sourceLineNo">382</span>   * gotten from a call to {@link #getVersionedBytes()}.
 Will take care of the<a name="line.382"></a>
+<span class="sourceLineNo">383</span>   * case where bytes were written by an
earlier version of hbase.<a name="line.383"></a>
+<span class="sourceLineNo">384</span>   * @param versionedBytes Pass bytes gotten
from a call to {@link #getVersionedBytes()}<a name="line.384"></a>
+<span class="sourceLineNo">385</span>   * @return A ServerName instance.<a
name="line.385"></a>
+<span class="sourceLineNo">386</span>   * @see #getVersionedBytes()<a name="line.386"></a>
+<span class="sourceLineNo">387</span>   */<a name="line.387"></a>
+<span class="sourceLineNo">388</span>  public static ServerName parseVersionedServerName(final
byte [] versionedBytes) {<a name="line.388"></a>
+<span class="sourceLineNo">389</span>    // Version is a short.<a name="line.389"></a>
+<span class="sourceLineNo">390</span>    short version = Bytes.toShort(versionedBytes);<a
name="line.390"></a>
+<span class="sourceLineNo">391</span>    if (version == VERSION) {<a name="line.391"></a>
+<span class="sourceLineNo">392</span>      int length = versionedBytes.length
- Bytes.SIZEOF_SHORT;<a name="line.392"></a>
+<span class="sourceLineNo">393</span>      return valueOf(Bytes.toString(versionedBytes,
Bytes.SIZEOF_SHORT, length));<a name="line.393"></a>
+<span class="sourceLineNo">394</span>    }<a name="line.394"></a>
+<span class="sourceLineNo">395</span>    // Presume the bytes were written with
an old version of hbase and that the<a name="line.395"></a>
+<span class="sourceLineNo">396</span>    // bytes are actually a String of the
form "'&lt;hostname&gt;' ':' '&lt;port&gt;'".<a name="line.396"></a>
+<span class="sourceLineNo">397</span>    return valueOf(Bytes.toString(versionedBytes),
NON_STARTCODE);<a name="line.397"></a>
+<span class="sourceLineNo">398</span>  }<a name="line.398"></a>
+<span class="sourceLineNo">399</span><a name="line.399"></a>
+<span class="sourceLineNo">400</span>  /**<a name="line.400"></a>
+<span class="sourceLineNo">401</span>   * @param str Either an instance of {@link
ServerName#toString()} or a<a name="line.401"></a>
+<span class="sourceLineNo">402</span>   * "'&amp;lt;hostname&amp;gt;'
':' '&amp;lt;port&amp;gt;'".<a name="line.402"></a>
+<span class="sourceLineNo">403</span>   * @return A ServerName instance.<a
name="line.403"></a>
+<span class="sourceLineNo">404</span>   */<a name="line.404"></a>
+<span class="sourceLineNo">405</span>  public static ServerName parseServerName(final
String str) {<a name="line.405"></a>
+<span class="sourceLineNo">406</span>    return SERVERNAME_PATTERN.matcher(str).matches()?
valueOf(str) :<a name="line.406"></a>
+<span class="sourceLineNo">407</span>        valueOf(str, NON_STARTCODE);<a
name="line.407"></a>
+<span class="sourceLineNo">408</span>  }<a name="line.408"></a>
+<span class="sourceLineNo">409</span><a name="line.409"></a>
+<span class="sourceLineNo">410</span><a name="line.410"></a>
+<span class="sourceLineNo">411</span>  /**<a name="line.411"></a>
+<span class="sourceLineNo">412</span>   * @return true if the String follows
the pattern of {@link ServerName#toString()}, false<a name="line.412"></a>
+<span class="sourceLineNo">413</span>   *  otherwise.<a name="line.413"></a>
+<span class="sourceLineNo">414</span>   */<a name="line.414"></a>
+<span class="sourceLineNo">415</span>  public static boolean isFullServerName(final
String str){<a name="line.415"></a>
+<span class="sourceLineNo">416</span>    if (str == null ||str.isEmpty()) return
false;<a name="line.416"></a>
+<span class="sourceLineNo">417</span>    return SERVERNAME_PATTERN.matcher(str).matches();<a
name="line.417"></a>
+<span class="sourceLineNo">418</span>  }<a name="line.418"></a>
+<span class="sourceLineNo">419</span>}<a name="line.419"></a>
 
 
 


Mime
View raw message