PageRenderTime 61ms CodeModel.GetById 3ms app.highlight 49ms RepoModel.GetById 2ms app.codeStats 0ms

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

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