/docs/api/org/apache/hadoop/net/NetUtils.html
HTML | 743 lines | 651 code | 70 blank | 22 comment | 0 complexity | 64f10d363f697fcf0f4cd241d72b317a MD5 | raw file
Possible License(s): Apache-2.0
- <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
- <!--NewPage-->
- <HTML>
- <HEAD>
- <!-- Generated by javadoc (build 1.6.0_18) on Tue Nov 16 17:31:51 CST 2010 -->
- <TITLE>
- NetUtils (Hadoop 0.20.3-dev API)
- </TITLE>
- <META NAME="date" CONTENT="2010-11-16">
- <LINK REL ="stylesheet" TYPE="text/css" HREF="../../../../stylesheet.css" TITLE="Style">
- <SCRIPT type="text/javascript">
- function windowTitle()
- {
- if (location.href.indexOf('is-external=true') == -1) {
- parent.document.title="NetUtils (Hadoop 0.20.3-dev API)";
- }
- }
- </SCRIPT>
- <NOSCRIPT>
- </NOSCRIPT>
- </HEAD>
- <BODY BGCOLOR="white" onload="windowTitle();">
- <HR>
- <!-- ========= START OF TOP NAVBAR ======= -->
- <A NAME="navbar_top"><!-- --></A>
- <A HREF="#skip-navbar_top" title="Skip navigation links"></A>
- <TABLE BORDER="0" WIDTH="100%" CELLPADDING="1" CELLSPACING="0" SUMMARY="">
- <TR>
- <TD COLSPAN=2 BGCOLOR="#EEEEFF" CLASS="NavBarCell1">
- <A NAME="navbar_top_firstrow"><!-- --></A>
- <TABLE BORDER="0" CELLPADDING="0" CELLSPACING="3" SUMMARY="">
- <TR ALIGN="center" VALIGN="top">
- <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../overview-summary.html"><FONT CLASS="NavBarFont1"><B>Overview</B></FONT></A> </TD>
- <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="package-summary.html"><FONT CLASS="NavBarFont1"><B>Package</B></FONT></A> </TD>
- <TD BGCOLOR="#FFFFFF" CLASS="NavBarCell1Rev"> <FONT CLASS="NavBarFont1Rev"><B>Class</B></FONT> </TD>
- <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="class-use/NetUtils.html"><FONT CLASS="NavBarFont1"><B>Use</B></FONT></A> </TD>
- <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="package-tree.html"><FONT CLASS="NavBarFont1"><B>Tree</B></FONT></A> </TD>
- <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../deprecated-list.html"><FONT CLASS="NavBarFont1"><B>Deprecated</B></FONT></A> </TD>
- <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../index-all.html"><FONT CLASS="NavBarFont1"><B>Index</B></FONT></A> </TD>
- <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../help-doc.html"><FONT CLASS="NavBarFont1"><B>Help</B></FONT></A> </TD>
- </TR>
- </TABLE>
- </TD>
- <TD ALIGN="right" VALIGN="top" ROWSPAN=3><EM>
- </EM>
- </TD>
- </TR>
- <TR>
- <TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2">
- <A HREF="../../../../org/apache/hadoop/net/DNSToSwitchMapping.html" title="interface in org.apache.hadoop.net"><B>PREV CLASS</B></A>
- <A HREF="../../../../org/apache/hadoop/net/NetworkTopology.html" title="class in org.apache.hadoop.net"><B>NEXT CLASS</B></A></FONT></TD>
- <TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2">
- <A HREF="../../../../index.html?org/apache/hadoop/net/NetUtils.html" target="_top"><B>FRAMES</B></A>
- <A HREF="NetUtils.html" target="_top"><B>NO FRAMES</B></A>
- <SCRIPT type="text/javascript">
- <!--
- if(window==top) {
- document.writeln('<A HREF="../../../../allclasses-noframe.html"><B>All Classes</B></A>');
- }
- //-->
- </SCRIPT>
- <NOSCRIPT>
- <A HREF="../../../../allclasses-noframe.html"><B>All Classes</B></A>
- </NOSCRIPT>
- </FONT></TD>
- </TR>
- <TR>
- <TD VALIGN="top" CLASS="NavBarCell3"><FONT SIZE="-2">
- SUMMARY: NESTED | FIELD | <A HREF="#constructor_summary">CONSTR</A> | <A HREF="#method_summary">METHOD</A></FONT></TD>
- <TD VALIGN="top" CLASS="NavBarCell3"><FONT SIZE="-2">
- DETAIL: FIELD | <A HREF="#constructor_detail">CONSTR</A> | <A HREF="#method_detail">METHOD</A></FONT></TD>
- </TR>
- </TABLE>
- <A NAME="skip-navbar_top"></A>
- <!-- ========= END OF TOP NAVBAR ========= -->
- <HR>
- <!-- ======== START OF CLASS DATA ======== -->
- <H2>
- <FONT SIZE="-1">
- org.apache.hadoop.net</FONT>
- <BR>
- Class NetUtils</H2>
- <PRE>
- java.lang.Object
- <IMG SRC="../../../../resources/inherit.gif" ALT="extended by "><B>org.apache.hadoop.net.NetUtils</B>
- </PRE>
- <HR>
- <DL>
- <DT><PRE>public class <B>NetUtils</B><DT>extends java.lang.Object</DL>
- </PRE>
- <P>
- <HR>
- <P>
- <!-- ======== CONSTRUCTOR SUMMARY ======== -->
- <A NAME="constructor_summary"><!-- --></A>
- <TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY="">
- <TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor">
- <TH ALIGN="left" COLSPAN="2"><FONT SIZE="+2">
- <B>Constructor Summary</B></FONT></TH>
- </TR>
- <TR BGCOLOR="white" CLASS="TableRowColor">
- <TD><CODE><B><A HREF="../../../../org/apache/hadoop/net/NetUtils.html#NetUtils()">NetUtils</A></B>()</CODE>
- <BR>
- </TD>
- </TR>
- </TABLE>
-
- <!-- ========== METHOD SUMMARY =========== -->
- <A NAME="method_summary"><!-- --></A>
- <TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY="">
- <TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor">
- <TH ALIGN="left" COLSPAN="2"><FONT SIZE="+2">
- <B>Method Summary</B></FONT></TH>
- </TR>
- <TR BGCOLOR="white" CLASS="TableRowColor">
- <TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
- <CODE>static void</CODE></FONT></TD>
- <TD><CODE><B><A HREF="../../../../org/apache/hadoop/net/NetUtils.html#addStaticResolution(java.lang.String, java.lang.String)">addStaticResolution</A></B>(java.lang.String host,
- java.lang.String resolvedName)</CODE>
- <BR>
- Adds a static resolution for host.</TD>
- </TR>
- <TR BGCOLOR="white" CLASS="TableRowColor">
- <TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
- <CODE>static void</CODE></FONT></TD>
- <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 socket,
- java.net.SocketAddress endpoint,
- int timeout)</CODE>
- <BR>
- This is a drop-in replacement for
- <CODE>Socket.connect(SocketAddress, int)</CODE>.</TD>
- </TR>
- <TR BGCOLOR="white" CLASS="TableRowColor">
- <TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
- <CODE>static java.net.InetSocketAddress</CODE></FONT></TD>
- <TD><CODE><B><A HREF="../../../../org/apache/hadoop/net/NetUtils.html#createSocketAddr(java.lang.String)">createSocketAddr</A></B>(java.lang.String target)</CODE>
- <BR>
- Util method to build socket addr from either:
- <host>:<post>
- <fs>://<host>:<port>/<path></TD>
- </TR>
- <TR BGCOLOR="white" CLASS="TableRowColor">
- <TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
- <CODE>static java.net.InetSocketAddress</CODE></FONT></TD>
- <TD><CODE><B><A HREF="../../../../org/apache/hadoop/net/NetUtils.html#createSocketAddr(java.lang.String, int)">createSocketAddr</A></B>(java.lang.String target,
- int defaultPort)</CODE>
- <BR>
- Util method to build socket addr from either:
- <host>
- <host>:<post>
- <fs>://<host>:<port>/<path></TD>
- </TR>
- <TR BGCOLOR="white" CLASS="TableRowColor">
- <TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
- <CODE>static java.util.List<java.lang.String[]></CODE></FONT></TD>
- <TD><CODE><B><A HREF="../../../../org/apache/hadoop/net/NetUtils.html#getAllStaticResolutions()">getAllStaticResolutions</A></B>()</CODE>
- <BR>
- This is used to get all the resolutions that were added using
- <A HREF="../../../../org/apache/hadoop/net/NetUtils.html#addStaticResolution(java.lang.String, java.lang.String)"><CODE>addStaticResolution(String, String)</CODE></A>.</TD>
- </TR>
- <TR BGCOLOR="white" CLASS="TableRowColor">
- <TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
- <CODE>static java.net.InetSocketAddress</CODE></FONT></TD>
- <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> server)</CODE>
- <BR>
- Returns InetSocketAddress that a client can use to
- connect to the server.</TD>
- </TR>
- <TR BGCOLOR="white" CLASS="TableRowColor">
- <TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
- <CODE>static javax.net.SocketFactory</CODE></FONT></TD>
- <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> conf)</CODE>
- <BR>
- Get the default socket factory as specified by the configuration
- parameter <tt>hadoop.rpc.socket.factory.default</tt></TD>
- </TR>
- <TR BGCOLOR="white" CLASS="TableRowColor">
- <TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
- <CODE>static java.io.InputStream</CODE></FONT></TD>
- <TD><CODE><B><A HREF="../../../../org/apache/hadoop/net/NetUtils.html#getInputStream(java.net.Socket)">getInputStream</A></B>(java.net.Socket socket)</CODE>
- <BR>
- Same as getInputStream(socket, socket.getSoTimeout()).<br><br>
-
- From documentation for <A HREF="../../../../org/apache/hadoop/net/NetUtils.html#getInputStream(java.net.Socket, long)"><CODE>getInputStream(Socket, long)</CODE></A>:<br>
- Returns InputStream for the socket.</TD>
- </TR>
- <TR BGCOLOR="white" CLASS="TableRowColor">
- <TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
- <CODE>static java.io.InputStream</CODE></FONT></TD>
- <TD><CODE><B><A HREF="../../../../org/apache/hadoop/net/NetUtils.html#getInputStream(java.net.Socket, long)">getInputStream</A></B>(java.net.Socket socket,
- long timeout)</CODE>
- <BR>
- Returns InputStream for the socket.</TD>
- </TR>
- <TR BGCOLOR="white" CLASS="TableRowColor">
- <TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
- <CODE>static java.io.OutputStream</CODE></FONT></TD>
- <TD><CODE><B><A HREF="../../../../org/apache/hadoop/net/NetUtils.html#getOutputStream(java.net.Socket)">getOutputStream</A></B>(java.net.Socket socket)</CODE>
- <BR>
- Same as getOutputStream(socket, 0).</TD>
- </TR>
- <TR BGCOLOR="white" CLASS="TableRowColor">
- <TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
- <CODE>static java.io.OutputStream</CODE></FONT></TD>
- <TD><CODE><B><A HREF="../../../../org/apache/hadoop/net/NetUtils.html#getOutputStream(java.net.Socket, long)">getOutputStream</A></B>(java.net.Socket socket,
- long timeout)</CODE>
- <BR>
- Returns OutputStream for the socket.</TD>
- </TR>
- <TR BGCOLOR="white" CLASS="TableRowColor">
- <TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
- <CODE>static java.lang.String</CODE></FONT></TD>
- <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> conf,
- java.lang.String oldBindAddressName,
- java.lang.String oldPortName,
- java.lang.String newBindAddressName)</CODE>
- <BR>
- <B>Deprecated.</B> </TD>
- </TR>
- <TR BGCOLOR="white" CLASS="TableRowColor">
- <TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
- <CODE>static javax.net.SocketFactory</CODE></FONT></TD>
- <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> conf,
- java.lang.Class<?> clazz)</CODE>
- <BR>
- Get the socket factory for the given class according to its
- configuration parameter
- <tt>hadoop.rpc.socket.factory.class.<ClassName></tt>.</TD>
- </TR>
- <TR BGCOLOR="white" CLASS="TableRowColor">
- <TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
- <CODE>static javax.net.SocketFactory</CODE></FONT></TD>
- <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> conf,
- java.lang.String propValue)</CODE>
- <BR>
- Get the socket factory corresponding to the given proxy URI.</TD>
- </TR>
- <TR BGCOLOR="white" CLASS="TableRowColor">
- <TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
- <CODE>static java.lang.String</CODE></FONT></TD>
- <TD><CODE><B><A HREF="../../../../org/apache/hadoop/net/NetUtils.html#getStaticResolution(java.lang.String)">getStaticResolution</A></B>(java.lang.String host)</CODE>
- <BR>
- Retrieves the resolved name for the passed host.</TD>
- </TR>
- <TR BGCOLOR="white" CLASS="TableRowColor">
- <TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
- <CODE>static java.lang.String</CODE></FONT></TD>
- <TD><CODE><B><A HREF="../../../../org/apache/hadoop/net/NetUtils.html#normalizeHostName(java.lang.String)">normalizeHostName</A></B>(java.lang.String name)</CODE>
- <BR>
- Given a string representation of a host, return its ip address
- in textual presentation.</TD>
- </TR>
- <TR BGCOLOR="white" CLASS="TableRowColor">
- <TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
- <CODE>static java.util.List<java.lang.String></CODE></FONT></TD>
- <TD><CODE><B><A HREF="../../../../org/apache/hadoop/net/NetUtils.html#normalizeHostNames(java.util.Collection)">normalizeHostNames</A></B>(java.util.Collection<java.lang.String> names)</CODE>
- <BR>
- Given a collection of string representation of hosts, return a list of
- corresponding IP addresses in the textual representation.</TD>
- </TR>
- </TABLE>
- <A NAME="methods_inherited_from_class_java.lang.Object"><!-- --></A>
- <TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY="">
- <TR BGCOLOR="#EEEEFF" CLASS="TableSubHeadingColor">
- <TH ALIGN="left"><B>Methods inherited from class java.lang.Object</B></TH>
- </TR>
- <TR BGCOLOR="white" CLASS="TableRowColor">
- <TD><CODE>clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait</CODE></TD>
- </TR>
- </TABLE>
-
- <P>
- <!-- ========= CONSTRUCTOR DETAIL ======== -->
- <A NAME="constructor_detail"><!-- --></A>
- <TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY="">
- <TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor">
- <TH ALIGN="left" COLSPAN="1"><FONT SIZE="+2">
- <B>Constructor Detail</B></FONT></TH>
- </TR>
- </TABLE>
- <A NAME="NetUtils()"><!-- --></A><H3>
- NetUtils</H3>
- <PRE>
- public <B>NetUtils</B>()</PRE>
- <DL>
- </DL>
- <!-- ============ METHOD DETAIL ========== -->
- <A NAME="method_detail"><!-- --></A>
- <TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY="">
- <TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor">
- <TH ALIGN="left" COLSPAN="1"><FONT SIZE="+2">
- <B>Method Detail</B></FONT></TH>
- </TR>
- </TABLE>
- <A NAME="getSocketFactory(org.apache.hadoop.conf.Configuration, java.lang.Class)"><!-- --></A><H3>
- getSocketFactory</H3>
- <PRE>
- public static javax.net.SocketFactory <B>getSocketFactory</B>(<A HREF="../../../../org/apache/hadoop/conf/Configuration.html" title="class in org.apache.hadoop.conf">Configuration</A> conf,
- java.lang.Class<?> clazz)</PRE>
- <DL>
- <DD>Get the socket factory for the given class according to its
- configuration parameter
- <tt>hadoop.rpc.socket.factory.class.<ClassName></tt>. When no
- such parameter exists then fall back on the default socket factory as
- configured by <tt>hadoop.rpc.socket.factory.class.default</tt>. If
- this default socket factory is not configured, then fall back on the JVM
- default socket factory.
- <P>
- <DD><DL>
- <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>)
- <DT><B>Returns:</B><DD>a socket factory</DL>
- </DD>
- </DL>
- <HR>
- <A NAME="getDefaultSocketFactory(org.apache.hadoop.conf.Configuration)"><!-- --></A><H3>
- getDefaultSocketFactory</H3>
- <PRE>
- public static javax.net.SocketFactory <B>getDefaultSocketFactory</B>(<A HREF="../../../../org/apache/hadoop/conf/Configuration.html" title="class in org.apache.hadoop.conf">Configuration</A> conf)</PRE>
- <DL>
- <DD>Get the default socket factory as specified by the configuration
- parameter <tt>hadoop.rpc.socket.factory.default</tt>
- <P>
- <DD><DL>
- <DT><B>Parameters:</B><DD><CODE>conf</CODE> - the configuration
- <DT><B>Returns:</B><DD>the default socket factory as specified in the configuration or
- the JVM default socket factory if the configuration does not
- contain a default socket factory property.</DL>
- </DD>
- </DL>
- <HR>
- <A NAME="getSocketFactoryFromProperty(org.apache.hadoop.conf.Configuration, java.lang.String)"><!-- --></A><H3>
- getSocketFactoryFromProperty</H3>
- <PRE>
- public static javax.net.SocketFactory <B>getSocketFactoryFromProperty</B>(<A HREF="../../../../org/apache/hadoop/conf/Configuration.html" title="class in org.apache.hadoop.conf">Configuration</A> conf,
- java.lang.String propValue)</PRE>
- <DL>
- <DD>Get the socket factory corresponding to the given proxy URI. If the
- given proxy URI corresponds to an absence of configuration parameter,
- returns null. If the URI is malformed raises an exception.
- <P>
- <DD><DL>
- <DT><B>Parameters:</B><DD><CODE>propValue</CODE> - the property which is the class name of the
- SocketFactory to instantiate; assumed non null and non empty.
- <DT><B>Returns:</B><DD>a socket factory as defined in the property value.</DL>
- </DD>
- </DL>
- <HR>
- <A NAME="createSocketAddr(java.lang.String)"><!-- --></A><H3>
- createSocketAddr</H3>
- <PRE>
- public static java.net.InetSocketAddress <B>createSocketAddr</B>(java.lang.String target)</PRE>
- <DL>
- <DD>Util method to build socket addr from either:
- <host>:<post>
- <fs>://<host>:<port>/<path>
- <P>
- <DD><DL>
- </DL>
- </DD>
- </DL>
- <HR>
- <A NAME="createSocketAddr(java.lang.String, int)"><!-- --></A><H3>
- createSocketAddr</H3>
- <PRE>
- public static java.net.InetSocketAddress <B>createSocketAddr</B>(java.lang.String target,
- int defaultPort)</PRE>
- <DL>
- <DD>Util method to build socket addr from either:
- <host>
- <host>:<post>
- <fs>://<host>:<port>/<path>
- <P>
- <DD><DL>
- </DL>
- </DD>
- </DL>
- <HR>
- <A NAME="getServerAddress(org.apache.hadoop.conf.Configuration, java.lang.String, java.lang.String, java.lang.String)"><!-- --></A><H3>
- getServerAddress</H3>
- <PRE>
- <FONT SIZE="-1">@Deprecated
- </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> conf,
- java.lang.String oldBindAddressName,
- java.lang.String oldPortName,
- java.lang.String newBindAddressName)</PRE>
- <DL>
- <DD><B>Deprecated.</B>
- <P>
- <DD>Handle the transition from pairs of attributes specifying a host and port
- to a single colon separated one.
- <P>
- <DD><DL>
- <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
- <DT><B>Returns:</B><DD>the complete address from the configuration</DL>
- </DD>
- </DL>
- <HR>
- <A NAME="addStaticResolution(java.lang.String, java.lang.String)"><!-- --></A><H3>
- addStaticResolution</H3>
- <PRE>
- public static void <B>addStaticResolution</B>(java.lang.String host,
- java.lang.String resolvedName)</PRE>
- <DL>
- <DD>Adds a static resolution for host. This can be used for setting up
- hostnames with names that are fake to point to a well known host. For e.g.
- in some testcases we require to have daemons with different hostnames
- running on the same machine. In order to create connections to these
- daemons, one can set up mappings from those hostnames to "localhost".
- <A HREF="../../../../org/apache/hadoop/net/NetUtils.html#getStaticResolution(java.lang.String)"><CODE>getStaticResolution(String)</CODE></A> can be used to query for
- the actual hostname.
- <P>
- <DD><DL>
- <DT><B>Parameters:</B><DD><CODE>host</CODE> - <DD><CODE>resolvedName</CODE> - </DL>
- </DD>
- </DL>
- <HR>
- <A NAME="getStaticResolution(java.lang.String)"><!-- --></A><H3>
- getStaticResolution</H3>
- <PRE>
- public static java.lang.String <B>getStaticResolution</B>(java.lang.String host)</PRE>
- <DL>
- <DD>Retrieves the resolved name for the passed host. The resolved name must
- have been set earlier using
- <A HREF="../../../../org/apache/hadoop/net/NetUtils.html#addStaticResolution(java.lang.String, java.lang.String)"><CODE>addStaticResolution(String, String)</CODE></A>
- <P>
- <DD><DL>
- <DT><B>Parameters:</B><DD><CODE>host</CODE> -
- <DT><B>Returns:</B><DD>the resolution</DL>
- </DD>
- </DL>
- <HR>
- <A NAME="getAllStaticResolutions()"><!-- --></A><H3>
- getAllStaticResolutions</H3>
- <PRE>
- public static java.util.List<java.lang.String[]> <B>getAllStaticResolutions</B>()</PRE>
- <DL>
- <DD>This is used to get all the resolutions that were added using
- <A HREF="../../../../org/apache/hadoop/net/NetUtils.html#addStaticResolution(java.lang.String, java.lang.String)"><CODE>addStaticResolution(String, String)</CODE></A>. The return
- value is a List each element of which contains an array of String
- of the form String[0]=hostname, String[1]=resolved-hostname
- <P>
- <DD><DL>
- <DT><B>Returns:</B><DD>the list of resolutions</DL>
- </DD>
- </DL>
- <HR>
- <A NAME="getConnectAddress(org.apache.hadoop.ipc.Server)"><!-- --></A><H3>
- getConnectAddress</H3>
- <PRE>
- public static java.net.InetSocketAddress <B>getConnectAddress</B>(<A HREF="../../../../org/apache/hadoop/ipc/Server.html" title="class in org.apache.hadoop.ipc">Server</A> server)</PRE>
- <DL>
- <DD>Returns InetSocketAddress that a client can use to
- connect to the server. Server.getListenerAddress() is not correct when
- the server binds to "0.0.0.0". This returns "127.0.0.1:port" when
- the getListenerAddress() returns "0.0.0.0:port".
- <P>
- <DD><DL>
- <DT><B>Parameters:</B><DD><CODE>server</CODE> -
- <DT><B>Returns:</B><DD>socket address that a client can use to connect to the server.</DL>
- </DD>
- </DL>
- <HR>
- <A NAME="getInputStream(java.net.Socket)"><!-- --></A><H3>
- getInputStream</H3>
- <PRE>
- public static java.io.InputStream <B>getInputStream</B>(java.net.Socket socket)
- throws java.io.IOException</PRE>
- <DL>
- <DD>Same as getInputStream(socket, socket.getSoTimeout()).<br><br>
-
- From documentation for <A HREF="../../../../org/apache/hadoop/net/NetUtils.html#getInputStream(java.net.Socket, long)"><CODE>getInputStream(Socket, long)</CODE></A>:<br>
- Returns InputStream for the socket. If the socket has an associated
- SocketChannel then it returns a
- <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
- have a channel, <CODE>Socket.getInputStream()</CODE> is returned. In the later
- case, the timeout argument is ignored and the timeout set with
- <CODE>Socket.setSoTimeout(int)</CODE> applies for reads.<br><br>
- Any socket created using socket factories returned by <A HREF="../../../../org/apache/hadoop/net/NetUtils.html#NetUtils()"><CODE>NetUtils()</CODE></A>,
- must use this interface instead of <CODE>Socket.getInputStream()</CODE>.
- <P>
- <DD><DL>
- <DT><B>Parameters:</B><DD><CODE>socket</CODE> -
- <DT><B>Returns:</B><DD>InputStream for reading from the socket.
- <DT><B>Throws:</B>
- <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>
- </DD>
- </DL>
- <HR>
- <A NAME="getInputStream(java.net.Socket, long)"><!-- --></A><H3>
- getInputStream</H3>
- <PRE>
- public static java.io.InputStream <B>getInputStream</B>(java.net.Socket socket,
- long timeout)
- throws java.io.IOException</PRE>
- <DL>
- <DD>Returns InputStream for the socket. If the socket has an associated
- SocketChannel then it returns a
- <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
- have a channel, <CODE>Socket.getInputStream()</CODE> is returned. In the later
- case, the timeout argument is ignored and the timeout set with
- <CODE>Socket.setSoTimeout(int)</CODE> applies for reads.<br><br>
-
- Any socket created using socket factories returned by <A HREF="../../../../org/apache/hadoop/net/NetUtils.html#NetUtils()"><CODE>NetUtils()</CODE></A>,
- must use this interface instead of <CODE>Socket.getInputStream()</CODE>.
- <P>
- <DD><DL>
- <DT><B>Parameters:</B><DD><CODE>socket</CODE> - <DD><CODE>timeout</CODE> - timeout in milliseconds. This may not always apply. zero
- for waiting as long as necessary.
- <DT><B>Returns:</B><DD>InputStream for reading from the socket.
- <DT><B>Throws:</B>
- <DD><CODE>java.io.IOException</CODE><DT><B>See Also:</B><DD><CODE>Socket.getChannel()</CODE></DL>
- </DD>
- </DL>
- <HR>
- <A NAME="getOutputStream(java.net.Socket)"><!-- --></A><H3>
- getOutputStream</H3>
- <PRE>
- public static java.io.OutputStream <B>getOutputStream</B>(java.net.Socket socket)
- throws java.io.IOException</PRE>
- <DL>
- <DD>Same as getOutputStream(socket, 0). Timeout of zero implies write will
- wait until data is available.<br><br>
-
- From documentation for <A HREF="../../../../org/apache/hadoop/net/NetUtils.html#getOutputStream(java.net.Socket, long)"><CODE>getOutputStream(Socket, long)</CODE></A> : <br>
- Returns OutputStream for the socket. If the socket has an associated
- SocketChannel then it returns a
- <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
- have a channel, <CODE>Socket.getOutputStream()</CODE> is returned. In the later
- case, the timeout argument is ignored and the write will wait until
- data is available.<br><br>
-
- Any socket created using socket factories returned by <A HREF="../../../../org/apache/hadoop/net/NetUtils.html#NetUtils()"><CODE>NetUtils()</CODE></A>,
- must use this interface instead of <CODE>Socket.getOutputStream()</CODE>.
- <P>
- <DD><DL>
- <DT><B>Parameters:</B><DD><CODE>socket</CODE> -
- <DT><B>Returns:</B><DD>OutputStream for writing to the socket.
- <DT><B>Throws:</B>
- <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>
- </DD>
- </DL>
- <HR>
- <A NAME="getOutputStream(java.net.Socket, long)"><!-- --></A><H3>
- getOutputStream</H3>
- <PRE>
- public static java.io.OutputStream <B>getOutputStream</B>(java.net.Socket socket,
- long timeout)
- throws java.io.IOException</PRE>
- <DL>
- <DD>Returns OutputStream for the socket. If the socket has an associated
- SocketChannel then it returns a
- <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
- have a channel, <CODE>Socket.getOutputStream()</CODE> is returned. In the later
- case, the timeout argument is ignored and the write will wait until
- data is available.<br><br>
-
- Any socket created using socket factories returned by <A HREF="../../../../org/apache/hadoop/net/NetUtils.html#NetUtils()"><CODE>NetUtils()</CODE></A>,
- must use this interface instead of <CODE>Socket.getOutputStream()</CODE>.
- <P>
- <DD><DL>
- <DT><B>Parameters:</B><DD><CODE>socket</CODE> - <DD><CODE>timeout</CODE> - timeout in milliseconds. This may not always apply. zero
- for waiting as long as necessary.
- <DT><B>Returns:</B><DD>OutputStream for writing to the socket.
- <DT><B>Throws:</B>
- <DD><CODE>java.io.IOException</CODE><DT><B>See Also:</B><DD><CODE>Socket.getChannel()</CODE></DL>
- </DD>
- </DL>
- <HR>
- <A NAME="connect(java.net.Socket, java.net.SocketAddress, int)"><!-- --></A><H3>
- connect</H3>
- <PRE>
- public static void <B>connect</B>(java.net.Socket socket,
- java.net.SocketAddress endpoint,
- int timeout)
- throws java.io.IOException</PRE>
- <DL>
- <DD>This is a drop-in replacement for
- <CODE>Socket.connect(SocketAddress, int)</CODE>.
- In the case of normal sockets that don't have associated channels, this
- just invokes <code>socket.connect(endpoint, timeout)</code>. If
- <code>socket.getChannel()</code> returns a non-null channel,
- connect is implemented using Hadoop's selectors. This is done mainly
- to avoid Sun's connect implementation from creating thread-local
- selectors, since Hadoop does not have control on when these are closed
- and could end up taking all the available file descriptors.
- <P>
- <DD><DL>
- <DT><B>Parameters:</B><DD><CODE>socket</CODE> - <DD><CODE>endpoint</CODE> - <DD><CODE>timeout</CODE> - - timeout in milliseconds
- <DT><B>Throws:</B>
- <DD><CODE>java.io.IOException</CODE><DT><B>See Also:</B><DD><CODE>Socket.connect(java.net.SocketAddress, int)</CODE></DL>
- </DD>
- </DL>
- <HR>
- <A NAME="normalizeHostName(java.lang.String)"><!-- --></A><H3>
- normalizeHostName</H3>
- <PRE>
- public static java.lang.String <B>normalizeHostName</B>(java.lang.String name)</PRE>
- <DL>
- <DD>Given a string representation of a host, return its ip address
- in textual presentation.
- <P>
- <DD><DL>
- <DT><B>Parameters:</B><DD><CODE>name</CODE> - a string representation of a host:
- either a textual representation its IP address or its host name
- <DT><B>Returns:</B><DD>its IP address in the string format</DL>
- </DD>
- </DL>
- <HR>
- <A NAME="normalizeHostNames(java.util.Collection)"><!-- --></A><H3>
- normalizeHostNames</H3>
- <PRE>
- public static java.util.List<java.lang.String> <B>normalizeHostNames</B>(java.util.Collection<java.lang.String> names)</PRE>
- <DL>
- <DD>Given a collection of string representation of hosts, return a list of
- corresponding IP addresses in the textual representation.
- <P>
- <DD><DL>
- <DT><B>Parameters:</B><DD><CODE>names</CODE> - a collection of string representations of hosts
- <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>
- </DD>
- </DL>
- <!-- ========= END OF CLASS DATA ========= -->
- <HR>
- <!-- ======= START OF BOTTOM NAVBAR ====== -->
- <A NAME="navbar_bottom"><!-- --></A>
- <A HREF="#skip-navbar_bottom" title="Skip navigation links"></A>
- <TABLE BORDER="0" WIDTH="100%" CELLPADDING="1" CELLSPACING="0" SUMMARY="">
- <TR>
- <TD COLSPAN=2 BGCOLOR="#EEEEFF" CLASS="NavBarCell1">
- <A NAME="navbar_bottom_firstrow"><!-- --></A>
- <TABLE BORDER="0" CELLPADDING="0" CELLSPACING="3" SUMMARY="">
- <TR ALIGN="center" VALIGN="top">
- <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../overview-summary.html"><FONT CLASS="NavBarFont1"><B>Overview</B></FONT></A> </TD>
- <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="package-summary.html"><FONT CLASS="NavBarFont1"><B>Package</B></FONT></A> </TD>
- <TD BGCOLOR="#FFFFFF" CLASS="NavBarCell1Rev"> <FONT CLASS="NavBarFont1Rev"><B>Class</B></FONT> </TD>
- <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="class-use/NetUtils.html"><FONT CLASS="NavBarFont1"><B>Use</B></FONT></A> </TD>
- <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="package-tree.html"><FONT CLASS="NavBarFont1"><B>Tree</B></FONT></A> </TD>
- <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../deprecated-list.html"><FONT CLASS="NavBarFont1"><B>Deprecated</B></FONT></A> </TD>
- <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../index-all.html"><FONT CLASS="NavBarFont1"><B>Index</B></FONT></A> </TD>
- <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../help-doc.html"><FONT CLASS="NavBarFont1"><B>Help</B></FONT></A> </TD>
- </TR>
- </TABLE>
- </TD>
- <TD ALIGN="right" VALIGN="top" ROWSPAN=3><EM>
- </EM>
- </TD>
- </TR>
- <TR>
- <TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2">
- <A HREF="../../../../org/apache/hadoop/net/DNSToSwitchMapping.html" title="interface in org.apache.hadoop.net"><B>PREV CLASS</B></A>
- <A HREF="../../../../org/apache/hadoop/net/NetworkTopology.html" title="class in org.apache.hadoop.net"><B>NEXT CLASS</B></A></FONT></TD>
- <TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2">
- <A HREF="../../../../index.html?org/apache/hadoop/net/NetUtils.html" target="_top"><B>FRAMES</B></A>
- <A HREF="NetUtils.html" target="_top"><B>NO FRAMES</B></A>
- <SCRIPT type="text/javascript">
- <!--
- if(window==top) {
- document.writeln('<A HREF="../../../../allclasses-noframe.html"><B>All Classes</B></A>');
- }
- //-->
- </SCRIPT>
- <NOSCRIPT>
- <A HREF="../../../../allclasses-noframe.html"><B>All Classes</B></A>
- </NOSCRIPT>
- </FONT></TD>
- </TR>
- <TR>
- <TD VALIGN="top" CLASS="NavBarCell3"><FONT SIZE="-2">
- SUMMARY: NESTED | FIELD | <A HREF="#constructor_summary">CONSTR</A> | <A HREF="#method_summary">METHOD</A></FONT></TD>
- <TD VALIGN="top" CLASS="NavBarCell3"><FONT SIZE="-2">
- DETAIL: FIELD | <A HREF="#constructor_detail">CONSTR</A> | <A HREF="#method_detail">METHOD</A></FONT></TD>
- </TR>
- </TABLE>
- <A NAME="skip-navbar_bottom"></A>
- <!-- ======== END OF BOTTOM NAVBAR ======= -->
- <HR>
- Copyright © 2009 The Apache Software Foundation
- </BODY>
- </HTML>