Class NettyServerCnxn

java.lang.Object
org.apache.zookeeper.server.ServerCnxn
org.apache.zookeeper.server.NettyServerCnxn
All Implemented Interfaces:
ServerWatcher, Watcher

public class NettyServerCnxn extends ServerCnxn
  • Field Details

    • readIssuedAfterReadComplete

      public int readIssuedAfterReadComplete
  • Method Details

    • close

      public void close(ServerCnxn.DisconnectReason reason)
      Close the cnxn and remove it from the factory cnxns list.
      Specified by:
      close in class ServerCnxn
    • close

      public void close()
    • getSessionId

      public long getSessionId()
      Specified by:
      getSessionId in class ServerCnxn
    • getSessionTimeout

      public int getSessionTimeout()
    • process

      public void process(WatchedEvent event, List<ACL> znodeAcl)
      Specified by:
      process in interface ServerWatcher
      Specified by:
      process in class ServerCnxn
    • sendResponse

      public int sendResponse(ReplyHeader h, Record r, String tag, String cacheKey, Stat stat, int opCode) throws IOException
      Description copied from class: ServerCnxn
      Serializes a ZooKeeper response and enqueues it for sending. Serializes client response parts and enqueues them into outgoing queue. If both cache key and last modified zxid are provided, the serialized response is caсhed under the provided key, the last modified zxid is stored along with the value. A cache entry is invalidated if the provided last modified zxid is more recent than the stored one. Attention: this function is not thread safe, due to caching not being thread safe.
      Specified by:
      sendResponse in class ServerCnxn
      Parameters:
      h - reply header
      r - reply payload, can be null
      tag - Jute serialization tag, can be null
      cacheKey - Key for caching the serialized payload. A null value prevents caching.
      stat - Stat information for the the reply payload, used for cache invalidation. A value of 0 prevents caching.
      opCode - The op code appertains to the corresponding request of the response, used to decide which cache (e.g. read response cache, list of children response cache, ...) object to look up to when applicable.
      Throws:
      IOException
    • setSessionId

      public void setSessionId(long sessionId)
    • sendBuffer

      public void sendBuffer(ByteBuffer... buffers)
    • disableRecv

      public void disableRecv(boolean waitDisableRecv)
      Note that the netty implementation ignores the waitDisableRecv parameter and is always asynchronous.
      Parameters:
      waitDisableRecv - ignored by this implementation.
    • enableRecv

      public void enableRecv()
    • setSessionTimeout

      public void setSessionTimeout(int sessionTimeout)
    • getInterestOps

      public int getInterestOps()
      Specified by:
      getInterestOps in class ServerCnxn
    • getRemoteSocketAddress

      public InetSocketAddress getRemoteSocketAddress()
      Specified by:
      getRemoteSocketAddress in class ServerCnxn
    • sendCloseSession

      public void sendCloseSession()
      Send close connection packet to the client.
      Specified by:
      sendCloseSession in class ServerCnxn
    • serverStats

      protected ServerStats serverStats()
      Specified by:
      serverStats in class ServerCnxn
    • isSecure

      public boolean isSecure()
      Specified by:
      isSecure in class ServerCnxn
    • getClientCertificateChain

      public Certificate[] getClientCertificateChain()
      Specified by:
      getClientCertificateChain in class ServerCnxn
    • setClientCertificateChain

      public void setClientCertificateChain(Certificate[] chain)
      Specified by:
      setClientCertificateChain in class ServerCnxn
    • getQueuedReadableBytes

      public int getQueuedReadableBytes()
    • setHandshakeState

      public void setHandshakeState(NettyServerCnxn.HandshakeState state)
    • getHandshakeState

      public NettyServerCnxn.HandshakeState getHandshakeState()