org.apache.zookeeper.server
Class NIOServerCnxn

java.lang.Object
  extended by org.apache.zookeeper.server.ServerCnxn
      extended by org.apache.zookeeper.server.NIOServerCnxn
All Implemented Interfaces:
Watcher

public class NIOServerCnxn
extends ServerCnxn

This class handles communication with clients using NIO. There is one per client, but only one thread doing the communication.


Nested Class Summary
 
Nested classes/interfaces inherited from class org.apache.zookeeper.server.ServerCnxn
ServerCnxn.CloseRequestException, ServerCnxn.EndOfStreamException
 
Nested classes/interfaces inherited from interface org.apache.zookeeper.Watcher
Watcher.Event
 
Field Summary
 
Fields inherited from class org.apache.zookeeper.server.ServerCnxn
authInfo, cmd2String, confCmd, consCmd, count, crstCmd, dumpCmd, enviCmd, established, getTraceMaskCmd, isroCmd, lastCxid, lastLatency, lastOp, lastResponseTime, lastZxid, maxLatency, me, minLatency, mntrCmd, packetsReceived, packetsSent, ruokCmd, setTraceMaskCmd, srstCmd, srvrCmd, statCmd, totalLatency, wchcCmd, wchpCmd, wchsCmd, zooKeeperSaslServer
 
Constructor Summary
NIOServerCnxn(ZooKeeperServer zk, SocketChannel sock, SelectionKey sk, NIOServerCnxnFactory factory)
           
 
Method Summary
 void close()
           
 void disableRecv()
           
 void enableRecv()
           
 int getInterestOps()
           
 long getOutstandingRequests()
          The number of requests that have been submitted but not yet responded to.
 InetSocketAddress getRemoteSocketAddress()
           
 long getSessionId()
           
 int getSessionTimeout()
           
protected  void incrOutstandingRequests(RequestHeader h)
           
 void process(WatchedEvent event)
           
 void sendBuffer(ByteBuffer bb)
           
 void sendCloseSession()
           
 void sendResponse(ReplyHeader h, org.apache.jute.Record r, String tag)
           
protected  ServerStats serverStats()
           
 void setSessionId(long sessionId)
           
 void setSessionTimeout(int sessionTimeout)
           
 String toString()
          Prints detailed stats information for the connection.
 
Methods inherited from class org.apache.zookeeper.server.ServerCnxn
addAuthInfo, dumpConnectionInfo, getAuthInfo, getAvgLatency, getEstablished, getLastCxid, getLastLatency, getLastOperation, getLastResponseTime, getLastZxid, getMaxLatency, getMinLatency, getPacketsReceived, getPacketsSent, incrPacketsReceived, incrPacketsSent, packetReceived, packetSent, removeAuthInfo, resetStats, updateStatsForResponse
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

NIOServerCnxn

public NIOServerCnxn(ZooKeeperServer zk,
                     SocketChannel sock,
                     SelectionKey sk,
                     NIOServerCnxnFactory factory)
              throws IOException
Throws:
IOException
Method Detail

sendCloseSession

public void sendCloseSession()

sendBuffer

public void sendBuffer(ByteBuffer bb)

incrOutstandingRequests

protected void incrOutstandingRequests(RequestHeader h)
Overrides:
incrOutstandingRequests in class ServerCnxn

disableRecv

public void disableRecv()

enableRecv

public void enableRecv()

getOutstandingRequests

public long getOutstandingRequests()
The number of requests that have been submitted but not yet responded to.

Specified by:
getOutstandingRequests in class ServerCnxn

getSessionTimeout

public int getSessionTimeout()

toString

public String toString()
Description copied from class: ServerCnxn
Prints detailed stats information for the connection.

Overrides:
toString in class ServerCnxn
See Also:
for brief stats

close

public void close()

sendResponse

public void sendResponse(ReplyHeader h,
                         org.apache.jute.Record r,
                         String tag)
Specified by:
sendResponse in class ServerCnxn

process

public void process(WatchedEvent event)
Specified by:
process in interface Watcher
Specified by:
process in class ServerCnxn

getSessionId

public long getSessionId()

setSessionId

public void setSessionId(long sessionId)

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

serverStats

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


Copyright © 2011 The Apache Software Foundation