Examples of SocketOutputStream


Examples of hudson.remoting.SocketOutputStream

            logger.println(Messages.ManagedWindowsServiceLauncher_ConnectingToPort(p));
            final Socket s = new Socket(name,p);

            // ready
            computer.setChannel(new BufferedInputStream(new SocketInputStream(s)),
                new BufferedOutputStream(new SocketOutputStream(s)),
                listener.getLogger(),new Listener() {
                    @Override
                    public void onClosed(Channel channel, IOException cause) {
                        afterDisconnect(computer,listener);
                    }
View Full Code Here

Examples of hudson.remoting.SocketOutputStream

                while(true) {
                    final Socket s = socket.accept();
                    new Thread("Port forwarding session from "+s.getRemoteSocketAddress()) {
                        public void run() {
                            try {
                                final OutputStream out = forwarder.connect(new RemoteOutputStream(new SocketOutputStream(s)));
                                new CopyThread("Copier for "+s.getRemoteSocketAddress(),
                                    new SocketInputStream(s), out).start();
                            } catch (IOException e) {
                                // this happens if the socket connection is terminated abruptly.
                                LOGGER.log(FINE,"Port forwarding session was shut down abnormally",e);
View Full Code Here

Examples of org.apache.hadoop.net.SocketOutputStream

   
    try {
      if (blockInPosition >= 0) {
        //use transferTo(). Checks on out and blockIn are already done.

        SocketOutputStream sockOut = (SocketOutputStream)out;
        //first write the packet
        sockOut.write(buf, 0, dataOff);
        // no need to flush. since we know out is not a buffered stream.

        sockOut.transferToFully(((FileInputStream)blockIn).getChannel(),
                                blockInPosition, len);

        blockInPosition += len;
      } else {
        // normal transfer
View Full Code Here

Examples of org.apache.hadoop.net.SocketOutputStream

    long checksumSize = ckHdr.getChecksumSize();
    long startMetaOffset = versionSize + cheaderSize + startChunkNumber * checksumSize;
    long metaLength = numChunks * checksumSize;

    // get a connection back to the client
    SocketOutputStream out = new SocketOutputStream(s, datanode.socketWriteTimeout);

    try {

      // write out the checksum type and bytesperchecksum to client
      // skip the first two bytes that describe the version
View Full Code Here

Examples of org.apache.hadoop.net.SocketOutputStream

        throw ioeToSocketException(e);
      }
    } else {
      try {
        //use transferTo(). Checks on out and blockIn are already done.
        SocketOutputStream sockOut = (SocketOutputStream) out;
        FileChannel fileChannel = ((FileInputStream) blockIn).getChannel();

        if (memoizedBlock.hasBlockChanged(len)) {
          fileChannel.position(blockInPosition);
          IOUtils.readFileChannelFully(
            fileChannel,
            buf,
            dataOff,
            len
          );
         
          ChecksumUtil.updateChunkChecksum(
            buf, checksumOff, dataOff, len, checksum
          );         
          sockOut.write(buf, 0, dataOff + len);
        } else {
          //first write the packet
          sockOut.write(buf, 0, dataOff);
          // no need to flush. since we know out is not a buffered stream.
          sockOut.transferToFully(fileChannel, blockInPosition, len);
        }

        blockInPosition += len;

      } catch (IOException e) {
View Full Code Here

Examples of org.apache.hadoop.net.SocketOutputStream

      }
    }
   
    try {
      if (transferTo) {
        SocketOutputStream sockOut = (SocketOutputStream)out;
        // First write header and checksums
        sockOut.write(buf, headerOff, dataOff - headerOff);
       
        // no need to flush since we know out is not a buffered stream
        FileChannel fileCh = ((FileInputStream)blockIn).getChannel();
        LongWritable waitTime = new LongWritable();
        LongWritable transferTime = new LongWritable();
        sockOut.transferToFully(fileCh, blockInPosition, dataLen,
            waitTime, transferTime);
        datanode.metrics.addSendDataPacketBlockedOnNetworkNanos(waitTime.get());
        datanode.metrics.addSendDataPacketTransferNanos(transferTime.get());
        blockInPosition += dataLen;
      } else {
View Full Code Here

Examples of org.apache.hadoop.net.SocketOutputStream

   
    try {
      if (blockInPosition >= 0) {
        //use transferTo(). Checks on out and blockIn are already done.

        SocketOutputStream sockOut = (SocketOutputStream)out;
        //first write the packet
        sockOut.write(buf, 0, dataOff);
        // no need to flush. since we know out is not a buffered stream.

        sockOut.transferToFully(((FileInputStream)blockIn).getChannel(),
                                blockInPosition, len);

        blockInPosition += len;
      } else {
        // normal transfer
View Full Code Here

Examples of org.apache.hadoop.net.SocketOutputStream

      }
    }
   
    try {
      if (transferTo) {
        SocketOutputStream sockOut = (SocketOutputStream)out;
        // First write header and checksums
        sockOut.write(buf, headerOff, dataOff - headerOff);
       
        // no need to flush since we know out is not a buffered stream
        FileChannel fileCh = ((FileInputStream)blockIn).getChannel();
        LongWritable waitTime = new LongWritable();
        LongWritable transferTime = new LongWritable();
        sockOut.transferToFully(fileCh, blockInPosition, dataLen,
            waitTime, transferTime);
        datanode.metrics.addSendDataPacketBlockedOnNetworkNanos(waitTime.get());
        datanode.metrics.addSendDataPacketTransferNanos(transferTime.get());
        blockInPosition += dataLen;
      } else {
View Full Code Here

Examples of org.apache.hadoop.net.SocketOutputStream

     
      try {
        if (blockInPosition >= 0) {
          //use transferTo(). Checks on out and blockIn are already done.

          SocketOutputStream sockOut = (SocketOutputStream)out;
          //first write the packet
          sockOut.write(buf, 0, dataOff);
          // no need to flush. since we know out is not a buffered stream.

          sockOut.transferToFully(((FileInputStream)blockIn).getChannel(),
                                  blockInPosition, len);

          blockInPosition += len;
        } else {
          // normal transfer
View Full Code Here

Examples of org.apache.hadoop.net.SocketOutputStream

   
    try {
      if (blockInPosition >= 0) {
        //use transferTo(). Checks on out and blockIn are already done.

        SocketOutputStream sockOut = (SocketOutputStream)out;
        //first write the packet
        sockOut.write(buf, 0, dataOff);
        // no need to flush. since we know out is not a buffered stream.

        sockOut.transferToFully(((FileInputStream)blockIn).getChannel(),
                                blockInPosition, len);

        blockInPosition += len;
      } else {
        // normal transfer
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.