# Class DumbWatcher

java.lang.Object
org.apache.zookeeper.server.ServerCnxn
org.apache.zookeeper.server.DumbWatcher

All Implemented Interfaces:
  `ServerWatcher, Watcher`

public class DumbWatcher extends ServerCnxn
A empty watcher implementation used in bench and unit test.

## Nested Class Summary

### Nested classes/interfaces inherited from class ServerCnxn

`ServerCnxn.CloseRequestException, ServerCnxn.DisconnectReason, ServerCnxn.EndOfStreamException`

### Nested classes/interfaces inherited from interface Watcher

`Watcher.Event, Watcher.WatcherType`

## Field Summary

### Fields inherited from class ServerCnxn

`count, disconnectReason, established, lastCxid, lastLatency, lastOp, lastResponseTime, lastZxid, maxLatency, me, minLatency, packetsReceived, packetsSent, protocolManager, totalLatency, zooKeeperSaslServer`

## Constructor Summary

Constructors
Constructor
Description
`DumbWatcher()`
`DumbWatcher(long sessionId)`

## Method Summary

Modifier and Type
Method
Description
`void`
`close(ServerCnxn.DisconnectReason reason)`
`Certificate[]`
`getClientCertificateChain()`
`int`
`getInterestOps()`
`Watcher.Event.EventType`
`getMostRecentEventType()`
`String`
`getMostRecentPath()`
`long`
`getMostRecentZxid()`
`long`
`getOutstandingRequests()`
`InetSocketAddress`
`getRemoteSocketAddress()`
`long`
`getSessionId()`
`boolean`
`isSecure()`
`void`
`process(WatchedEvent event, List<ACL> znodeAcl)`
`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)`

### Methods inherited from class ServerCnxn

`addAuthInfo, cleanupWriterSocket, decrOutstandingAndCheckThrottle, dumpConnectionInfo, getAuthInfo, getAvgLatency, getConnectionInfo, getEstablished, getHostAddress, getLastCxid, getLastLatency, getLastOperation, getLastResponseTime, getLastZxid, getMaxLatency, getMinLatency, getPacketsReceived, getPacketsSent, getSessionIdHex, incrOutstandingAndCheckThrottle, incrPacketsReceived, incrPacketsSent, isInvalid, isStale, isZKServerRunning, packetReceived, packetSent, process, removeAuthInfo, resetStats, sendResponse, serialize, serializeRecord, setInvalid, setStale, toString, updateStatsForResponse`

### Methods inherited from class Object

`clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait`

## Constructor Details

### DumbWatcher

public DumbWatcher()

### DumbWatcher

public DumbWatcher(long sessionId)

## Method Details

### process

public void process(WatchedEvent event, List<ACL> znodeAcl)

Specified by:
  `process` in interface `ServerWatcher`
Specified by:
  `process` in class `ServerCnxn`

### getMostRecentPath

public String getMostRecentPath()

### getMostRecentEventType

public Watcher.Event.EventType getMostRecentEventType()

### getMostRecentZxid

public long getMostRecentZxid()

### close

public void close(ServerCnxn.DisconnectReason reason)

Specified by:
  `close` in class `ServerCnxn`

### 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 class `ServerCnxn`
Parameters:
  `h` - reply header
  `r` - reply payload, can be null
  `tag` - Jute serialization tag, can be null
  `cacheKey` - 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`

### sendCloseSession

public void sendCloseSession()

Specified by:
  `sendCloseSession` in class `ServerCnxn`

### getSessionId

public long getSessionId()

Specified by:
  `getSessionId` in class `ServerCnxn`

### serverStats

protected ServerStats serverStats()

Specified by:
  `serverStats` in class `ServerCnxn`

### getOutstandingRequests

public long getOutstandingRequests()

Overrides:
  `getOutstandingRequests` in class `ServerCnxn`

### getRemoteSocketAddress

public InetSocketAddress getRemoteSocketAddress()

Specified by:
  `getRemoteSocketAddress` in class `ServerCnxn`

### getInterestOps

public int getInterestOps()

Specified by:
  `getInterestOps` in class `ServerCnxn`

### isSecure

public boolean isSecure()

Specified by:
  `isSecure` in class `ServerCnxn`

### getClientCertificateChain

public Certificate[] getClientCertificateChain()

Specified by:
  `getClientCertificateChain` in class `ServerCnxn`

### setClientCertificateChain

public void setClientCertificateChain(Certificate[] chain)

Specified by:
  `setClientCertificateChain` in class `ServerCnxn`