Package org.apache.zookeeper.server
Class NettyServerCnxn
java.lang.Object
org.apache.zookeeper.server.ServerCnxn
org.apache.zookeeper.server.NettyServerCnxn
- All Implemented Interfaces:
Watcher
-
Nested Class Summary
Nested ClassesNested classes/interfaces inherited from class org.apache.zookeeper.server.ServerCnxn
ServerCnxn.CloseRequestException, ServerCnxn.DisconnectReason, ServerCnxn.EndOfStreamException
Nested classes/interfaces inherited from interface org.apache.zookeeper.Watcher
Watcher.Event, Watcher.WatcherType
-
Field Summary
FieldsFields inherited from class org.apache.zookeeper.server.ServerCnxn
count, disconnectReason, established, lastCxid, lastLatency, lastOp, lastResponseTime, lastZxid, maxLatency, me, minLatency, packetsReceived, packetsSent, totalLatency, zooKeeperSaslServer
-
Method Summary
Modifier and TypeMethodDescriptionvoid
close()
void
close
(ServerCnxn.DisconnectReason reason) Close the cnxn and remove it from the factory cnxns list.void
disableRecv
(boolean waitDisableRecv) Note that the netty implementation ignores thewaitDisableRecv
parameter and is always asynchronous.void
int
int
long
int
boolean
isSecure()
void
process
(WatchedEvent event) void
sendBuffer
(ByteBuffer... buffers) void
Send close connection packet to the client.int
sendResponse
(ReplyHeader h, Record r, String tag, String cacheKey, Stat stat, int opCode) Serializes a ZooKeeper response and enqueues it for sending.protected ServerStats
void
setClientCertificateChain
(Certificate[] chain) void
void
setSessionId
(long sessionId) void
setSessionTimeout
(int sessionTimeout) Methods inherited from class org.apache.zookeeper.server.ServerCnxn
addAuthInfo, cleanupWriterSocket, decrOutstandingAndCheckThrottle, dumpConnectionInfo, getAuthInfo, getAvgLatency, getConnectionInfo, getEstablished, getHostAddress, getLastCxid, getLastLatency, getLastOperation, getLastResponseTime, getLastZxid, getMaxLatency, getMinLatency, getOutstandingRequests, getPacketsReceived, getPacketsSent, getSessionIdHex, incrOutstandingAndCheckThrottle, incrPacketsReceived, incrPacketsSent, isInvalid, isStale, isZKServerRunning, packetReceived, packetSent, removeAuthInfo, resetStats, sendResponse, serialize, serializeRecord, setInvalid, setStale, toString, updateStatsForResponse
-
Field Details
-
readIssuedAfterReadComplete
public int readIssuedAfterReadComplete
-
-
Method Details
-
close
Close the cnxn and remove it from the factory cnxns list.- Specified by:
close
in classServerCnxn
-
close
public void close() -
getSessionId
public long getSessionId()- Specified by:
getSessionId
in classServerCnxn
-
getSessionTimeout
public int getSessionTimeout() -
process
- Specified by:
process
in interfaceWatcher
- Specified by:
process
in classServerCnxn
-
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 classServerCnxn
- Parameters:
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.- Throws:
IOException
-
setSessionId
public void setSessionId(long sessionId) -
sendBuffer
-
disableRecv
public void disableRecv(boolean waitDisableRecv) Note that the netty implementation ignores thewaitDisableRecv
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 classServerCnxn
-
getRemoteSocketAddress
- Specified by:
getRemoteSocketAddress
in classServerCnxn
-
sendCloseSession
public void sendCloseSession()Send close connection packet to the client.- Specified by:
sendCloseSession
in classServerCnxn
-
serverStats
- Specified by:
serverStats
in classServerCnxn
-
isSecure
public boolean isSecure()- Specified by:
isSecure
in classServerCnxn
-
getClientCertificateChain
- Specified by:
getClientCertificateChain
in classServerCnxn
-
setClientCertificateChain
- Specified by:
setClientCertificateChain
in classServerCnxn
-
getQueuedReadableBytes
public int getQueuedReadableBytes() -
setHandshakeState
-
getHandshakeState
-