Class Server.Connection

java.lang.Object
org.apache.hadoop.ipc.Server.Connection
Enclosing class:
Server

public class Server.Connection extends Object
Reads calls from a connection and queues them for handling.
  • Field Details

  • Constructor Details

    • Connection

      public Connection(SocketChannel channel, long lastContact, int ingressPort, boolean isOnAuxiliaryPort)
  • Method Details

    • toString

      public String toString()
      Overrides:
      toString in class Object
    • getHostAddress

      public String getHostAddress()
    • getIngressPort

      public int getIngressPort()
    • getRemotePort

      public int getRemotePort()
    • getHostInetAddress

      public InetAddress getHostInetAddress()
    • getEstablishedQOP

      public String getEstablishedQOP()
    • isOnAuxiliaryPort

      public boolean isOnAuxiliaryPort()
    • setLastContact

      public void setLastContact(long lastContact)
    • getLastContact

      public long getLastContact()
    • getServer

      public Server getServer()
    • getConf

      public Configuration getConf()
    • readAndProcess

      public int readAndProcess() throws IOException, InterruptedException
      This method reads in a non-blocking fashion from the channel: this method is called repeatedly when data is present in the channel; when it has enough data to process one rpc it processes that rpc. On the first pass, it processes the connectionHeader, connectionContext (an outOfBand RPC) and at most one RPC request that follows that. On future passes it will process at most one RPC request. Quirky things: dataLengthBuffer (4 bytes) is used to read "hrpc" OR rpc request length.
      Returns:
      -1 in case of error, else num bytes read so far
      Throws:
      IOException - - internal error that should not be returned to client, typically failure to respond to client
      InterruptedException - - if the thread is interrupted.
    • getServiceClass

      public int getServiceClass()
      Get service class for connection
      Returns:
      the serviceClass
    • setServiceClass

      public void setServiceClass(int serviceClass)
      Set service class for connection
      Parameters:
      serviceClass - the serviceClass to set