org.apache.zookeeper.server
Class ServerCnxn

java.lang.Object
  extended by org.apache.zookeeper.server.ServerCnxn
All Implemented Interfaces:
Watcher
Direct Known Subclasses:
NettyServerCnxn, NIOServerCnxn

public abstract class ServerCnxn
extends Object
implements Watcher

Interface to a Server connection - represents a connection from a client to the server.


Nested Class Summary
protected static class ServerCnxn.CloseRequestException
           
protected static class ServerCnxn.EndOfStreamException
           
 
Nested classes/interfaces inherited from interface org.apache.zookeeper.Watcher
Watcher.Event
 
Field Summary
protected  ArrayList<Id> authInfo
           
protected static HashMap<Integer,String> cmd2String
           
protected static int confCmd
           
protected static int consCmd
           
protected  long count
           
protected static int crstCmd
           
protected static int dumpCmd
           
protected static int enviCmd
           
protected  Date established
           
protected static int getTraceMaskCmd
           
protected static int isroCmd
           
protected  long lastCxid
           
protected  long lastLatency
           
protected  String lastOp
           
protected  long lastResponseTime
           
protected  long lastZxid
           
protected  long maxLatency
           
static Object me
           
protected  long minLatency
           
protected static int mntrCmd
           
protected  AtomicLong packetsReceived
           
protected  AtomicLong packetsSent
           
protected static int ruokCmd
           
protected static int setTraceMaskCmd
           
protected static int srstCmd
           
protected static int srvrCmd
           
protected static int statCmd
           
protected  long totalLatency
           
protected static int wchcCmd
           
protected static int wchpCmd
           
protected static int wchsCmd
           
protected  ZooKeeperSaslServer zooKeeperSaslServer
           
 
Constructor Summary
ServerCnxn()
           
 
Method Summary
 void addAuthInfo(Id id)
           
protected  void dumpConnectionInfo(PrintWriter pwriter, boolean brief)
          Print information about the connection.
 List<Id> getAuthInfo()
          auth info for the cnxn, returns an unmodifyable list
 long getAvgLatency()
          Average latency in ms
 Date getEstablished()
          Date/time the connection was established
abstract  int getInterestOps()
           
 long getLastCxid()
          Last cxid of this connection
 long getLastLatency()
          Latency of last response to client on this connection in ms
 String getLastOperation()
          Last operation performed by this connection
 long getLastResponseTime()
          Last time server sent a response to client on this connection
 long getLastZxid()
          Last zxid of this connection
 long getMaxLatency()
          Max latency in ms
 long getMinLatency()
          Min latency in ms
abstract  long getOutstandingRequests()
          The number of requests that have been submitted but not yet responded to.
 long getPacketsReceived()
          Number of packets received
 long getPacketsSent()
          Number of packets sent (incl notifications)
abstract  InetSocketAddress getRemoteSocketAddress()
           
protected  void incrOutstandingRequests(RequestHeader h)
           
protected  long incrPacketsReceived()
           
protected  long incrPacketsSent()
           
protected  void packetReceived()
           
protected  void packetSent()
           
abstract  void process(WatchedEvent event)
           
 boolean removeAuthInfo(Id id)
           
 void resetStats()
          Reset counters
abstract  void sendResponse(ReplyHeader h, org.apache.jute.Record r, String tag)
           
protected abstract  ServerStats serverStats()
           
 String toString()
          Prints detailed stats information for the connection.
protected  void updateStatsForResponse(long cxid, long zxid, String op, long start, long end)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

me

public static final Object me

authInfo

protected ArrayList<Id> authInfo

zooKeeperSaslServer

protected ZooKeeperSaslServer zooKeeperSaslServer

confCmd

protected static final int confCmd

consCmd

protected static final int consCmd

crstCmd

protected static final int crstCmd

dumpCmd

protected static final int dumpCmd

enviCmd

protected static final int enviCmd

getTraceMaskCmd

protected static final int getTraceMaskCmd

ruokCmd

protected static final int ruokCmd

setTraceMaskCmd

protected static final int setTraceMaskCmd

srvrCmd

protected static final int srvrCmd

srstCmd

protected static final int srstCmd

statCmd

protected static final int statCmd

wchcCmd

protected static final int wchcCmd

wchpCmd

protected static final int wchpCmd

wchsCmd

protected static final int wchsCmd

mntrCmd

protected static final int mntrCmd

isroCmd

protected static final int isroCmd

cmd2String

protected static final HashMap<Integer,String> cmd2String

established

protected final Date established

packetsReceived

protected final AtomicLong packetsReceived

packetsSent

protected final AtomicLong packetsSent

minLatency

protected long minLatency

maxLatency

protected long maxLatency

lastOp

protected String lastOp

lastCxid

protected long lastCxid

lastZxid

protected long lastZxid

lastResponseTime

protected long lastResponseTime

lastLatency

protected long lastLatency

count

protected long count

totalLatency

protected long totalLatency
Constructor Detail

ServerCnxn

public ServerCnxn()
Method Detail

sendResponse

public abstract void sendResponse(ReplyHeader h,
                                  org.apache.jute.Record r,
                                  String tag)
                           throws IOException
Throws:
IOException

process

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

getAuthInfo

public List<Id> getAuthInfo()
auth info for the cnxn, returns an unmodifyable list


addAuthInfo

public void addAuthInfo(Id id)

removeAuthInfo

public boolean removeAuthInfo(Id id)

packetReceived

protected void packetReceived()

packetSent

protected void packetSent()

serverStats

protected abstract ServerStats serverStats()

resetStats

public void resetStats()
Reset counters


incrPacketsReceived

protected long incrPacketsReceived()

incrOutstandingRequests

protected void incrOutstandingRequests(RequestHeader h)

incrPacketsSent

protected long incrPacketsSent()

updateStatsForResponse

protected void updateStatsForResponse(long cxid,
                                      long zxid,
                                      String op,
                                      long start,
                                      long end)

getEstablished

public Date getEstablished()
Date/time the connection was established


getOutstandingRequests

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


getPacketsReceived

public long getPacketsReceived()
Number of packets received


getPacketsSent

public long getPacketsSent()
Number of packets sent (incl notifications)


getMinLatency

public long getMinLatency()
Min latency in ms


getAvgLatency

public long getAvgLatency()
Average latency in ms


getMaxLatency

public long getMaxLatency()
Max latency in ms


getLastOperation

public String getLastOperation()
Last operation performed by this connection


getLastCxid

public long getLastCxid()
Last cxid of this connection


getLastZxid

public long getLastZxid()
Last zxid of this connection


getLastResponseTime

public long getLastResponseTime()
Last time server sent a response to client on this connection


getLastLatency

public long getLastLatency()
Latency of last response to client on this connection in ms


toString

public String toString()
Prints detailed stats information for the connection.

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

getRemoteSocketAddress

public abstract InetSocketAddress getRemoteSocketAddress()

getInterestOps

public abstract int getInterestOps()

dumpConnectionInfo

protected void dumpConnectionInfo(PrintWriter pwriter,
                                  boolean brief)
Print information about the connection.

Parameters:
brief - iff true prints brief details, otw full detail


Copyright © 2011 The Apache Software Foundation