org.apache.hadoop.net
Class NetUtils

java.lang.Object
  extended by org.apache.hadoop.net.NetUtils

public class NetUtils
extends Object


Constructor Summary
NetUtils()
           
 
Method Summary
static SocketFactory getDefaultSocketFactory(Configuration conf)
          Get the default socket factory as specified by the configuration parameter hadoop.rpc.socket.factory.default
static SocketFactory getSocketFactory(Configuration conf, Class<?> clazz)
          Get the socket factory for the given class according to its configuration parameter hadoop.rpc.socket.factory.class.<ClassName>.
static SocketFactory getSocketFactoryFromProperty(Configuration conf, String propValue)
          Get the socket factory corresponding to the given proxy URI.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

NetUtils

public NetUtils()
Method Detail

getSocketFactory

public static SocketFactory getSocketFactory(Configuration conf,
                                             Class<?> clazz)
Get the socket factory for the given class according to its configuration parameter hadoop.rpc.socket.factory.class.<ClassName>. When no such parameter exists then fall back on the default socket factory as configured by hadoop.rpc.socket.factory.class.default. If this default socket factory is not configured, then fall back on the JVM default socket factory.

Parameters:
conf - the configuration
clazz - the class (usually a VersionedProtocol)
Returns:
a socket factory

getDefaultSocketFactory

public static SocketFactory getDefaultSocketFactory(Configuration conf)
Get the default socket factory as specified by the configuration parameter hadoop.rpc.socket.factory.default

Parameters:
conf - the configuration
Returns:
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.

getSocketFactoryFromProperty

public static SocketFactory getSocketFactoryFromProperty(Configuration conf,
                                                         String propValue)
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.

Parameters:
propValue - the property which is the class name of the SocketFactory to instantiate; assumed non null and non empty.
Returns:
a socket factory as defined in the property value.


Copyright © 2006 The Apache Software Foundation