public abstract class ServerCnxn extends Object implements Watcher
Modifier and Type | Class and Description |
---|---|
protected static class |
ServerCnxn.CloseRequestException |
static class |
ServerCnxn.DisconnectReason |
protected static class |
ServerCnxn.EndOfStreamException |
Watcher.Event, Watcher.WatcherType
Modifier and Type | Field and Description |
---|---|
protected long |
count |
protected ServerCnxn.DisconnectReason |
disconnectReason |
protected Date |
established |
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 AtomicLong |
packetsReceived |
protected AtomicLong |
packetsSent |
protected long |
requestsProcessedCount |
protected long |
totalLatency |
protected ZooKeeperSaslServer |
zooKeeperSaslServer |
Constructor and Description |
---|
ServerCnxn(ZooKeeperServer zkServer) |
Modifier and Type | Method and Description |
---|---|
void |
addAuthInfo(Id id) |
void |
cleanupWriterSocket(PrintWriter pwriter)
clean up the socket related to a command and also make sure we flush the
data before we do that
|
abstract void |
close(ServerCnxn.DisconnectReason reason) |
void |
decrOutstandingAndCheckThrottle(ReplyHeader h) |
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
|
abstract Certificate[] |
getClientCertificateChain() |
Map<String,Object> |
getConnectionInfo(boolean brief) |
Date |
getEstablished()
Date/time the connection was established
|
String |
getHostAddress()
Returns the IP address or empty string.
|
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
|
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() |
abstract long |
getSessionId() |
String |
getSessionIdHex()
Get session id in hexadecimal notation.
|
void |
incrOutstandingAndCheckThrottle(RequestHeader h) |
protected long |
incrPacketsReceived() |
protected long |
incrPacketsSent() |
boolean |
isInvalid() |
abstract boolean |
isSecure() |
boolean |
isStale() |
protected void |
packetReceived(long bytes) |
protected void |
packetSent() |
abstract void |
process(WatchedEvent event) |
boolean |
removeAuthInfo(Id id) |
void |
resetStats()
Reset counters
|
abstract void |
sendCloseSession() |
void |
sendResponse(ReplyHeader h,
Record r,
String tag) |
abstract void |
sendResponse(ReplyHeader h,
Record r,
String tag,
String cacheKey,
Stat stat,
int opCode)
Serializes a ZooKeeper response and enqueues it for sending.
|
protected ByteBuffer[] |
serialize(ReplyHeader h,
Record r,
String tag,
String cacheKey,
Stat stat,
int opCode) |
protected byte[] |
serializeRecord(Record record) |
protected abstract ServerStats |
serverStats() |
abstract void |
setClientCertificateChain(Certificate[] chain) |
void |
setInvalid() |
void |
setStale() |
String |
toString()
Prints detailed stats information for the connection.
|
protected void |
updateStatsForResponse(long cxid,
long zxid,
String op,
long start,
long end) |
public static final Object me
protected ZooKeeperSaslServer zooKeeperSaslServer
protected final Date established
protected final AtomicLong packetsReceived
protected final AtomicLong packetsSent
protected long minLatency
protected long maxLatency
protected String lastOp
protected long lastCxid
protected long lastZxid
protected long lastResponseTime
protected long lastLatency
protected long count
protected long totalLatency
protected long requestsProcessedCount
protected ServerCnxn.DisconnectReason disconnectReason
public ServerCnxn(ZooKeeperServer zkServer)
public void incrOutstandingAndCheckThrottle(RequestHeader h)
public void decrOutstandingAndCheckThrottle(ReplyHeader h)
public abstract void close(ServerCnxn.DisconnectReason reason)
public abstract void sendResponse(ReplyHeader h, Record r, String tag, String cacheKey, Stat stat, int opCode) throws IOException
h
- reply headerr
- reply payload, can be nulltag
- Jute serialization tag, can be nullcacheKey
- 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.IOException
public void sendResponse(ReplyHeader h, Record r, String tag) throws IOException
IOException
protected byte[] serializeRecord(Record record) throws IOException
IOException
protected ByteBuffer[] serialize(ReplyHeader h, Record r, String tag, String cacheKey, Stat stat, int opCode) throws IOException
IOException
public abstract void sendCloseSession()
public abstract void process(WatchedEvent event)
public abstract long getSessionId()
public void addAuthInfo(Id id)
public boolean removeAuthInfo(Id id)
public boolean isStale()
public void setStale()
public boolean isInvalid()
public void setInvalid()
protected void packetReceived(long bytes)
protected void packetSent()
protected abstract ServerStats serverStats()
public void resetStats()
protected long incrPacketsReceived()
protected long incrPacketsSent()
protected void updateStatsForResponse(long cxid, long zxid, String op, long start, long end)
public Date getEstablished()
public long getOutstandingRequests()
public long getPacketsReceived()
public long getPacketsSent()
public long getMinLatency()
public long getAvgLatency()
public long getMaxLatency()
public String getLastOperation()
public long getLastCxid()
public long getLastZxid()
public long getLastResponseTime()
public long getLastLatency()
public String toString()
toString
in class Object
for brief stats
public abstract InetSocketAddress getRemoteSocketAddress()
public abstract int getInterestOps()
public abstract boolean isSecure()
public abstract Certificate[] getClientCertificateChain()
public abstract void setClientCertificateChain(Certificate[] chain)
public void dumpConnectionInfo(PrintWriter pwriter, boolean brief)
brief
- iff true prints brief details, otw full detailpublic void cleanupWriterSocket(PrintWriter pwriter)
pwriter
- the pwriter for a command socketpublic String getHostAddress()
public String getSessionIdHex()
Copyright © 2008–2020 The Apache Software Foundation. All rights reserved.