org.apache.zookeeper.server
Class NIOServerCnxn

java.lang.Object
  extended by org.apache.zookeeper.server.NIOServerCnxn
All Implemented Interfaces:
ServerCnxn, Watcher

public class NIOServerCnxn
extends java.lang.Object
implements Watcher, ServerCnxn

This class handles communication with clients using NIO. There is one per client, but only one thread doing the communication.


Nested Class Summary
static class NIOServerCnxn.Factory
           
 
Nested classes/interfaces inherited from interface org.apache.zookeeper.server.ServerCnxn
ServerCnxn.Stats
 
Nested classes/interfaces inherited from interface org.apache.zookeeper.Watcher
Watcher.Event
 
Field Summary
 
Fields inherited from interface org.apache.zookeeper.server.ServerCnxn
me
 
Constructor Summary
NIOServerCnxn(ZooKeeperServer zk, java.nio.channels.SocketChannel sock, java.nio.channels.SelectionKey sk, NIOServerCnxn.Factory factory)
           
 
Method Summary
 void close()
           
 void disableRecv()
           
 void enableRecv()
           
 void finishSessionInit(boolean valid)
           
 java.util.ArrayList<Id> getAuthInfo()
           
 java.net.InetSocketAddress getRemoteAddress()
           
 long getSessionId()
           
 int getSessionTimeout()
           
 ServerCnxn.Stats getStats()
           
 void process(WatchedEvent event)
           
 void sendCloseSession()
           
 void sendResponse(ReplyHeader h, org.apache.jute.Record r, java.lang.String tag)
           
 void setSessionId(long sessionId)
           
 java.lang.String toString()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

NIOServerCnxn

public NIOServerCnxn(ZooKeeperServer zk,
                     java.nio.channels.SocketChannel sock,
                     java.nio.channels.SelectionKey sk,
                     NIOServerCnxn.Factory factory)
              throws java.io.IOException
Throws:
java.io.IOException
Method Detail

sendCloseSession

public void sendCloseSession()
Specified by:
sendCloseSession in interface ServerCnxn

disableRecv

public void disableRecv()

enableRecv

public void enableRecv()

getSessionTimeout

public int getSessionTimeout()
Specified by:
getSessionTimeout in interface ServerCnxn

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object

close

public void close()

sendResponse

public void sendResponse(ReplyHeader h,
                         org.apache.jute.Record r,
                         java.lang.String tag)
Specified by:
sendResponse in interface ServerCnxn

process

public void process(WatchedEvent event)
Specified by:
process in interface ServerCnxn
Specified by:
process in interface Watcher

finishSessionInit

public void finishSessionInit(boolean valid)
Specified by:
finishSessionInit in interface ServerCnxn

getSessionId

public long getSessionId()
Specified by:
getSessionId in interface ServerCnxn

setSessionId

public void setSessionId(long sessionId)
Specified by:
setSessionId in interface ServerCnxn

getAuthInfo

public java.util.ArrayList<Id> getAuthInfo()
Specified by:
getAuthInfo in interface ServerCnxn

getRemoteAddress

public java.net.InetSocketAddress getRemoteAddress()
Specified by:
getRemoteAddress in interface ServerCnxn

getStats

public ServerCnxn.Stats getStats()
Specified by:
getStats in interface ServerCnxn


Copyright © 2011 The Apache Software Foundation