Package org.apache.zookeeper.server
Class ServerCnxnFactory
- java.lang.Object
-
- org.apache.zookeeper.server.ServerCnxnFactory
-
- Direct Known Subclasses:
NettyServerCnxnFactory,NIOServerCnxnFactory
public abstract class ServerCnxnFactory extends java.lang.Object
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static interfaceServerCnxnFactory.PacketProcessor
-
Field Summary
Fields Modifier and Type Field Description protected java.util.HashSet<ServerCnxn>cnxnsLoginloginprotected SaslServerCallbackHandlersaslServerCallbackHandlerprotected java.util.concurrent.ConcurrentMap<java.lang.Long,ServerCnxn>sessionMapprotected ZooKeeperServerzkServerstatic java.lang.StringZOOKEEPER_SERVER_CNXN_FACTORY
-
Constructor Summary
Constructors Constructor Description ServerCnxnFactory()
-
Method Summary
All Methods Static Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description voidaddSession(long sessionId, ServerCnxn cnxn)abstract voidcloseAll()abstract voidcloseSession(long sessionId)abstract voidconfigure(java.net.InetSocketAddress addr, int maxClientCnxns)protected voidconfigureSaslLogin()Initialize the server SASL if specified.static ServerCnxnFactorycreateFactory()static ServerCnxnFactorycreateFactory(int clientPort, int maxClientCnxns)static ServerCnxnFactorycreateFactory(java.net.InetSocketAddress addr, int maxClientCnxns)abstract java.lang.Iterable<ServerCnxn>getConnections()abstract java.net.InetSocketAddressgetLocalAddress()abstract intgetLocalPort()abstract intgetMaxClientCnxnsPerHost()Maximum number of connections allowed from particular host (ip)intgetNumAliveConnections()abstract voidjoin()voidregisterConnection(ServerCnxn serverCnxn)abstract voidsetMaxClientCnxnsPerHost(int max)Maximum number of connections allowed from particular host (ip)voidsetZooKeeperServer(ZooKeeperServer zk)abstract voidshutdown()abstract voidstart()abstract voidstartup(ZooKeeperServer zkServer)voidunregisterConnection(ServerCnxn serverCnxn)
-
-
-
Field Detail
-
ZOOKEEPER_SERVER_CNXN_FACTORY
public static final java.lang.String ZOOKEEPER_SERVER_CNXN_FACTORY
- See Also:
- Constant Field Values
-
sessionMap
protected final java.util.concurrent.ConcurrentMap<java.lang.Long,ServerCnxn> sessionMap
-
saslServerCallbackHandler
protected SaslServerCallbackHandler saslServerCallbackHandler
-
login
public Login login
-
zkServer
protected ZooKeeperServer zkServer
-
cnxns
protected final java.util.HashSet<ServerCnxn> cnxns
-
-
Method Detail
-
getLocalPort
public abstract int getLocalPort()
-
getConnections
public abstract java.lang.Iterable<ServerCnxn> getConnections()
-
getNumAliveConnections
public int getNumAliveConnections()
-
closeSession
public abstract void closeSession(long sessionId)
-
configure
public abstract void configure(java.net.InetSocketAddress addr, int maxClientCnxns) throws java.io.IOException- Throws:
java.io.IOException
-
getMaxClientCnxnsPerHost
public abstract int getMaxClientCnxnsPerHost()
Maximum number of connections allowed from particular host (ip)
-
setMaxClientCnxnsPerHost
public abstract void setMaxClientCnxnsPerHost(int max)
Maximum number of connections allowed from particular host (ip)
-
startup
public abstract void startup(ZooKeeperServer zkServer) throws java.io.IOException, java.lang.InterruptedException
- Throws:
java.io.IOExceptionjava.lang.InterruptedException
-
join
public abstract void join() throws java.lang.InterruptedException- Throws:
java.lang.InterruptedException
-
shutdown
public abstract void shutdown()
-
start
public abstract void start()
-
setZooKeeperServer
public final void setZooKeeperServer(ZooKeeperServer zk)
-
closeAll
public abstract void closeAll()
-
createFactory
public static ServerCnxnFactory createFactory() throws java.io.IOException
- Throws:
java.io.IOException
-
createFactory
public static ServerCnxnFactory createFactory(int clientPort, int maxClientCnxns) throws java.io.IOException
- Throws:
java.io.IOException
-
createFactory
public static ServerCnxnFactory createFactory(java.net.InetSocketAddress addr, int maxClientCnxns) throws java.io.IOException
- Throws:
java.io.IOException
-
getLocalAddress
public abstract java.net.InetSocketAddress getLocalAddress()
-
unregisterConnection
public void unregisterConnection(ServerCnxn serverCnxn)
-
registerConnection
public void registerConnection(ServerCnxn serverCnxn)
-
addSession
public void addSession(long sessionId, ServerCnxn cnxn)
-
configureSaslLogin
protected void configureSaslLogin() throws java.io.IOExceptionInitialize the server SASL if specified. If the user has specified a "ZooKeeperServer.LOGIN_CONTEXT_NAME_KEY" or a jaas.conf using "java.security.auth.login.config" the authentication is required and an exception is raised. Otherwise no authentication is configured and no exception is raised.- Throws:
java.io.IOException- if jaas.conf is missing or there's an error in it.
-
-