Package org.apache.hadoop.hdfs.protocol.datatransfer

Examples of org.apache.hadoop.hdfs.protocol.datatransfer.IOStreamPair


        DataOutputStream out = null;
        DataInputStream in = null;
       
        try {
          //connect to a datanode
          IOStreamPair pair = connectToDN(socketFactory, connectToDnViaHostname,
              encryptionKey, datanodes[j], timeout);
          out = new DataOutputStream(new BufferedOutputStream(pair.out,
              HdfsConstants.SMALL_BUFFER_SIZE));
          in = new DataInputStream(pair.in);
View Full Code Here


      NetUtils.connect(sock, NetUtils.createSocketAddr(dnAddr), timeout);
      sock.setSoTimeout(timeout);
 
      OutputStream unbufOut = NetUtils.getOutputStream(sock);
      InputStream unbufIn = NetUtils.getInputStream(sock);
      IOStreamPair ret;
      if (encryptionKey != null) {
        ret = DataTransferEncryptor.getEncryptedStreams(
                unbufOut, unbufIn, encryptionKey);
      } else {
        ret = new IOStreamPair(unbufIn, unbufOut);       
      }
      success = true;
      return ret;
    } finally {
      if (!success) {
View Full Code Here

  private static Type inferChecksumTypeByReading(
      String clientName, SocketFactory socketFactory, int socketTimeout,
      LocatedBlock lb, DatanodeInfo dn,
      DataEncryptionKey encryptionKey, boolean connectToDnViaHostname)
      throws IOException {
    IOStreamPair pair = connectToDN(socketFactory, connectToDnViaHostname,
        encryptionKey, dn, socketTimeout);

    try {
      DataOutputStream out = new DataOutputStream(new BufferedOutputStream(pair.out,
          HdfsConstants.SMALL_BUFFER_SIZE));
View Full Code Here

        long writeTimeout = dnConf.socketWriteTimeout +
                            HdfsServerConstants.WRITE_TIMEOUT_EXTENSION * (targets.length-1);
        OutputStream unbufOut = NetUtils.getOutputStream(sock, writeTimeout);
        InputStream unbufIn = NetUtils.getInputStream(sock);
        if (dnConf.encryptDataTransfer) {
          IOStreamPair encryptedStreams =
              DataTransferEncryptor.getEncryptedStreams(
                  unbufOut, unbufIn,
                  blockPoolTokenSecretManager.generateDataEncryptionKey(
                      b.getBlockPoolId()));
          unbufOut = encryptedStreams.out;
View Full Code Here

   
    try {
     
      InputStream input = socketIn;
      if (dnConf.encryptDataTransfer) {
        IOStreamPair encryptedStreams = null;
        try {
          encryptedStreams = DataTransferEncryptor.getEncryptedStreams(socketOut,
              socketIn, datanode.blockPoolTokenSecretManager,
              dnConf.encryptionAlgorithm);
        } catch (InvalidMagicNumberException imne) {
View Full Code Here

         
          OutputStream unbufMirrorOut = NetUtils.getOutputStream(mirrorSock,
              writeTimeout);
          InputStream unbufMirrorIn = NetUtils.getInputStream(mirrorSock);
          if (dnConf.encryptDataTransfer) {
            IOStreamPair encryptedStreams =
                DataTransferEncryptor.getEncryptedStreams(
                    unbufMirrorOut, unbufMirrorIn,
                    datanode.blockPoolTokenSecretManager
                        .generateDataEncryptionKey(block.getBlockPoolId()));
           
View Full Code Here

      OutputStream unbufProxyOut = NetUtils.getOutputStream(proxySock,
          dnConf.socketWriteTimeout);
      InputStream unbufProxyIn = NetUtils.getInputStream(proxySock);
      if (dnConf.encryptDataTransfer) {
        IOStreamPair encryptedStreams =
            DataTransferEncryptor.getEncryptedStreams(
                unbufProxyOut, unbufProxyIn,
                datanode.blockPoolTokenSecretManager
                    .generateDataEncryptionKey(block.getBlockPoolId()));
        unbufProxyOut = encryptedStreams.out;
View Full Code Here

          long writeTimeout = dfsClient.getDatanodeWriteTimeout(nodes.length);
         
          OutputStream unbufOut = NetUtils.getOutputStream(s, writeTimeout);
          InputStream unbufIn = NetUtils.getInputStream(s);
          if (dfsClient.shouldEncryptData()) {
            IOStreamPair encryptedStreams =
                DataTransferEncryptor.getEncryptedStreams(unbufOut,
                    unbufIn, dfsClient.getDataEncryptionKey());
            unbufOut = encryptedStreams.out;
            unbufIn = encryptedStreams.in;
          }
View Full Code Here

  /**
   * Close the given BlockReader and cache its socket.
   */
  private void closeBlockReader(BlockReader reader) throws IOException {
    if (reader.hasSentStatusCode()) {
      IOStreamPair ioStreams = reader.getStreams();
      Socket oldSock = reader.takeSocket();
      socketCache.put(oldSock, ioStreams);
    }
    reader.close();
  }
View Full Code Here

          sock.setSoTimeout(timeout);

          OutputStream unbufOut = NetUtils.getOutputStream(sock);
          InputStream unbufIn = NetUtils.getInputStream(sock);
          if (encryptionKey != null) {
            IOStreamPair encryptedStreams =
                DataTransferEncryptor.getEncryptedStreams(
                    unbufOut, unbufIn, encryptionKey);
            unbufOut = encryptedStreams.out;
            unbufIn = encryptedStreams.in;
          }
View Full Code Here

TOP

Related Classes of org.apache.hadoop.hdfs.protocol.datatransfer.IOStreamPair

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.