org.apache.zookeeper.server
Class ConnectionBean

java.lang.Object
  extended by 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
ConnectionBean(ServerCnxn connection, ZooKeeperServer zk)
           
 
Method Summary
 String[] getEphemeralNodes()
           
 String 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 terminateConnection()
          Terminate thei client connection.
 void terminateSession()
          Terminate this client session.
 String toString()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

ConnectionBean

public ConnectionBean(ServerCnxn connection,
                      ZooKeeperServer zk)
Method Detail

getSessionId

public String getSessionId()
Specified by:
getSessionId in interface ConnectionMXBean
Returns:
client's session id

getSourceIP

public String getSourceIP()
Specified by:
getSourceIP in interface ConnectionMXBean
Returns:
source (client) IP address

getName

public String getName()
Specified by:
getName in interface ZKMBeanInfo
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 interface ZKMBeanInfo
Returns:
true if the MBean is hidden.

getEphemeralNodes

public String[] getEphemeralNodes()
Specified by:
getEphemeralNodes in interface ConnectionMXBean
Returns:
number of ephemeral nodes owned by this connection

getStartedTime

public String getStartedTime()
Specified by:
getStartedTime in interface ConnectionMXBean
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 interface ConnectionMXBean

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 interface ConnectionMXBean

toString

public String toString()
Overrides:
toString in class Object

getOutstandingRequests

public long getOutstandingRequests()
Specified by:
getOutstandingRequests in interface ConnectionMXBean
Returns:
number of requets being processed

getPacketsReceived

public long getPacketsReceived()
Specified by:
getPacketsReceived in interface ConnectionMXBean
Returns:
packets received from this client

getPacketsSent

public long getPacketsSent()
Specified by:
getPacketsSent in interface ConnectionMXBean
Returns:
number of packets sent to this client

getSessionTimeout

public int getSessionTimeout()
Specified by:
getSessionTimeout in interface ConnectionMXBean
Returns:
session timeout in ms