/** * Same as <code>getInputStream(socket, socket.getSoTimeout()).</code> * <br><br> * * @see #getInputStream(Socket, long) */ public static SocketInputWrapper getInputStream(Socket socket) throws IOException { return getInputStream(socket, socket.getSoTimeout()); }
IpcStreams(Socket socket, int maxResponseLength) throws IOException { this.maxResponseLength = maxResponseLength; setInputStream( new BufferedInputStream(NetUtils.getInputStream(socket))); setOutputStream( new BufferedOutputStream(NetUtils.getOutputStream(socket))); }
while (true) { setupConnection(); InputStream inStream = NetUtils.getInputStream(socket);
while (true) { setupConnection(); InputStream inStream = NetUtils.getInputStream(socket);
HdfsConstants.WRITE_TIMEOUT_EXTENSION * (targets.length-1); OutputStream unbufOut = NetUtils.getOutputStream(sock, writeTimeout); InputStream unbufIn = NetUtils.getInputStream(sock); DataEncryptionKeyFactory keyFactory = getDataEncryptionKeyFactoryForBlock(b);
InputStream unbufProxyIn = NetUtils.getInputStream(proxySock); DataEncryptionKeyFactory keyFactory = datanode.getDataEncryptionKeyFactoryForBlock(block);
InputStream unbufIn = NetUtils.getInputStream(socket); DataEncryptionKeyFactory keyFactory = datanode.getDataEncryptionKeyFactoryForBlock(block);
/** * Same as <code>getInputStream(socket, socket.getSoTimeout()).</code> * <br><br> * * @see #getInputStream(Socket, long) */ public static SocketInputWrapper getInputStream(Socket socket) throws IOException { return getInputStream(socket, socket.getSoTimeout()); }
/** * Same as <code>getInputStream(socket, socket.getSoTimeout()).</code> * <br><br> * * @see #getInputStream(Socket, long) */ public static SocketInputWrapper getInputStream(Socket socket) throws IOException { return getInputStream(socket, socket.getSoTimeout()); }
/** * Same as <code>getInputStream(socket, socket.getSoTimeout()).</code> * <br><br> * * @see #getInputStream(Socket, long) */ public static SocketInputWrapper getInputStream(Socket socket) throws IOException { return getInputStream(socket, socket.getSoTimeout()); }
/** * Same as <code>getInputStream(socket, socket.getSoTimeout()).</code> * <br><br> * * @see #getInputStream(Socket, long) */ public static SocketInputWrapper getInputStream(Socket socket) throws IOException { return getInputStream(socket, socket.getSoTimeout()); }
InputStream unbufMirrorIn = NetUtils.getInputStream(mirrorSock); DataEncryptionKeyFactory keyFactory = datanode.getDataEncryptionKeyFactoryForBlock(block);
/** * Same as getInputStream(socket, socket.getSoTimeout()).<br><br> * * From documentation for {@link #getInputStream(Socket, long)}:<br> * Returns InputStream for the socket. If the socket has an associated * SocketChannel then it returns a * {@link SocketInputStream} with the given timeout. If the socket does not * have a channel, {@link Socket#getInputStream()} is returned. In the later * case, the timeout argument is ignored and the timeout set with * {@link Socket#setSoTimeout(int)} applies for reads.<br><br> * * Any socket created using socket factories returned by {@link #NetUtils}, * must use this interface instead of {@link Socket#getInputStream()}. * * @see #getInputStream(Socket, long) * * @param socket * @return InputStream for reading from the socket. * @throws IOException */ public static InputStream getInputStream(Socket socket) throws IOException { return getInputStream(socket, socket.getSoTimeout()); }
/** * Same as getInputStream(socket, socket.getSoTimeout()).<br><br> * * From documentation for {@link #getInputStream(Socket, long)}:<br> * Returns InputStream for the socket. If the socket has an associated * SocketChannel then it returns a * {@link SocketInputStream} with the given timeout. If the socket does not * have a channel, {@link Socket#getInputStream()} is returned. In the later * case, the timeout argument is ignored and the timeout set with * {@link Socket#setSoTimeout(int)} applies for reads.<br><br> * * Any socket created using socket factories returned by {@link #NetUtils}, * must use this interface instead of {@link Socket#getInputStream()}. * * @see #getInputStream(Socket, long) * * @param socket * @return InputStream for reading from the socket. * @throws IOException */ public static InputStream getInputStream(Socket socket) throws IOException { return getInputStream(socket, socket.getSoTimeout()); }
StreamerStreams(final DatanodeInfo src, final long writeTimeout, final long readTimeout, final Token<BlockTokenIdentifier> blockToken) throws IOException { sock = createSocketForPipeline(src, 2, dfsClient); OutputStream unbufOut = NetUtils.getOutputStream(sock, writeTimeout); InputStream unbufIn = NetUtils.getInputStream(sock, readTimeout); IOStreamPair saslStreams = dfsClient.saslClient .socketSend(sock, unbufOut, unbufIn, dfsClient, blockToken, src); unbufOut = saslStreams.out; unbufIn = saslStreams.in; out = new DataOutputStream(new BufferedOutputStream(unbufOut, HdfsConstants.SMALL_BUFFER_SIZE)); in = new DataInputStream(unbufIn); }
StreamerStreams(final DatanodeInfo src, final long writeTimeout, final long readTimeout, final Token<BlockTokenIdentifier> blockToken) throws IOException { sock = createSocketForPipeline(src, 2, dfsClient); OutputStream unbufOut = NetUtils.getOutputStream(sock, writeTimeout); InputStream unbufIn = NetUtils.getInputStream(sock, readTimeout); IOStreamPair saslStreams = dfsClient.saslClient .socketSend(sock, unbufOut, unbufIn, dfsClient, blockToken, src); unbufOut = saslStreams.out; unbufIn = saslStreams.in; out = new DataOutputStream(new BufferedOutputStream(unbufOut, HdfsConstants.SMALL_BUFFER_SIZE)); in = new DataInputStream(unbufIn); }
IpcStreams(Socket socket, int maxResponseLength) throws IOException { this.maxResponseLength = maxResponseLength; setInputStream( new BufferedInputStream(NetUtils.getInputStream(socket))); setOutputStream( new BufferedOutputStream(NetUtils.getOutputStream(socket))); }
StreamerStreams(final DatanodeInfo src, final long writeTimeout, final long readTimeout, final Token<BlockTokenIdentifier> blockToken) throws IOException { sock = createSocketForPipeline(src, 2, dfsClient); OutputStream unbufOut = NetUtils.getOutputStream(sock, writeTimeout); InputStream unbufIn = NetUtils.getInputStream(sock, readTimeout); IOStreamPair saslStreams = dfsClient.saslClient .socketSend(sock, unbufOut, unbufIn, dfsClient, blockToken, src); unbufOut = saslStreams.out; unbufIn = saslStreams.in; out = new DataOutputStream(new BufferedOutputStream(unbufOut, DFSUtilClient.getSmallBufferSize(dfsClient.getConfiguration()))); in = new DataInputStream(unbufIn); }
/** * Connect to the given datanode's datantrasfer port, and return * the resulting IOStreamPair. This includes encryption wrapping, etc. */ private IOStreamPair connectToDN(DatanodeInfo dn, int timeout, LocatedBlock lb) throws IOException { boolean success = false; Socket sock = null; try { sock = socketFactory.createSocket(); String dnAddr = dn.getXferAddr(getConf().connectToDnViaHostname); if (LOG.isDebugEnabled()) { LOG.debug("Connecting to datanode " + dnAddr); } NetUtils.connect(sock, NetUtils.createSocketAddr(dnAddr), timeout); sock.setSoTimeout(timeout); OutputStream unbufOut = NetUtils.getOutputStream(sock); InputStream unbufIn = NetUtils.getInputStream(sock); IOStreamPair ret = saslClient.newSocketSend(sock, unbufOut, unbufIn, this, lb.getBlockToken(), dn); success = true; return ret; } finally { if (!success) { IOUtils.closeSocket(sock); } } }
/** For {@link TestTransferRbw} */ public static BlockOpResponseProto transferRbw(final ExtendedBlock b, final DFSClient dfsClient, final DatanodeInfo... datanodes) throws IOException { assertEquals(2, datanodes.length); final Socket s = DFSOutputStream.createSocketForPipeline(datanodes[0], datanodes.length, dfsClient); final long writeTimeout = dfsClient.getDatanodeWriteTimeout(datanodes.length); final DataOutputStream out = new DataOutputStream(new BufferedOutputStream( NetUtils.getOutputStream(s, writeTimeout), HdfsConstants.SMALL_BUFFER_SIZE)); final DataInputStream in = new DataInputStream(NetUtils.getInputStream(s)); // send the request new Sender(out).transferBlock(b, new Token<BlockTokenIdentifier>(), dfsClient.clientName, new DatanodeInfo[]{datanodes[1]}, new StorageType[]{StorageType.DEFAULT}); out.flush(); return BlockOpResponseProto.parseDelimitedFrom(in); }