PageRenderTime 56ms CodeModel.GetById 19ms RepoModel.GetById 0ms app.codeStats 1ms

/hadoop-0.20.2/hadoop-0.20.2/docs/api/org/apache/hadoop/net/NetUtils.html

https://bitbucket.org/vtangirala/venu
HTML | 743 lines | 651 code | 70 blank | 22 comment | 0 complexity | 1e4be4081d2c6912f1a4634c01398124 MD5 | raw file
Possible License(s): Apache-2.0, BSD-3-Clause, LGPL-3.0, EPL-1.0
  1. <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
  2. <!--NewPage-->
  3. <HTML>
  4. <HEAD>
  5. <!-- Generated by javadoc (build 1.6.0_07) on Fri Feb 19 08:07:58 UTC 2010 -->
  6. <TITLE>
  7. NetUtils (Hadoop 0.20.2 API)
  8. </TITLE>
  9. <META NAME="date" CONTENT="2010-02-19">
  10. <LINK REL ="stylesheet" TYPE="text/css" HREF="../../../../stylesheet.css" TITLE="Style">
  11. <SCRIPT type="text/javascript">
  12. function windowTitle()
  13. {
  14. if (location.href.indexOf('is-external=true') == -1) {
  15. parent.document.title="NetUtils (Hadoop 0.20.2 API)";
  16. }
  17. }
  18. </SCRIPT>
  19. <NOSCRIPT>
  20. </NOSCRIPT>
  21. </HEAD>
  22. <BODY BGCOLOR="white" onload="windowTitle();">
  23. <HR>
  24. <!-- ========= START OF TOP NAVBAR ======= -->
  25. <A NAME="navbar_top"><!-- --></A>
  26. <A HREF="#skip-navbar_top" title="Skip navigation links"></A>
  27. <TABLE BORDER="0" WIDTH="100%" CELLPADDING="1" CELLSPACING="0" SUMMARY="">
  28. <TR>
  29. <TD COLSPAN=2 BGCOLOR="#EEEEFF" CLASS="NavBarCell1">
  30. <A NAME="navbar_top_firstrow"><!-- --></A>
  31. <TABLE BORDER="0" CELLPADDING="0" CELLSPACING="3" SUMMARY="">
  32. <TR ALIGN="center" VALIGN="top">
  33. <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../overview-summary.html"><FONT CLASS="NavBarFont1"><B>Overview</B></FONT></A>&nbsp;</TD>
  34. <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="package-summary.html"><FONT CLASS="NavBarFont1"><B>Package</B></FONT></A>&nbsp;</TD>
  35. <TD BGCOLOR="#FFFFFF" CLASS="NavBarCell1Rev"> &nbsp;<FONT CLASS="NavBarFont1Rev"><B>Class</B></FONT>&nbsp;</TD>
  36. <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="class-use/NetUtils.html"><FONT CLASS="NavBarFont1"><B>Use</B></FONT></A>&nbsp;</TD>
  37. <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="package-tree.html"><FONT CLASS="NavBarFont1"><B>Tree</B></FONT></A>&nbsp;</TD>
  38. <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../deprecated-list.html"><FONT CLASS="NavBarFont1"><B>Deprecated</B></FONT></A>&nbsp;</TD>
  39. <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../index-all.html"><FONT CLASS="NavBarFont1"><B>Index</B></FONT></A>&nbsp;</TD>
  40. <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../help-doc.html"><FONT CLASS="NavBarFont1"><B>Help</B></FONT></A>&nbsp;</TD>
  41. </TR>
  42. </TABLE>
  43. </TD>
  44. <TD ALIGN="right" VALIGN="top" ROWSPAN=3><EM>
  45. </EM>
  46. </TD>
  47. </TR>
  48. <TR>
  49. <TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2">
  50. &nbsp;<A HREF="../../../../org/apache/hadoop/net/DNSToSwitchMapping.html" title="interface in org.apache.hadoop.net"><B>PREV CLASS</B></A>&nbsp;
  51. &nbsp;<A HREF="../../../../org/apache/hadoop/net/NetworkTopology.html" title="class in org.apache.hadoop.net"><B>NEXT CLASS</B></A></FONT></TD>
  52. <TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2">
  53. <A HREF="../../../../index.html?org/apache/hadoop/net/NetUtils.html" target="_top"><B>FRAMES</B></A> &nbsp;
  54. &nbsp;<A HREF="NetUtils.html" target="_top"><B>NO FRAMES</B></A> &nbsp;
  55. &nbsp;<SCRIPT type="text/javascript">
  56. <!--
  57. if(window==top) {
  58. document.writeln('<A HREF="../../../../allclasses-noframe.html"><B>All Classes</B></A>');
  59. }
  60. //-->
  61. </SCRIPT>
  62. <NOSCRIPT>
  63. <A HREF="../../../../allclasses-noframe.html"><B>All Classes</B></A>
  64. </NOSCRIPT>
  65. </FONT></TD>
  66. </TR>
  67. <TR>
  68. <TD VALIGN="top" CLASS="NavBarCell3"><FONT SIZE="-2">
  69. SUMMARY:&nbsp;NESTED&nbsp;|&nbsp;FIELD&nbsp;|&nbsp;<A HREF="#constructor_summary">CONSTR</A>&nbsp;|&nbsp;<A HREF="#method_summary">METHOD</A></FONT></TD>
  70. <TD VALIGN="top" CLASS="NavBarCell3"><FONT SIZE="-2">
  71. DETAIL:&nbsp;FIELD&nbsp;|&nbsp;<A HREF="#constructor_detail">CONSTR</A>&nbsp;|&nbsp;<A HREF="#method_detail">METHOD</A></FONT></TD>
  72. </TR>
  73. </TABLE>
  74. <A NAME="skip-navbar_top"></A>
  75. <!-- ========= END OF TOP NAVBAR ========= -->
  76. <HR>
  77. <!-- ======== START OF CLASS DATA ======== -->
  78. <H2>
  79. <FONT SIZE="-1">
  80. org.apache.hadoop.net</FONT>
  81. <BR>
  82. Class NetUtils</H2>
  83. <PRE>
  84. <A HREF="http://java.sun.com/javase/6/docs/api/java/lang/Object.html?is-external=true" title="class or interface in java.lang">java.lang.Object</A>
  85. <IMG SRC="../../../../resources/inherit.gif" ALT="extended by "><B>org.apache.hadoop.net.NetUtils</B>
  86. </PRE>
  87. <HR>
  88. <DL>
  89. <DT><PRE>public class <B>NetUtils</B><DT>extends <A HREF="http://java.sun.com/javase/6/docs/api/java/lang/Object.html?is-external=true" title="class or interface in java.lang">Object</A></DL>
  90. </PRE>
  91. <P>
  92. <HR>
  93. <P>
  94. <!-- ======== CONSTRUCTOR SUMMARY ======== -->
  95. <A NAME="constructor_summary"><!-- --></A>
  96. <TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY="">
  97. <TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor">
  98. <TH ALIGN="left" COLSPAN="2"><FONT SIZE="+2">
  99. <B>Constructor Summary</B></FONT></TH>
  100. </TR>
  101. <TR BGCOLOR="white" CLASS="TableRowColor">
  102. <TD><CODE><B><A HREF="../../../../org/apache/hadoop/net/NetUtils.html#NetUtils()">NetUtils</A></B>()</CODE>
  103. <BR>
  104. &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</TD>
  105. </TR>
  106. </TABLE>
  107. &nbsp;
  108. <!-- ========== METHOD SUMMARY =========== -->
  109. <A NAME="method_summary"><!-- --></A>
  110. <TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY="">
  111. <TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor">
  112. <TH ALIGN="left" COLSPAN="2"><FONT SIZE="+2">
  113. <B>Method Summary</B></FONT></TH>
  114. </TR>
  115. <TR BGCOLOR="white" CLASS="TableRowColor">
  116. <TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
  117. <CODE>static&nbsp;void</CODE></FONT></TD>
  118. <TD><CODE><B><A HREF="../../../../org/apache/hadoop/net/NetUtils.html#addStaticResolution(java.lang.String, java.lang.String)">addStaticResolution</A></B>(<A HREF="http://java.sun.com/javase/6/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</A>&nbsp;host,
  119. <A HREF="http://java.sun.com/javase/6/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</A>&nbsp;resolvedName)</CODE>
  120. <BR>
  121. &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Adds a static resolution for host.</TD>
  122. </TR>
  123. <TR BGCOLOR="white" CLASS="TableRowColor">
  124. <TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
  125. <CODE>static&nbsp;void</CODE></FONT></TD>
  126. <TD><CODE><B><A HREF="../../../../org/apache/hadoop/net/NetUtils.html#connect(java.net.Socket, java.net.SocketAddress, int)">connect</A></B>(<A HREF="http://java.sun.com/javase/6/docs/api/java/net/Socket.html?is-external=true" title="class or interface in java.net">Socket</A>&nbsp;socket,
  127. <A HREF="http://java.sun.com/javase/6/docs/api/java/net/SocketAddress.html?is-external=true" title="class or interface in java.net">SocketAddress</A>&nbsp;endpoint,
  128. int&nbsp;timeout)</CODE>
  129. <BR>
  130. &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;This is a drop-in replacement for
  131. <A HREF="http://java.sun.com/javase/6/docs/api/java/net/Socket.html?is-external=true#connect(java.net.SocketAddress, int)" title="class or interface in java.net"><CODE>Socket.connect(SocketAddress, int)</CODE></A>.</TD>
  132. </TR>
  133. <TR BGCOLOR="white" CLASS="TableRowColor">
  134. <TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
  135. <CODE>static&nbsp;<A HREF="http://java.sun.com/javase/6/docs/api/java/net/InetSocketAddress.html?is-external=true" title="class or interface in java.net">InetSocketAddress</A></CODE></FONT></TD>
  136. <TD><CODE><B><A HREF="../../../../org/apache/hadoop/net/NetUtils.html#createSocketAddr(java.lang.String)">createSocketAddr</A></B>(<A HREF="http://java.sun.com/javase/6/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</A>&nbsp;target)</CODE>
  137. <BR>
  138. &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Util method to build socket addr from either:
  139. <host>:<post>
  140. <fs>://<host>:<port>/<path></TD>
  141. </TR>
  142. <TR BGCOLOR="white" CLASS="TableRowColor">
  143. <TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
  144. <CODE>static&nbsp;<A HREF="http://java.sun.com/javase/6/docs/api/java/net/InetSocketAddress.html?is-external=true" title="class or interface in java.net">InetSocketAddress</A></CODE></FONT></TD>
  145. <TD><CODE><B><A HREF="../../../../org/apache/hadoop/net/NetUtils.html#createSocketAddr(java.lang.String, int)">createSocketAddr</A></B>(<A HREF="http://java.sun.com/javase/6/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</A>&nbsp;target,
  146. int&nbsp;defaultPort)</CODE>
  147. <BR>
  148. &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Util method to build socket addr from either:
  149. <host>
  150. <host>:<post>
  151. <fs>://<host>:<port>/<path></TD>
  152. </TR>
  153. <TR BGCOLOR="white" CLASS="TableRowColor">
  154. <TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
  155. <CODE>static&nbsp;<A HREF="http://java.sun.com/javase/6/docs/api/java/util/List.html?is-external=true" title="class or interface in java.util">List</A>&lt;<A HREF="http://java.sun.com/javase/6/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</A>[]&gt;</CODE></FONT></TD>
  156. <TD><CODE><B><A HREF="../../../../org/apache/hadoop/net/NetUtils.html#getAllStaticResolutions()">getAllStaticResolutions</A></B>()</CODE>
  157. <BR>
  158. &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;This is used to get all the resolutions that were added using
  159. <A HREF="../../../../org/apache/hadoop/net/NetUtils.html#addStaticResolution(java.lang.String, java.lang.String)"><CODE>addStaticResolution(String, String)</CODE></A>.</TD>
  160. </TR>
  161. <TR BGCOLOR="white" CLASS="TableRowColor">
  162. <TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
  163. <CODE>static&nbsp;<A HREF="http://java.sun.com/javase/6/docs/api/java/net/InetSocketAddress.html?is-external=true" title="class or interface in java.net">InetSocketAddress</A></CODE></FONT></TD>
  164. <TD><CODE><B><A HREF="../../../../org/apache/hadoop/net/NetUtils.html#getConnectAddress(org.apache.hadoop.ipc.Server)">getConnectAddress</A></B>(<A HREF="../../../../org/apache/hadoop/ipc/Server.html" title="class in org.apache.hadoop.ipc">Server</A>&nbsp;server)</CODE>
  165. <BR>
  166. &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Returns InetSocketAddress that a client can use to
  167. connect to the server.</TD>
  168. </TR>
  169. <TR BGCOLOR="white" CLASS="TableRowColor">
  170. <TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
  171. <CODE>static&nbsp;<A HREF="http://java.sun.com/javase/6/docs/api/javax/net/SocketFactory.html?is-external=true" title="class or interface in javax.net">SocketFactory</A></CODE></FONT></TD>
  172. <TD><CODE><B><A HREF="../../../../org/apache/hadoop/net/NetUtils.html#getDefaultSocketFactory(org.apache.hadoop.conf.Configuration)">getDefaultSocketFactory</A></B>(<A HREF="../../../../org/apache/hadoop/conf/Configuration.html" title="class in org.apache.hadoop.conf">Configuration</A>&nbsp;conf)</CODE>
  173. <BR>
  174. &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Get the default socket factory as specified by the configuration
  175. parameter <tt>hadoop.rpc.socket.factory.default</tt></TD>
  176. </TR>
  177. <TR BGCOLOR="white" CLASS="TableRowColor">
  178. <TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
  179. <CODE>static&nbsp;<A HREF="http://java.sun.com/javase/6/docs/api/java/io/InputStream.html?is-external=true" title="class or interface in java.io">InputStream</A></CODE></FONT></TD>
  180. <TD><CODE><B><A HREF="../../../../org/apache/hadoop/net/NetUtils.html#getInputStream(java.net.Socket)">getInputStream</A></B>(<A HREF="http://java.sun.com/javase/6/docs/api/java/net/Socket.html?is-external=true" title="class or interface in java.net">Socket</A>&nbsp;socket)</CODE>
  181. <BR>
  182. &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Same as getInputStream(socket, socket.getSoTimeout()).<br><br>
  183. From documentation for <A HREF="../../../../org/apache/hadoop/net/NetUtils.html#getInputStream(java.net.Socket, long)"><CODE>getInputStream(Socket, long)</CODE></A>:<br>
  184. Returns InputStream for the socket.</TD>
  185. </TR>
  186. <TR BGCOLOR="white" CLASS="TableRowColor">
  187. <TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
  188. <CODE>static&nbsp;<A HREF="http://java.sun.com/javase/6/docs/api/java/io/InputStream.html?is-external=true" title="class or interface in java.io">InputStream</A></CODE></FONT></TD>
  189. <TD><CODE><B><A HREF="../../../../org/apache/hadoop/net/NetUtils.html#getInputStream(java.net.Socket, long)">getInputStream</A></B>(<A HREF="http://java.sun.com/javase/6/docs/api/java/net/Socket.html?is-external=true" title="class or interface in java.net">Socket</A>&nbsp;socket,
  190. long&nbsp;timeout)</CODE>
  191. <BR>
  192. &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Returns InputStream for the socket.</TD>
  193. </TR>
  194. <TR BGCOLOR="white" CLASS="TableRowColor">
  195. <TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
  196. <CODE>static&nbsp;<A HREF="http://java.sun.com/javase/6/docs/api/java/io/OutputStream.html?is-external=true" title="class or interface in java.io">OutputStream</A></CODE></FONT></TD>
  197. <TD><CODE><B><A HREF="../../../../org/apache/hadoop/net/NetUtils.html#getOutputStream(java.net.Socket)">getOutputStream</A></B>(<A HREF="http://java.sun.com/javase/6/docs/api/java/net/Socket.html?is-external=true" title="class or interface in java.net">Socket</A>&nbsp;socket)</CODE>
  198. <BR>
  199. &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Same as getOutputStream(socket, 0).</TD>
  200. </TR>
  201. <TR BGCOLOR="white" CLASS="TableRowColor">
  202. <TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
  203. <CODE>static&nbsp;<A HREF="http://java.sun.com/javase/6/docs/api/java/io/OutputStream.html?is-external=true" title="class or interface in java.io">OutputStream</A></CODE></FONT></TD>
  204. <TD><CODE><B><A HREF="../../../../org/apache/hadoop/net/NetUtils.html#getOutputStream(java.net.Socket, long)">getOutputStream</A></B>(<A HREF="http://java.sun.com/javase/6/docs/api/java/net/Socket.html?is-external=true" title="class or interface in java.net">Socket</A>&nbsp;socket,
  205. long&nbsp;timeout)</CODE>
  206. <BR>
  207. &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Returns OutputStream for the socket.</TD>
  208. </TR>
  209. <TR BGCOLOR="white" CLASS="TableRowColor">
  210. <TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
  211. <CODE>static&nbsp;<A HREF="http://java.sun.com/javase/6/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</A></CODE></FONT></TD>
  212. <TD><CODE><B><A HREF="../../../../org/apache/hadoop/net/NetUtils.html#getServerAddress(org.apache.hadoop.conf.Configuration, java.lang.String, java.lang.String, java.lang.String)">getServerAddress</A></B>(<A HREF="../../../../org/apache/hadoop/conf/Configuration.html" title="class in org.apache.hadoop.conf">Configuration</A>&nbsp;conf,
  213. <A HREF="http://java.sun.com/javase/6/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</A>&nbsp;oldBindAddressName,
  214. <A HREF="http://java.sun.com/javase/6/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</A>&nbsp;oldPortName,
  215. <A HREF="http://java.sun.com/javase/6/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</A>&nbsp;newBindAddressName)</CODE>
  216. <BR>
  217. &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<B>Deprecated.</B>&nbsp;</TD>
  218. </TR>
  219. <TR BGCOLOR="white" CLASS="TableRowColor">
  220. <TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
  221. <CODE>static&nbsp;<A HREF="http://java.sun.com/javase/6/docs/api/javax/net/SocketFactory.html?is-external=true" title="class or interface in javax.net">SocketFactory</A></CODE></FONT></TD>
  222. <TD><CODE><B><A HREF="../../../../org/apache/hadoop/net/NetUtils.html#getSocketFactory(org.apache.hadoop.conf.Configuration, java.lang.Class)">getSocketFactory</A></B>(<A HREF="../../../../org/apache/hadoop/conf/Configuration.html" title="class in org.apache.hadoop.conf">Configuration</A>&nbsp;conf,
  223. <A HREF="http://java.sun.com/javase/6/docs/api/java/lang/Class.html?is-external=true" title="class or interface in java.lang">Class</A>&lt;?&gt;&nbsp;clazz)</CODE>
  224. <BR>
  225. &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Get the socket factory for the given class according to its
  226. configuration parameter
  227. <tt>hadoop.rpc.socket.factory.class.&lt;ClassName&gt;</tt>.</TD>
  228. </TR>
  229. <TR BGCOLOR="white" CLASS="TableRowColor">
  230. <TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
  231. <CODE>static&nbsp;<A HREF="http://java.sun.com/javase/6/docs/api/javax/net/SocketFactory.html?is-external=true" title="class or interface in javax.net">SocketFactory</A></CODE></FONT></TD>
  232. <TD><CODE><B><A HREF="../../../../org/apache/hadoop/net/NetUtils.html#getSocketFactoryFromProperty(org.apache.hadoop.conf.Configuration, java.lang.String)">getSocketFactoryFromProperty</A></B>(<A HREF="../../../../org/apache/hadoop/conf/Configuration.html" title="class in org.apache.hadoop.conf">Configuration</A>&nbsp;conf,
  233. <A HREF="http://java.sun.com/javase/6/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</A>&nbsp;propValue)</CODE>
  234. <BR>
  235. &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Get the socket factory corresponding to the given proxy URI.</TD>
  236. </TR>
  237. <TR BGCOLOR="white" CLASS="TableRowColor">
  238. <TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
  239. <CODE>static&nbsp;<A HREF="http://java.sun.com/javase/6/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</A></CODE></FONT></TD>
  240. <TD><CODE><B><A HREF="../../../../org/apache/hadoop/net/NetUtils.html#getStaticResolution(java.lang.String)">getStaticResolution</A></B>(<A HREF="http://java.sun.com/javase/6/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</A>&nbsp;host)</CODE>
  241. <BR>
  242. &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Retrieves the resolved name for the passed host.</TD>
  243. </TR>
  244. <TR BGCOLOR="white" CLASS="TableRowColor">
  245. <TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
  246. <CODE>static&nbsp;<A HREF="http://java.sun.com/javase/6/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</A></CODE></FONT></TD>
  247. <TD><CODE><B><A HREF="../../../../org/apache/hadoop/net/NetUtils.html#normalizeHostName(java.lang.String)">normalizeHostName</A></B>(<A HREF="http://java.sun.com/javase/6/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</A>&nbsp;name)</CODE>
  248. <BR>
  249. &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Given a string representation of a host, return its ip address
  250. in textual presentation.</TD>
  251. </TR>
  252. <TR BGCOLOR="white" CLASS="TableRowColor">
  253. <TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
  254. <CODE>static&nbsp;<A HREF="http://java.sun.com/javase/6/docs/api/java/util/List.html?is-external=true" title="class or interface in java.util">List</A>&lt;<A HREF="http://java.sun.com/javase/6/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</A>&gt;</CODE></FONT></TD>
  255. <TD><CODE><B><A HREF="../../../../org/apache/hadoop/net/NetUtils.html#normalizeHostNames(java.util.Collection)">normalizeHostNames</A></B>(<A HREF="http://java.sun.com/javase/6/docs/api/java/util/Collection.html?is-external=true" title="class or interface in java.util">Collection</A>&lt;<A HREF="http://java.sun.com/javase/6/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</A>&gt;&nbsp;names)</CODE>
  256. <BR>
  257. &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Given a collection of string representation of hosts, return a list of
  258. corresponding IP addresses in the textual representation.</TD>
  259. </TR>
  260. </TABLE>
  261. &nbsp;<A NAME="methods_inherited_from_class_java.lang.Object"><!-- --></A>
  262. <TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY="">
  263. <TR BGCOLOR="#EEEEFF" CLASS="TableSubHeadingColor">
  264. <TH ALIGN="left"><B>Methods inherited from class java.lang.<A HREF="http://java.sun.com/javase/6/docs/api/java/lang/Object.html?is-external=true" title="class or interface in java.lang">Object</A></B></TH>
  265. </TR>
  266. <TR BGCOLOR="white" CLASS="TableRowColor">
  267. <TD><CODE><A HREF="http://java.sun.com/javase/6/docs/api/java/lang/Object.html?is-external=true#clone()" title="class or interface in java.lang">clone</A>, <A HREF="http://java.sun.com/javase/6/docs/api/java/lang/Object.html?is-external=true#equals(java.lang.Object)" title="class or interface in java.lang">equals</A>, <A HREF="http://java.sun.com/javase/6/docs/api/java/lang/Object.html?is-external=true#finalize()" title="class or interface in java.lang">finalize</A>, <A HREF="http://java.sun.com/javase/6/docs/api/java/lang/Object.html?is-external=true#getClass()" title="class or interface in java.lang">getClass</A>, <A HREF="http://java.sun.com/javase/6/docs/api/java/lang/Object.html?is-external=true#hashCode()" title="class or interface in java.lang">hashCode</A>, <A HREF="http://java.sun.com/javase/6/docs/api/java/lang/Object.html?is-external=true#notify()" title="class or interface in java.lang">notify</A>, <A HREF="http://java.sun.com/javase/6/docs/api/java/lang/Object.html?is-external=true#notifyAll()" title="class or interface in java.lang">notifyAll</A>, <A HREF="http://java.sun.com/javase/6/docs/api/java/lang/Object.html?is-external=true#toString()" title="class or interface in java.lang">toString</A>, <A HREF="http://java.sun.com/javase/6/docs/api/java/lang/Object.html?is-external=true#wait()" title="class or interface in java.lang">wait</A>, <A HREF="http://java.sun.com/javase/6/docs/api/java/lang/Object.html?is-external=true#wait(long)" title="class or interface in java.lang">wait</A>, <A HREF="http://java.sun.com/javase/6/docs/api/java/lang/Object.html?is-external=true#wait(long, int)" title="class or interface in java.lang">wait</A></CODE></TD>
  268. </TR>
  269. </TABLE>
  270. &nbsp;
  271. <P>
  272. <!-- ========= CONSTRUCTOR DETAIL ======== -->
  273. <A NAME="constructor_detail"><!-- --></A>
  274. <TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY="">
  275. <TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor">
  276. <TH ALIGN="left" COLSPAN="1"><FONT SIZE="+2">
  277. <B>Constructor Detail</B></FONT></TH>
  278. </TR>
  279. </TABLE>
  280. <A NAME="NetUtils()"><!-- --></A><H3>
  281. NetUtils</H3>
  282. <PRE>
  283. public <B>NetUtils</B>()</PRE>
  284. <DL>
  285. </DL>
  286. <!-- ============ METHOD DETAIL ========== -->
  287. <A NAME="method_detail"><!-- --></A>
  288. <TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY="">
  289. <TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor">
  290. <TH ALIGN="left" COLSPAN="1"><FONT SIZE="+2">
  291. <B>Method Detail</B></FONT></TH>
  292. </TR>
  293. </TABLE>
  294. <A NAME="getSocketFactory(org.apache.hadoop.conf.Configuration, java.lang.Class)"><!-- --></A><H3>
  295. getSocketFactory</H3>
  296. <PRE>
  297. public static <A HREF="http://java.sun.com/javase/6/docs/api/javax/net/SocketFactory.html?is-external=true" title="class or interface in javax.net">SocketFactory</A> <B>getSocketFactory</B>(<A HREF="../../../../org/apache/hadoop/conf/Configuration.html" title="class in org.apache.hadoop.conf">Configuration</A>&nbsp;conf,
  298. <A HREF="http://java.sun.com/javase/6/docs/api/java/lang/Class.html?is-external=true" title="class or interface in java.lang">Class</A>&lt;?&gt;&nbsp;clazz)</PRE>
  299. <DL>
  300. <DD>Get the socket factory for the given class according to its
  301. configuration parameter
  302. <tt>hadoop.rpc.socket.factory.class.&lt;ClassName&gt;</tt>. When no
  303. such parameter exists then fall back on the default socket factory as
  304. configured by <tt>hadoop.rpc.socket.factory.class.default</tt>. If
  305. this default socket factory is not configured, then fall back on the JVM
  306. default socket factory.
  307. <P>
  308. <DD><DL>
  309. <DT><B>Parameters:</B><DD><CODE>conf</CODE> - the configuration<DD><CODE>clazz</CODE> - the class (usually a <A HREF="../../../../org/apache/hadoop/ipc/VersionedProtocol.html" title="interface in org.apache.hadoop.ipc"><CODE>VersionedProtocol</CODE></A>)
  310. <DT><B>Returns:</B><DD>a socket factory</DL>
  311. </DD>
  312. </DL>
  313. <HR>
  314. <A NAME="getDefaultSocketFactory(org.apache.hadoop.conf.Configuration)"><!-- --></A><H3>
  315. getDefaultSocketFactory</H3>
  316. <PRE>
  317. public static <A HREF="http://java.sun.com/javase/6/docs/api/javax/net/SocketFactory.html?is-external=true" title="class or interface in javax.net">SocketFactory</A> <B>getDefaultSocketFactory</B>(<A HREF="../../../../org/apache/hadoop/conf/Configuration.html" title="class in org.apache.hadoop.conf">Configuration</A>&nbsp;conf)</PRE>
  318. <DL>
  319. <DD>Get the default socket factory as specified by the configuration
  320. parameter <tt>hadoop.rpc.socket.factory.default</tt>
  321. <P>
  322. <DD><DL>
  323. <DT><B>Parameters:</B><DD><CODE>conf</CODE> - the configuration
  324. <DT><B>Returns:</B><DD>the default socket factory as specified in the configuration or
  325. the JVM default socket factory if the configuration does not
  326. contain a default socket factory property.</DL>
  327. </DD>
  328. </DL>
  329. <HR>
  330. <A NAME="getSocketFactoryFromProperty(org.apache.hadoop.conf.Configuration, java.lang.String)"><!-- --></A><H3>
  331. getSocketFactoryFromProperty</H3>
  332. <PRE>
  333. public static <A HREF="http://java.sun.com/javase/6/docs/api/javax/net/SocketFactory.html?is-external=true" title="class or interface in javax.net">SocketFactory</A> <B>getSocketFactoryFromProperty</B>(<A HREF="../../../../org/apache/hadoop/conf/Configuration.html" title="class in org.apache.hadoop.conf">Configuration</A>&nbsp;conf,
  334. <A HREF="http://java.sun.com/javase/6/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</A>&nbsp;propValue)</PRE>
  335. <DL>
  336. <DD>Get the socket factory corresponding to the given proxy URI. If the
  337. given proxy URI corresponds to an absence of configuration parameter,
  338. returns null. If the URI is malformed raises an exception.
  339. <P>
  340. <DD><DL>
  341. <DT><B>Parameters:</B><DD><CODE>propValue</CODE> - the property which is the class name of the
  342. SocketFactory to instantiate; assumed non null and non empty.
  343. <DT><B>Returns:</B><DD>a socket factory as defined in the property value.</DL>
  344. </DD>
  345. </DL>
  346. <HR>
  347. <A NAME="createSocketAddr(java.lang.String)"><!-- --></A><H3>
  348. createSocketAddr</H3>
  349. <PRE>
  350. public static <A HREF="http://java.sun.com/javase/6/docs/api/java/net/InetSocketAddress.html?is-external=true" title="class or interface in java.net">InetSocketAddress</A> <B>createSocketAddr</B>(<A HREF="http://java.sun.com/javase/6/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</A>&nbsp;target)</PRE>
  351. <DL>
  352. <DD>Util method to build socket addr from either:
  353. <host>:<post>
  354. <fs>://<host>:<port>/<path>
  355. <P>
  356. <DD><DL>
  357. </DL>
  358. </DD>
  359. </DL>
  360. <HR>
  361. <A NAME="createSocketAddr(java.lang.String, int)"><!-- --></A><H3>
  362. createSocketAddr</H3>
  363. <PRE>
  364. public static <A HREF="http://java.sun.com/javase/6/docs/api/java/net/InetSocketAddress.html?is-external=true" title="class or interface in java.net">InetSocketAddress</A> <B>createSocketAddr</B>(<A HREF="http://java.sun.com/javase/6/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</A>&nbsp;target,
  365. int&nbsp;defaultPort)</PRE>
  366. <DL>
  367. <DD>Util method to build socket addr from either:
  368. <host>
  369. <host>:<post>
  370. <fs>://<host>:<port>/<path>
  371. <P>
  372. <DD><DL>
  373. </DL>
  374. </DD>
  375. </DL>
  376. <HR>
  377. <A NAME="getServerAddress(org.apache.hadoop.conf.Configuration, java.lang.String, java.lang.String, java.lang.String)"><!-- --></A><H3>
  378. getServerAddress</H3>
  379. <PRE>
  380. <FONT SIZE="-1"><A HREF="http://java.sun.com/javase/6/docs/api/java/lang/Deprecated.html?is-external=true" title="class or interface in java.lang">@Deprecated</A>
  381. </FONT>public static <A HREF="http://java.sun.com/javase/6/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</A> <B>getServerAddress</B>(<A HREF="../../../../org/apache/hadoop/conf/Configuration.html" title="class in org.apache.hadoop.conf">Configuration</A>&nbsp;conf,
  382. <A HREF="http://java.sun.com/javase/6/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</A>&nbsp;oldBindAddressName,
  383. <A HREF="http://java.sun.com/javase/6/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</A>&nbsp;oldPortName,
  384. <A HREF="http://java.sun.com/javase/6/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</A>&nbsp;newBindAddressName)</PRE>
  385. <DL>
  386. <DD><B>Deprecated.</B>&nbsp;
  387. <P>
  388. <DD>Handle the transition from pairs of attributes specifying a host and port
  389. to a single colon separated one.
  390. <P>
  391. <DD><DL>
  392. <DT><B>Parameters:</B><DD><CODE>conf</CODE> - the configuration to check<DD><CODE>oldBindAddressName</CODE> - the old address attribute name<DD><CODE>oldPortName</CODE> - the old port attribute name<DD><CODE>newBindAddressName</CODE> - the new combined name
  393. <DT><B>Returns:</B><DD>the complete address from the configuration</DL>
  394. </DD>
  395. </DL>
  396. <HR>
  397. <A NAME="addStaticResolution(java.lang.String, java.lang.String)"><!-- --></A><H3>
  398. addStaticResolution</H3>
  399. <PRE>
  400. public static void <B>addStaticResolution</B>(<A HREF="http://java.sun.com/javase/6/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</A>&nbsp;host,
  401. <A HREF="http://java.sun.com/javase/6/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</A>&nbsp;resolvedName)</PRE>
  402. <DL>
  403. <DD>Adds a static resolution for host. This can be used for setting up
  404. hostnames with names that are fake to point to a well known host. For e.g.
  405. in some testcases we require to have daemons with different hostnames
  406. running on the same machine. In order to create connections to these
  407. daemons, one can set up mappings from those hostnames to "localhost".
  408. <A HREF="../../../../org/apache/hadoop/net/NetUtils.html#getStaticResolution(java.lang.String)"><CODE>getStaticResolution(String)</CODE></A> can be used to query for
  409. the actual hostname.
  410. <P>
  411. <DD><DL>
  412. <DT><B>Parameters:</B><DD><CODE>host</CODE> - <DD><CODE>resolvedName</CODE> - </DL>
  413. </DD>
  414. </DL>
  415. <HR>
  416. <A NAME="getStaticResolution(java.lang.String)"><!-- --></A><H3>
  417. getStaticResolution</H3>
  418. <PRE>
  419. public static <A HREF="http://java.sun.com/javase/6/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</A> <B>getStaticResolution</B>(<A HREF="http://java.sun.com/javase/6/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</A>&nbsp;host)</PRE>
  420. <DL>
  421. <DD>Retrieves the resolved name for the passed host. The resolved name must
  422. have been set earlier using
  423. <A HREF="../../../../org/apache/hadoop/net/NetUtils.html#addStaticResolution(java.lang.String, java.lang.String)"><CODE>addStaticResolution(String, String)</CODE></A>
  424. <P>
  425. <DD><DL>
  426. <DT><B>Parameters:</B><DD><CODE>host</CODE> -
  427. <DT><B>Returns:</B><DD>the resolution</DL>
  428. </DD>
  429. </DL>
  430. <HR>
  431. <A NAME="getAllStaticResolutions()"><!-- --></A><H3>
  432. getAllStaticResolutions</H3>
  433. <PRE>
  434. public static <A HREF="http://java.sun.com/javase/6/docs/api/java/util/List.html?is-external=true" title="class or interface in java.util">List</A>&lt;<A HREF="http://java.sun.com/javase/6/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</A>[]&gt; <B>getAllStaticResolutions</B>()</PRE>
  435. <DL>
  436. <DD>This is used to get all the resolutions that were added using
  437. <A HREF="../../../../org/apache/hadoop/net/NetUtils.html#addStaticResolution(java.lang.String, java.lang.String)"><CODE>addStaticResolution(String, String)</CODE></A>. The return
  438. value is a List each element of which contains an array of String
  439. of the form String[0]=hostname, String[1]=resolved-hostname
  440. <P>
  441. <DD><DL>
  442. <DT><B>Returns:</B><DD>the list of resolutions</DL>
  443. </DD>
  444. </DL>
  445. <HR>
  446. <A NAME="getConnectAddress(org.apache.hadoop.ipc.Server)"><!-- --></A><H3>
  447. getConnectAddress</H3>
  448. <PRE>
  449. public static <A HREF="http://java.sun.com/javase/6/docs/api/java/net/InetSocketAddress.html?is-external=true" title="class or interface in java.net">InetSocketAddress</A> <B>getConnectAddress</B>(<A HREF="../../../../org/apache/hadoop/ipc/Server.html" title="class in org.apache.hadoop.ipc">Server</A>&nbsp;server)</PRE>
  450. <DL>
  451. <DD>Returns InetSocketAddress that a client can use to
  452. connect to the server. Server.getListenerAddress() is not correct when
  453. the server binds to "0.0.0.0". This returns "127.0.0.1:port" when
  454. the getListenerAddress() returns "0.0.0.0:port".
  455. <P>
  456. <DD><DL>
  457. <DT><B>Parameters:</B><DD><CODE>server</CODE> -
  458. <DT><B>Returns:</B><DD>socket address that a client can use to connect to the server.</DL>
  459. </DD>
  460. </DL>
  461. <HR>
  462. <A NAME="getInputStream(java.net.Socket)"><!-- --></A><H3>
  463. getInputStream</H3>
  464. <PRE>
  465. public static <A HREF="http://java.sun.com/javase/6/docs/api/java/io/InputStream.html?is-external=true" title="class or interface in java.io">InputStream</A> <B>getInputStream</B>(<A HREF="http://java.sun.com/javase/6/docs/api/java/net/Socket.html?is-external=true" title="class or interface in java.net">Socket</A>&nbsp;socket)
  466. throws <A HREF="http://java.sun.com/javase/6/docs/api/java/io/IOException.html?is-external=true" title="class or interface in java.io">IOException</A></PRE>
  467. <DL>
  468. <DD>Same as getInputStream(socket, socket.getSoTimeout()).<br><br>
  469. From documentation for <A HREF="../../../../org/apache/hadoop/net/NetUtils.html#getInputStream(java.net.Socket, long)"><CODE>getInputStream(Socket, long)</CODE></A>:<br>
  470. Returns InputStream for the socket. If the socket has an associated
  471. SocketChannel then it returns a
  472. <A HREF="../../../../org/apache/hadoop/net/SocketInputStream.html" title="class in org.apache.hadoop.net"><CODE>SocketInputStream</CODE></A> with the given timeout. If the socket does not
  473. have a channel, <A HREF="http://java.sun.com/javase/6/docs/api/java/net/Socket.html?is-external=true#getInputStream()" title="class or interface in java.net"><CODE>Socket.getInputStream()</CODE></A> is returned. In the later
  474. case, the timeout argument is ignored and the timeout set with
  475. <A HREF="http://java.sun.com/javase/6/docs/api/java/net/Socket.html?is-external=true#setSoTimeout(int)" title="class or interface in java.net"><CODE>Socket.setSoTimeout(int)</CODE></A> applies for reads.<br><br>
  476. Any socket created using socket factories returned by <A HREF="../../../../org/apache/hadoop/net/NetUtils.html#NetUtils()"><CODE>NetUtils()</CODE></A>,
  477. must use this interface instead of <A HREF="http://java.sun.com/javase/6/docs/api/java/net/Socket.html?is-external=true#getInputStream()" title="class or interface in java.net"><CODE>Socket.getInputStream()</CODE></A>.
  478. <P>
  479. <DD><DL>
  480. <DT><B>Parameters:</B><DD><CODE>socket</CODE> -
  481. <DT><B>Returns:</B><DD>InputStream for reading from the socket.
  482. <DT><B>Throws:</B>
  483. <DD><CODE><A HREF="http://java.sun.com/javase/6/docs/api/java/io/IOException.html?is-external=true" title="class or interface in java.io">IOException</A></CODE><DT><B>See Also:</B><DD><A HREF="../../../../org/apache/hadoop/net/NetUtils.html#getInputStream(java.net.Socket, long)"><CODE>getInputStream(Socket, long)</CODE></A></DL>
  484. </DD>
  485. </DL>
  486. <HR>
  487. <A NAME="getInputStream(java.net.Socket, long)"><!-- --></A><H3>
  488. getInputStream</H3>
  489. <PRE>
  490. public static <A HREF="http://java.sun.com/javase/6/docs/api/java/io/InputStream.html?is-external=true" title="class or interface in java.io">InputStream</A> <B>getInputStream</B>(<A HREF="http://java.sun.com/javase/6/docs/api/java/net/Socket.html?is-external=true" title="class or interface in java.net">Socket</A>&nbsp;socket,
  491. long&nbsp;timeout)
  492. throws <A HREF="http://java.sun.com/javase/6/docs/api/java/io/IOException.html?is-external=true" title="class or interface in java.io">IOException</A></PRE>
  493. <DL>
  494. <DD>Returns InputStream for the socket. If the socket has an associated
  495. SocketChannel then it returns a
  496. <A HREF="../../../../org/apache/hadoop/net/SocketInputStream.html" title="class in org.apache.hadoop.net"><CODE>SocketInputStream</CODE></A> with the given timeout. If the socket does not
  497. have a channel, <A HREF="http://java.sun.com/javase/6/docs/api/java/net/Socket.html?is-external=true#getInputStream()" title="class or interface in java.net"><CODE>Socket.getInputStream()</CODE></A> is returned. In the later
  498. case, the timeout argument is ignored and the timeout set with
  499. <A HREF="http://java.sun.com/javase/6/docs/api/java/net/Socket.html?is-external=true#setSoTimeout(int)" title="class or interface in java.net"><CODE>Socket.setSoTimeout(int)</CODE></A> applies for reads.<br><br>
  500. Any socket created using socket factories returned by <A HREF="../../../../org/apache/hadoop/net/NetUtils.html#NetUtils()"><CODE>NetUtils()</CODE></A>,
  501. must use this interface instead of <A HREF="http://java.sun.com/javase/6/docs/api/java/net/Socket.html?is-external=true#getInputStream()" title="class or interface in java.net"><CODE>Socket.getInputStream()</CODE></A>.
  502. <P>
  503. <DD><DL>
  504. <DT><B>Parameters:</B><DD><CODE>socket</CODE> - <DD><CODE>timeout</CODE> - timeout in milliseconds. This may not always apply. zero
  505. for waiting as long as necessary.
  506. <DT><B>Returns:</B><DD>InputStream for reading from the socket.
  507. <DT><B>Throws:</B>
  508. <DD><CODE><A HREF="http://java.sun.com/javase/6/docs/api/java/io/IOException.html?is-external=true" title="class or interface in java.io">IOException</A></CODE><DT><B>See Also:</B><DD><A HREF="http://java.sun.com/javase/6/docs/api/java/net/Socket.html?is-external=true#getChannel()" title="class or interface in java.net"><CODE>Socket.getChannel()</CODE></A></DL>
  509. </DD>
  510. </DL>
  511. <HR>
  512. <A NAME="getOutputStream(java.net.Socket)"><!-- --></A><H3>
  513. getOutputStream</H3>
  514. <PRE>
  515. public static <A HREF="http://java.sun.com/javase/6/docs/api/java/io/OutputStream.html?is-external=true" title="class or interface in java.io">OutputStream</A> <B>getOutputStream</B>(<A HREF="http://java.sun.com/javase/6/docs/api/java/net/Socket.html?is-external=true" title="class or interface in java.net">Socket</A>&nbsp;socket)
  516. throws <A HREF="http://java.sun.com/javase/6/docs/api/java/io/IOException.html?is-external=true" title="class or interface in java.io">IOException</A></PRE>
  517. <DL>
  518. <DD>Same as getOutputStream(socket, 0). Timeout of zero implies write will
  519. wait until data is available.<br><br>
  520. From documentation for <A HREF="../../../../org/apache/hadoop/net/NetUtils.html#getOutputStream(java.net.Socket, long)"><CODE>getOutputStream(Socket, long)</CODE></A> : <br>
  521. Returns OutputStream for the socket. If the socket has an associated
  522. SocketChannel then it returns a
  523. <A HREF="../../../../org/apache/hadoop/net/SocketOutputStream.html" title="class in org.apache.hadoop.net"><CODE>SocketOutputStream</CODE></A> with the given timeout. If the socket does not
  524. have a channel, <A HREF="http://java.sun.com/javase/6/docs/api/java/net/Socket.html?is-external=true#getOutputStream()" title="class or interface in java.net"><CODE>Socket.getOutputStream()</CODE></A> is returned. In the later
  525. case, the timeout argument is ignored and the write will wait until
  526. data is available.<br><br>
  527. Any socket created using socket factories returned by <A HREF="../../../../org/apache/hadoop/net/NetUtils.html#NetUtils()"><CODE>NetUtils()</CODE></A>,
  528. must use this interface instead of <A HREF="http://java.sun.com/javase/6/docs/api/java/net/Socket.html?is-external=true#getOutputStream()" title="class or interface in java.net"><CODE>Socket.getOutputStream()</CODE></A>.
  529. <P>
  530. <DD><DL>
  531. <DT><B>Parameters:</B><DD><CODE>socket</CODE> -
  532. <DT><B>Returns:</B><DD>OutputStream for writing to the socket.
  533. <DT><B>Throws:</B>
  534. <DD><CODE><A HREF="http://java.sun.com/javase/6/docs/api/java/io/IOException.html?is-external=true" title="class or interface in java.io">IOException</A></CODE><DT><B>See Also:</B><DD><A HREF="../../../../org/apache/hadoop/net/NetUtils.html#getOutputStream(java.net.Socket, long)"><CODE>getOutputStream(Socket, long)</CODE></A></DL>
  535. </DD>
  536. </DL>
  537. <HR>
  538. <A NAME="getOutputStream(java.net.Socket, long)"><!-- --></A><H3>
  539. getOutputStream</H3>
  540. <PRE>
  541. public static <A HREF="http://java.sun.com/javase/6/docs/api/java/io/OutputStream.html?is-external=true" title="class or interface in java.io">OutputStream</A> <B>getOutputStream</B>(<A HREF="http://java.sun.com/javase/6/docs/api/java/net/Socket.html?is-external=true" title="class or interface in java.net">Socket</A>&nbsp;socket,
  542. long&nbsp;timeout)
  543. throws <A HREF="http://java.sun.com/javase/6/docs/api/java/io/IOException.html?is-external=true" title="class or interface in java.io">IOException</A></PRE>
  544. <DL>
  545. <DD>Returns OutputStream for the socket. If the socket has an associated
  546. SocketChannel then it returns a
  547. <A HREF="../../../../org/apache/hadoop/net/SocketOutputStream.html" title="class in org.apache.hadoop.net"><CODE>SocketOutputStream</CODE></A> with the given timeout. If the socket does not
  548. have a channel, <A HREF="http://java.sun.com/javase/6/docs/api/java/net/Socket.html?is-external=true#getOutputStream()" title="class or interface in java.net"><CODE>Socket.getOutputStream()</CODE></A> is returned. In the later
  549. case, the timeout argument is ignored and the write will wait until
  550. data is available.<br><br>
  551. Any socket created using socket factories returned by <A HREF="../../../../org/apache/hadoop/net/NetUtils.html#NetUtils()"><CODE>NetUtils()</CODE></A>,
  552. must use this interface instead of <A HREF="http://java.sun.com/javase/6/docs/api/java/net/Socket.html?is-external=true#getOutputStream()" title="class or interface in java.net"><CODE>Socket.getOutputStream()</CODE></A>.
  553. <P>
  554. <DD><DL>
  555. <DT><B>Parameters:</B><DD><CODE>socket</CODE> - <DD><CODE>timeout</CODE> - timeout in milliseconds. This may not always apply. zero
  556. for waiting as long as necessary.
  557. <DT><B>Returns:</B><DD>OutputStream for writing to the socket.
  558. <DT><B>Throws:</B>
  559. <DD><CODE><A HREF="http://java.sun.com/javase/6/docs/api/java/io/IOException.html?is-external=true" title="class or interface in java.io">IOException</A></CODE><DT><B>See Also:</B><DD><A HREF="http://java.sun.com/javase/6/docs/api/java/net/Socket.html?is-external=true#getChannel()" title="class or interface in java.net"><CODE>Socket.getChannel()</CODE></A></DL>
  560. </DD>
  561. </DL>
  562. <HR>
  563. <A NAME="connect(java.net.Socket, java.net.SocketAddress, int)"><!-- --></A><H3>
  564. connect</H3>
  565. <PRE>
  566. public static void <B>connect</B>(<A HREF="http://java.sun.com/javase/6/docs/api/java/net/Socket.html?is-external=true" title="class or interface in java.net">Socket</A>&nbsp;socket,
  567. <A HREF="http://java.sun.com/javase/6/docs/api/java/net/SocketAddress.html?is-external=true" title="class or interface in java.net">SocketAddress</A>&nbsp;endpoint,
  568. int&nbsp;timeout)
  569. throws <A HREF="http://java.sun.com/javase/6/docs/api/java/io/IOException.html?is-external=true" title="class or interface in java.io">IOException</A></PRE>
  570. <DL>
  571. <DD>This is a drop-in replacement for
  572. <A HREF="http://java.sun.com/javase/6/docs/api/java/net/Socket.html?is-external=true#connect(java.net.SocketAddress, int)" title="class or interface in java.net"><CODE>Socket.connect(SocketAddress, int)</CODE></A>.
  573. In the case of normal sockets that don't have associated channels, this
  574. just invokes <code>socket.connect(endpoint, timeout)</code>. If
  575. <code>socket.getChannel()</code> returns a non-null channel,
  576. connect is implemented using Hadoop's selectors. This is done mainly
  577. to avoid Sun's connect implementation from creating thread-local
  578. selectors, since Hadoop does not have control on when these are closed
  579. and could end up taking all the available file descriptors.
  580. <P>
  581. <DD><DL>
  582. <DT><B>Parameters:</B><DD><CODE>socket</CODE> - <DD><CODE>endpoint</CODE> - <DD><CODE>timeout</CODE> - - timeout in milliseconds
  583. <DT><B>Throws:</B>
  584. <DD><CODE><A HREF="http://java.sun.com/javase/6/docs/api/java/io/IOException.html?is-external=true" title="class or interface in java.io">IOException</A></CODE><DT><B>See Also:</B><DD><A HREF="http://java.sun.com/javase/6/docs/api/java/net/Socket.html?is-external=true#connect(java.net.SocketAddress, int)" title="class or interface in java.net"><CODE>Socket.connect(java.net.SocketAddress, int)</CODE></A></DL>
  585. </DD>
  586. </DL>
  587. <HR>
  588. <A NAME="normalizeHostName(java.lang.String)"><!-- --></A><H3>
  589. normalizeHostName</H3>
  590. <PRE>
  591. public static <A HREF="http://java.sun.com/javase/6/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</A> <B>normalizeHostName</B>(<A HREF="http://java.sun.com/javase/6/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</A>&nbsp;name)</PRE>
  592. <DL>
  593. <DD>Given a string representation of a host, return its ip address
  594. in textual presentation.
  595. <P>
  596. <DD><DL>
  597. <DT><B>Parameters:</B><DD><CODE>name</CODE> - a string representation of a host:
  598. either a textual representation its IP address or its host name
  599. <DT><B>Returns:</B><DD>its IP address in the string format</DL>
  600. </DD>
  601. </DL>
  602. <HR>
  603. <A NAME="normalizeHostNames(java.util.Collection)"><!-- --></A><H3>
  604. normalizeHostNames</H3>
  605. <PRE>
  606. public static <A HREF="http://java.sun.com/javase/6/docs/api/java/util/List.html?is-external=true" title="class or interface in java.util">List</A>&lt;<A HREF="http://java.sun.com/javase/6/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</A>&gt; <B>normalizeHostNames</B>(<A HREF="http://java.sun.com/javase/6/docs/api/java/util/Collection.html?is-external=true" title="class or interface in java.util">Collection</A>&lt;<A HREF="http://java.sun.com/javase/6/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</A>&gt;&nbsp;names)</PRE>
  607. <DL>
  608. <DD>Given a collection of string representation of hosts, return a list of
  609. corresponding IP addresses in the textual representation.
  610. <P>
  611. <DD><DL>
  612. <DT><B>Parameters:</B><DD><CODE>names</CODE> - a collection of string representations of hosts
  613. <DT><B>Returns:</B><DD>a list of corresponding IP addresses in the string format<DT><B>See Also:</B><DD><A HREF="../../../../org/apache/hadoop/net/NetUtils.html#normalizeHostName(java.lang.String)"><CODE>normalizeHostName(String)</CODE></A></DL>
  614. </DD>
  615. </DL>
  616. <!-- ========= END OF CLASS DATA ========= -->
  617. <HR>
  618. <!-- ======= START OF BOTTOM NAVBAR ====== -->
  619. <A NAME="navbar_bottom"><!-- --></A>
  620. <A HREF="#skip-navbar_bottom" title="Skip navigation links"></A>
  621. <TABLE BORDER="0" WIDTH="100%" CELLPADDING="1" CELLSPACING="0" SUMMARY="">
  622. <TR>
  623. <TD COLSPAN=2 BGCOLOR="#EEEEFF" CLASS="NavBarCell1">
  624. <A NAME="navbar_bottom_firstrow"><!-- --></A>
  625. <TABLE BORDER="0" CELLPADDING="0" CELLSPACING="3" SUMMARY="">
  626. <TR ALIGN="center" VALIGN="top">
  627. <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../overview-summary.html"><FONT CLASS="NavBarFont1"><B>Overview</B></FONT></A>&nbsp;</TD>
  628. <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="package-summary.html"><FONT CLASS="NavBarFont1"><B>Package</B></FONT></A>&nbsp;</TD>
  629. <TD BGCOLOR="#FFFFFF" CLASS="NavBarCell1Rev"> &nbsp;<FONT CLASS="NavBarFont1Rev"><B>Class</B></FONT>&nbsp;</TD>
  630. <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="class-use/NetUtils.html"><FONT CLASS="NavBarFont1"><B>Use</B></FONT></A>&nbsp;</TD>
  631. <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="package-tree.html"><FONT CLASS="NavBarFont1"><B>Tree</B></FONT></A>&nbsp;</TD>
  632. <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../deprecated-list.html"><FONT CLASS="NavBarFont1"><B>Deprecated</B></FONT></A>&nbsp;</TD>
  633. <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../index-all.html"><FONT CLASS="NavBarFont1"><B>Index</B></FONT></A>&nbsp;</TD>
  634. <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../help-doc.html"><FONT CLASS="NavBarFont1"><B>Help</B></FONT></A>&nbsp;</TD>
  635. </TR>
  636. </TABLE>
  637. </TD>
  638. <TD ALIGN="right" VALIGN="top" ROWSPAN=3><EM>
  639. </EM>
  640. </TD>
  641. </TR>
  642. <TR>
  643. <TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2">
  644. &nbsp;<A HREF="../../../../org/apache/hadoop/net/DNSToSwitchMapping.html" title="interface in org.apache.hadoop.net"><B>PREV CLASS</B></A>&nbsp;
  645. &nbsp;<A HREF="../../../../org/apache/hadoop/net/NetworkTopology.html" title="class in org.apache.hadoop.net"><B>NEXT CLASS</B></A></FONT></TD>
  646. <TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2">
  647. <A HREF="../../../../index.html?org/apache/hadoop/net/NetUtils.html" target="_top"><B>FRAMES</B></A> &nbsp;
  648. &nbsp;<A HREF="NetUtils.html" target="_top"><B>NO FRAMES</B></A> &nbsp;
  649. &nbsp;<SCRIPT type="text/javascript">
  650. <!--
  651. if(window==top) {
  652. document.writeln('<A HREF="../../../../allclasses-noframe.html"><B>All Classes</B></A>');
  653. }
  654. //-->
  655. </SCRIPT>
  656. <NOSCRIPT>
  657. <A HREF="../../../../allclasses-noframe.html"><B>All Classes</B></A>
  658. </NOSCRIPT>
  659. </FONT></TD>
  660. </TR>
  661. <TR>
  662. <TD VALIGN="top" CLASS="NavBarCell3"><FONT SIZE="-2">
  663. SUMMARY:&nbsp;NESTED&nbsp;|&nbsp;FIELD&nbsp;|&nbsp;<A HREF="#constructor_summary">CONSTR</A>&nbsp;|&nbsp;<A HREF="#method_summary">METHOD</A></FONT></TD>
  664. <TD VALIGN="top" CLASS="NavBarCell3"><FONT SIZE="-2">
  665. DETAIL:&nbsp;FIELD&nbsp;|&nbsp;<A HREF="#constructor_detail">CONSTR</A>&nbsp;|&nbsp;<A HREF="#method_detail">METHOD</A></FONT></TD>
  666. </TR>
  667. </TABLE>
  668. <A NAME="skip-navbar_bottom"></A>
  669. <!-- ======== END OF BOTTOM NAVBAR ======= -->
  670. <HR>
  671. Copyright &copy; 2009 The Apache Software Foundation
  672. </BODY>
  673. </HTML>