Example usage for org.apache.hadoop.hdfs.protocol HdfsConstants DEFAULT_DATA_SOCKET_SIZE

List of usage examples for org.apache.hadoop.hdfs.protocol HdfsConstants DEFAULT_DATA_SOCKET_SIZE

Introduction

In this page you can find the example usage for org.apache.hadoop.hdfs.protocol HdfsConstants DEFAULT_DATA_SOCKET_SIZE.

Prototype

int DEFAULT_DATA_SOCKET_SIZE

To view the source code for org.apache.hadoop.hdfs.protocol HdfsConstants DEFAULT_DATA_SOCKET_SIZE.

Click Source Link

Usage

From source file:com.mellanox.r4h.DFSOutputStream.java

License:Apache License

/**
 * Create a socket for a write pipeline//from   w  ww.  ja  v  a  2  s  .  co m
 * 
 * @param first
 *            the first datanode
 * @param length
 *            the pipeline length
 * @param client
 *            client
 * @return the socket connected to the first datanode
 */
static Socket createSocketForPipeline(final DatanodeInfo first, final int length, final DFSClient client)
        throws IOException {
    final String dnAddr = first.getXferAddr(client.getConf().getConnectToDnViaHostname());
    if (DFSClient.LOG.isDebugEnabled()) {
        DFSClient.LOG.debug("Connecting to datanode " + dnAddr);
    }
    final InetSocketAddress isa = NetUtils.createSocketAddr(dnAddr);
    final Socket sock = client.socketFactory.createSocket();
    final int timeout = client.getDatanodeReadTimeout(length);
    NetUtils.connect(sock, isa, client.getRandomLocalInterfaceAddr(), client.getConf().getSocketTimeout());
    sock.setSoTimeout(timeout);
    sock.setSendBufferSize(HdfsConstants.DEFAULT_DATA_SOCKET_SIZE);
    if (DFSClient.LOG.isDebugEnabled()) {
        DFSClient.LOG.debug("Send buf size " + sock.getSendBufferSize());
    }
    return sock;
}