public class ClientCnxn extends Object
Modifier and Type | Field and Description |
---|---|
static int |
AUTHPACKET_XID |
static int |
NOTIFICATION_XID |
static int |
PING_XID |
static int |
SET_WATCHES_XID |
protected int |
xid |
Constructor and Description |
---|
ClientCnxn(String chrootPath,
HostProvider hostProvider,
int sessionTimeout,
ZKClientConfig clientConfig,
Watcher defaultWatcher,
org.apache.zookeeper.ClientCnxnSocket clientCnxnSocket,
boolean canBeReadOnly)
Creates a connection object.
|
ClientCnxn(String chrootPath,
HostProvider hostProvider,
int sessionTimeout,
ZKClientConfig clientConfig,
Watcher defaultWatcher,
org.apache.zookeeper.ClientCnxnSocket clientCnxnSocket,
long sessionId,
byte[] sessionPasswd,
boolean canBeReadOnly)
Creates a connection object.
|
Modifier and Type | Method and Description |
---|---|
void |
addAuthInfo(String scheme,
byte[] auth) |
void |
close()
Close the connection, which includes; send session disconnect to the
server, shutdown the send/event threads.
|
void |
disconnect()
Shutdown the send/event threads.
|
protected void |
finishPacket(org.apache.zookeeper.ClientCnxn.Packet p) |
long |
getLastZxid() |
long |
getSessionId() |
byte[] |
getSessionPasswd() |
int |
getSessionTimeout() |
int |
getXid() |
ZooKeeperSaslClient |
getZooKeeperSaslClient() |
static boolean |
isInEventThread()
Tests that current thread is the main event loop.
|
protected void |
onConnecting(InetSocketAddress addr) |
org.apache.zookeeper.ClientCnxn.Packet |
queuePacket(RequestHeader h,
ReplyHeader r,
Record request,
Record response,
AsyncCallback cb,
String clientPath,
String serverPath,
Object ctx,
ZooKeeper.WatchRegistration watchRegistration) |
org.apache.zookeeper.ClientCnxn.Packet |
queuePacket(RequestHeader h,
ReplyHeader r,
Record request,
Record response,
AsyncCallback cb,
String clientPath,
String serverPath,
Object ctx,
ZooKeeper.WatchRegistration watchRegistration,
WatchDeregistration watchDeregistration) |
void |
saslCompleted() |
void |
sendPacket(Record request,
Record response,
AsyncCallback cb,
int opCode) |
void |
start() |
ReplyHeader |
submitRequest(RequestHeader h,
Record request,
Record response,
ZooKeeper.WatchRegistration watchRegistration) |
ReplyHeader |
submitRequest(RequestHeader h,
Record request,
Record response,
ZooKeeper.WatchRegistration watchRegistration,
WatchDeregistration watchDeregistration) |
String |
toString() |
public static final int NOTIFICATION_XID
public static final int PING_XID
public static final int AUTHPACKET_XID
public static final int SET_WATCHES_XID
protected int xid
public ClientCnxn(String chrootPath, HostProvider hostProvider, int sessionTimeout, ZKClientConfig clientConfig, Watcher defaultWatcher, org.apache.zookeeper.ClientCnxnSocket clientCnxnSocket, boolean canBeReadOnly) throws IOException
chrootPath
- the chroot of this client. Should be removed from this Class in ZOOKEEPER-838hostProvider
- the list of ZooKeeper servers to connect tosessionTimeout
- the timeout for connections.clientConfig
- the client configuration.defaultWatcher
- default watcher for this connectionclientCnxnSocket
- the socket implementation used (e.g. NIO/Netty)canBeReadOnly
- whether the connection is allowed to go to read-only mode in case of partitioningIOException
public ClientCnxn(String chrootPath, HostProvider hostProvider, int sessionTimeout, ZKClientConfig clientConfig, Watcher defaultWatcher, org.apache.zookeeper.ClientCnxnSocket clientCnxnSocket, long sessionId, byte[] sessionPasswd, boolean canBeReadOnly) throws IOException
chrootPath
- the chroot of this client. Should be removed from this Class in ZOOKEEPER-838hostProvider
- the list of ZooKeeper servers to connect tosessionTimeout
- the timeout for connections.clientConfig
- the client configuration.defaultWatcher
- default watcher for this connectionclientCnxnSocket
- the socket implementation used (e.g. NIO/Netty)sessionId
- session id if re-establishing sessionsessionPasswd
- session passwd if re-establishing sessioncanBeReadOnly
- whether the connection is allowed to go to read-only mode in case of partitioningIOException
- in cases of broken networkpublic long getSessionId()
public byte[] getSessionPasswd()
public int getSessionTimeout()
public void start()
public static boolean isInEventThread()
protected void finishPacket(org.apache.zookeeper.ClientCnxn.Packet p)
protected void onConnecting(InetSocketAddress addr)
public long getLastZxid()
public void disconnect()
public void close() throws IOException
IOException
public int getXid()
public ReplyHeader submitRequest(RequestHeader h, Record request, Record response, ZooKeeper.WatchRegistration watchRegistration) throws InterruptedException
InterruptedException
public ReplyHeader submitRequest(RequestHeader h, Record request, Record response, ZooKeeper.WatchRegistration watchRegistration, WatchDeregistration watchDeregistration) throws InterruptedException
InterruptedException
public void saslCompleted()
public void sendPacket(Record request, Record response, AsyncCallback cb, int opCode) throws IOException
IOException
public org.apache.zookeeper.ClientCnxn.Packet queuePacket(RequestHeader h, ReplyHeader r, Record request, Record response, AsyncCallback cb, String clientPath, String serverPath, Object ctx, ZooKeeper.WatchRegistration watchRegistration)
public org.apache.zookeeper.ClientCnxn.Packet queuePacket(RequestHeader h, ReplyHeader r, Record request, Record response, AsyncCallback cb, String clientPath, String serverPath, Object ctx, ZooKeeper.WatchRegistration watchRegistration, WatchDeregistration watchDeregistration)
public void addAuthInfo(String scheme, byte[] auth)
public ZooKeeperSaslClient getZooKeeperSaslClient()
Copyright © 2008–2023 The Apache Software Foundation. All rights reserved.