public class NIOServerCnxn extends ServerCnxn
ServerCnxn.CloseRequestException, ServerCnxn.DisconnectReason, ServerCnxn.EndOfStreamException
Watcher.Event, Watcher.WatcherType
Modifier and Type | Field and Description |
---|---|
protected ByteBuffer |
incomingBuffer |
count, disconnectReason, established, lastCxid, lastLatency, lastOp, lastResponseTime, lastZxid, maxLatency, me, minLatency, packetsReceived, packetsSent, totalLatency, zooKeeperSaslServer
Constructor and Description |
---|
NIOServerCnxn(ZooKeeperServer zk,
SocketChannel sock,
SelectionKey sk,
NIOServerCnxnFactory factory,
NIOServerCnxnFactory.SelectorThread selectorThread) |
Modifier and Type | Method and Description |
---|---|
void |
close(ServerCnxn.DisconnectReason reason)
Close the cnxn and remove it from the factory cnxns list.
|
static void |
closeSock(SocketChannel sock)
Close resources associated with a sock.
|
void |
disableRecv(boolean waitDisableRecv) |
void |
disableSelectable() |
void |
enableRecv() |
void |
enableSelectable() |
Certificate[] |
getClientCertificateChain() |
int |
getInterestOps() |
InetSocketAddress |
getRemoteSocketAddress() |
long |
getSessionId() |
int |
getSessionTimeout() |
InetAddress |
getSocketAddress() |
boolean |
isSecure() |
boolean |
isSelectable() |
protected boolean |
isSocketOpen()
Only used in order to allow testing
|
void |
process(WatchedEvent event) |
protected void |
readRequest() |
void |
sendBuffer(ByteBuffer... buffers)
sendBuffer pushes a byte buffer onto the outgoing buffer queue for
asynchronous writes.
|
void |
sendCloseSession() |
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 |
serverStats() |
void |
setClientCertificateChain(Certificate[] chain) |
void |
setSessionId(long sessionId) |
void |
setSessionTimeout(int sessionTimeout) |
String |
toString()
Used by "dump" 4-letter command to list all connection in
cnxnExpiryMap
|
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, updateStatsForResponse
protected ByteBuffer incomingBuffer
public NIOServerCnxn(ZooKeeperServer zk, SocketChannel sock, SelectionKey sk, NIOServerCnxnFactory factory, NIOServerCnxnFactory.SelectorThread selectorThread) throws IOException
IOException
public void sendCloseSession()
sendCloseSession
in class ServerCnxn
public void sendBuffer(ByteBuffer... buffers)
public boolean isSelectable()
public void disableSelectable()
public void enableSelectable()
protected boolean isSocketOpen()
protected void readRequest() throws IOException
IOException
public void disableRecv(boolean waitDisableRecv)
public void enableRecv()
public int getSessionTimeout()
public String toString()
toString
in class ServerCnxn
for brief stats
public void close(ServerCnxn.DisconnectReason reason)
close
in class ServerCnxn
public static void closeSock(SocketChannel sock)
public int sendResponse(ReplyHeader h, Record r, String tag, String cacheKey, Stat stat, int opCode)
ServerCnxn
sendResponse
in class ServerCnxn
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.public void process(WatchedEvent event)
process
in interface Watcher
process
in class ServerCnxn
public long getSessionId()
getSessionId
in class ServerCnxn
public void setSessionId(long sessionId)
public void setSessionTimeout(int sessionTimeout)
public int getInterestOps()
getInterestOps
in class ServerCnxn
public InetSocketAddress getRemoteSocketAddress()
getRemoteSocketAddress
in class ServerCnxn
public InetAddress getSocketAddress()
protected ServerStats serverStats()
serverStats
in class ServerCnxn
public boolean isSecure()
isSecure
in class ServerCnxn
public Certificate[] getClientCertificateChain()
getClientCertificateChain
in class ServerCnxn
public void setClientCertificateChain(Certificate[] chain)
setClientCertificateChain
in class ServerCnxn
Copyright © 2008–2022 The Apache Software Foundation. All rights reserved.