@InterfaceAudience.Private public class RecoverableZooKeeper extends Object
Constructor and Description |
---|
RecoverableZooKeeper(String quorumServers,
int sessionTimeout,
Watcher watcher,
int maxRetries,
int retryIntervalMillis) |
RecoverableZooKeeper(String quorumServers,
int sessionTimeout,
Watcher watcher,
int maxRetries,
int retryIntervalMillis,
String identifier) |
Modifier and Type | Method and Description |
---|---|
protected ZooKeeper |
checkZk()
Try to create a Zookeeper connection.
|
void |
close() |
String |
create(String path,
byte[] data,
List<ACL> acl,
CreateMode createMode)
NONSEQUENTIAL create is idempotent operation.
|
void |
delete(String path,
int version)
delete is an idempotent operation.
|
Stat |
exists(String path,
boolean watch)
exists is an idempotent operation.
|
Stat |
exists(String path,
Watcher watcher)
exists is an idempotent operation.
|
List<ACL> |
getAcl(String path,
Stat stat)
getAcl is an idempotent operation.
|
List<String> |
getChildren(String path,
Watcher watcher)
getChildren is an idempotent operation.
|
byte[] |
getData(String path,
boolean watch,
Stat stat)
getData is an idemnpotent operation.
|
byte[] |
getData(String path,
Watcher watcher,
Stat stat)
getData is an idempotent operation.
|
String |
getIdentifier() |
long |
getSessionId() |
byte[] |
getSessionPasswd() |
States |
getState() |
ZooKeeper |
getZooKeeper() |
List<OpResult> |
multi(Iterable<Op> ops)
Run multiple operations in a transactional manner.
|
void |
reconnectAfterExpiration() |
byte[] |
removeMetaData(byte[] data) |
Stat |
setAcl(String path,
List<ACL> acls,
int version)
setAcl is an idempotent operation.
|
Stat |
setData(String path,
byte[] data,
int version)
setData is NOT an idempotent operation.
|
void |
sync(String path,
AsyncCallback.VoidCallback cb,
Object ctx) |
public RecoverableZooKeeper(String quorumServers, int sessionTimeout, Watcher watcher, int maxRetries, int retryIntervalMillis) throws IOException
IOException
public RecoverableZooKeeper(String quorumServers, int sessionTimeout, Watcher watcher, int maxRetries, int retryIntervalMillis, String identifier) throws IOException
IOException
protected ZooKeeper checkZk() throws KeeperException
KeeperException
public void reconnectAfterExpiration() throws IOException, KeeperException, InterruptedException
IOException
KeeperException
InterruptedException
public void delete(String path, int version) throws InterruptedException, KeeperException
InterruptedException
KeeperException
public Stat exists(String path, Watcher watcher) throws KeeperException, InterruptedException
KeeperException
InterruptedException
public Stat exists(String path, boolean watch) throws KeeperException, InterruptedException
KeeperException
InterruptedException
public List<String> getChildren(String path, Watcher watcher) throws KeeperException, InterruptedException
KeeperException
InterruptedException
public byte[] getData(String path, Watcher watcher, Stat stat) throws KeeperException, InterruptedException
KeeperException
InterruptedException
public byte[] getData(String path, boolean watch, Stat stat) throws KeeperException, InterruptedException
KeeperException
InterruptedException
public Stat setData(String path, byte[] data, int version) throws KeeperException, InterruptedException
KeeperException
InterruptedException
public List<ACL> getAcl(String path, Stat stat) throws KeeperException, InterruptedException
KeeperException
InterruptedException
public Stat setAcl(String path, List<ACL> acls, int version) throws KeeperException, InterruptedException
KeeperException
InterruptedException
public String create(String path, byte[] data, List<ACL> acl, CreateMode createMode) throws KeeperException, InterruptedException
NONSEQUENTIAL create is idempotent operation. Retry before throwing exceptions. But this function will not throw the NodeExist exception back to the application.
But SEQUENTIAL is NOT idempotent operation. It is necessary to add identifier to the path to verify, whether the previous one is successful or not.
KeeperException
InterruptedException
public List<OpResult> multi(Iterable<Op> ops) throws KeeperException, InterruptedException
KeeperException
InterruptedException
public byte[] removeMetaData(byte[] data)
public long getSessionId()
public void close() throws InterruptedException
InterruptedException
public States getState()
public ZooKeeper getZooKeeper()
public byte[] getSessionPasswd()
public void sync(String path, AsyncCallback.VoidCallback cb, Object ctx) throws KeeperException
KeeperException
public String getIdentifier()