Package org.apache.hadoop.net

Examples of org.apache.hadoop.net.SocketInputStream$Reader


  public static TTransport create(SocketAddress addr, long timeoutMillis) throws IOException {
    Socket socket = SelectorProvider.provider().openSocketChannel().socket();
    socket.setSoLinger(false, 0);
    socket.setTcpNoDelay(true);
    socket.connect(addr);
    InputStream input = new BufferedInputStream(new SocketInputStream(socket, timeoutMillis), 1024 * 10);
    OutputStream output = new BufferedOutputStream(new SocketOutputStream(socket, timeoutMillis), 1024 * 10);
    return new TIOStreamTransport(input, output);
  }
View Full Code Here


  private final boolean isLocal;

  NioInetPeer(Socket socket) throws IOException {
    this.socket = socket;
    this.in = new SocketInputStream(socket.getChannel(), 0);
    this.out = new SocketOutputStream(socket.getChannel(), 0);
    this.isLocal = socket.getInetAddress().equals(socket.getLocalAddress());
  }
View Full Code Here

    // Get bytes in block, set streams
    //
    Preconditions.checkArgument(sock.getChannel() != null,
        "Socket %s does not have an associated Channel.",
        sock);
    SocketInputStream sin =
      (SocketInputStream)NetUtils.getInputStream(sock);
    DataInputStream in = new DataInputStream(sin);

    BlockOpResponseProto status = BlockOpResponseProto.parseFrom(
        vintPrefixed(in));
View Full Code Here

  private final boolean isLocal;

  NioInetPeer(Socket socket) throws IOException {
    this.socket = socket;
    this.in = new SocketInputStream(socket.getChannel(), 0);
    this.out = new SocketOutputStream(socket.getChannel(), 0);
    this.isLocal = socket.getInetAddress().equals(socket.getLocalAddress());
  }
View Full Code Here

  public static void main(String[] args) {

    // Creates an object to store the prices
    PricesInfo pricesInfo=new PricesInfo();
   
    Reader readers[]=new Reader[5];
    Thread threadsReader[]=new Thread[5];
   
    // Creates five readers and threads to run them
    for (int i=0; i<5; i++){
      readers[i]=new Reader(pricesInfo);
      threadsReader[i]=new Thread(readers[i]);
    }
   
    // Creates a writer and a thread to run it
    Writer writer=new Writer(pricesInfo);
View Full Code Here

TOP

Related Classes of org.apache.hadoop.net.SocketInputStream$Reader

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.