Package org.apache.zookeeper.server
Class ConnectionBean
- java.lang.Object
-
- org.apache.zookeeper.server.ConnectionBean
-
- All Implemented Interfaces:
ZKMBeanInfo
,ConnectionMXBean
public class ConnectionBean extends Object implements ConnectionMXBean, ZKMBeanInfo
Implementation of connection MBean interface.
-
-
Constructor Summary
Constructors Constructor Description ConnectionBean(ServerCnxn connection, ZooKeeperServer zk)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description long
getAvgLatency()
Average latency in msString[]
getEphemeralNodes()
String
getLastCxid()
Last cxid of this connectionlong
getLastLatency()
Latency of last response to client on this connection in msString
getLastOperation()
Last operation performed by this connectionString
getLastResponseTime()
Last time server sent a response to client on this connectionString
getLastZxid()
Last zxid of this connectionlong
getMaxLatency()
Max latency in mslong
getMinLatency()
Min latency in msString
getName()
long
getOutstandingRequests()
long
getPacketsReceived()
long
getPacketsSent()
String
getSessionId()
int
getSessionTimeout()
String
getSourceIP()
String
getStartedTime()
boolean
isHidden()
If isHidden returns true, the MBean won't be registered with MBean server, and thus won't be available for management tools.void
resetCounters()
Reset countersvoid
terminateConnection()
Terminate thei client connection.void
terminateSession()
Terminate this client session.String
toString()
-
-
-
Constructor Detail
-
ConnectionBean
public ConnectionBean(ServerCnxn connection, ZooKeeperServer zk)
-
-
Method Detail
-
getSessionId
public String getSessionId()
- Specified by:
getSessionId
in interfaceConnectionMXBean
- Returns:
- client's session id
-
getSourceIP
public String getSourceIP()
- Specified by:
getSourceIP
in interfaceConnectionMXBean
- Returns:
- source (client) IP address
-
getName
public String getName()
- Specified by:
getName
in interfaceZKMBeanInfo
- Returns:
- a string identifying the MBean
-
isHidden
public boolean isHidden()
Description copied from interface:ZKMBeanInfo
If isHidden returns true, the MBean won't be registered with MBean server, and thus won't be available for management tools. Used for grouping MBeans.- Specified by:
isHidden
in interfaceZKMBeanInfo
- Returns:
- true if the MBean is hidden.
-
getEphemeralNodes
public String[] getEphemeralNodes()
- Specified by:
getEphemeralNodes
in interfaceConnectionMXBean
- Returns:
- number of ephemeral nodes owned by this connection
-
getStartedTime
public String getStartedTime()
- Specified by:
getStartedTime
in interfaceConnectionMXBean
- Returns:
- time the connection was started
-
terminateSession
public void terminateSession()
Description copied from interface:ConnectionMXBean
Terminate this client session. The client will reconnect with a different session id.- Specified by:
terminateSession
in interfaceConnectionMXBean
-
terminateConnection
public void terminateConnection()
Description copied from interface:ConnectionMXBean
Terminate thei client connection. The client will immediately attempt to reconnect with the same session id.- Specified by:
terminateConnection
in interfaceConnectionMXBean
-
resetCounters
public void resetCounters()
Description copied from interface:ConnectionMXBean
Reset counters- Specified by:
resetCounters
in interfaceConnectionMXBean
-
getOutstandingRequests
public long getOutstandingRequests()
- Specified by:
getOutstandingRequests
in interfaceConnectionMXBean
- Returns:
- number of requets being processed
-
getPacketsReceived
public long getPacketsReceived()
- Specified by:
getPacketsReceived
in interfaceConnectionMXBean
- Returns:
- packets received from this client
-
getPacketsSent
public long getPacketsSent()
- Specified by:
getPacketsSent
in interfaceConnectionMXBean
- Returns:
- number of packets sent to this client
-
getSessionTimeout
public int getSessionTimeout()
- Specified by:
getSessionTimeout
in interfaceConnectionMXBean
- Returns:
- session timeout in ms
-
getMinLatency
public long getMinLatency()
Description copied from interface:ConnectionMXBean
Min latency in ms- Specified by:
getMinLatency
in interfaceConnectionMXBean
-
getAvgLatency
public long getAvgLatency()
Description copied from interface:ConnectionMXBean
Average latency in ms- Specified by:
getAvgLatency
in interfaceConnectionMXBean
-
getMaxLatency
public long getMaxLatency()
Description copied from interface:ConnectionMXBean
Max latency in ms- Specified by:
getMaxLatency
in interfaceConnectionMXBean
-
getLastOperation
public String getLastOperation()
Description copied from interface:ConnectionMXBean
Last operation performed by this connection- Specified by:
getLastOperation
in interfaceConnectionMXBean
-
getLastCxid
public String getLastCxid()
Description copied from interface:ConnectionMXBean
Last cxid of this connection- Specified by:
getLastCxid
in interfaceConnectionMXBean
-
getLastZxid
public String getLastZxid()
Description copied from interface:ConnectionMXBean
Last zxid of this connection- Specified by:
getLastZxid
in interfaceConnectionMXBean
-
getLastResponseTime
public String getLastResponseTime()
Description copied from interface:ConnectionMXBean
Last time server sent a response to client on this connection- Specified by:
getLastResponseTime
in interfaceConnectionMXBean
-
getLastLatency
public long getLastLatency()
Description copied from interface:ConnectionMXBean
Latency of last response to client on this connection in ms- Specified by:
getLastLatency
in interfaceConnectionMXBean
-
-