public class SolrZkClient extends Object
| Modifier and Type | Field and Description |
|---|---|
static AtomicLong |
numCloses |
static AtomicLong |
numOpens |
| Constructor and Description |
|---|
SolrZkClient(String zkServerAddress,
int zkClientTimeout) |
SolrZkClient(String zkServerAddress,
int zkClientTimeout,
int zkClientConnectTimeout,
OnReconnect onReonnect) |
SolrZkClient(String zkServerAddress,
int zkClientTimeout,
ZkClientConnectionStrategy strat,
OnReconnect onReconnect) |
SolrZkClient(String zkServerAddress,
int zkClientTimeout,
ZkClientConnectionStrategy strat,
OnReconnect onReconnect,
int clientConnectTimeout) |
| Modifier and Type | Method and Description |
|---|---|
void |
clean(String path) |
void |
close() |
String |
create(String path,
byte[] data,
org.apache.zookeeper.CreateMode createMode,
boolean retryOnConnLoss) |
String |
create(String path,
byte[] data,
List<org.apache.zookeeper.data.ACL> acl,
org.apache.zookeeper.CreateMode createMode,
boolean retryOnConnLoss) |
void |
delete(String path,
int version,
boolean retryOnConnLoss) |
Boolean |
exists(String path,
boolean retryOnConnLoss) |
org.apache.zookeeper.data.Stat |
exists(String path,
org.apache.zookeeper.Watcher watcher,
boolean retryOnConnLoss)
Return the stat of the node of the given path.
|
List<String> |
getChildren(String path,
org.apache.zookeeper.Watcher watcher,
boolean retryOnConnLoss) |
byte[] |
getData(String path,
org.apache.zookeeper.Watcher watcher,
org.apache.zookeeper.data.Stat stat,
boolean retryOnConnLoss) |
SolrZooKeeper |
getSolrZooKeeper() |
boolean |
isClosed() |
boolean |
isConnected() |
void |
makePath(String path,
boolean retryOnConnLoss)
Creates the path in ZooKeeper, creating each node as necessary.
|
void |
makePath(String path,
boolean failOnExists,
boolean retryOnConnLoss) |
void |
makePath(String path,
byte[] data,
boolean retryOnConnLoss)
Creates the path in ZooKeeper, creating each node as necessary.
|
void |
makePath(String path,
byte[] data,
org.apache.zookeeper.CreateMode createMode,
boolean retryOnConnLoss)
Creates the path in ZooKeeper, creating each node as necessary.
|
void |
makePath(String path,
byte[] data,
org.apache.zookeeper.CreateMode createMode,
org.apache.zookeeper.Watcher watcher,
boolean retryOnConnLoss)
Creates the path in ZooKeeper, creating each node as necessary.
|
void |
makePath(String path,
byte[] data,
org.apache.zookeeper.CreateMode createMode,
org.apache.zookeeper.Watcher watcher,
boolean failOnExists,
boolean retryOnConnLoss)
Creates the path in ZooKeeper, creating each node as necessary.
|
void |
makePath(String path,
org.apache.zookeeper.CreateMode createMode,
boolean retryOnConnLoss) |
void |
makePath(String zkPath,
org.apache.zookeeper.CreateMode createMode,
org.apache.zookeeper.Watcher watcher,
boolean retryOnConnLoss) |
void |
makePath(String path,
File file,
boolean retryOnConnLoss) |
void |
makePath(String path,
File file,
boolean failOnExists,
boolean retryOnConnLoss) |
static String |
prettyPrint(String input,
int indent) |
void |
printLayout(String path,
int indent,
StringBuilder string)
Fills string with printout of current ZooKeeper layout.
|
void |
printLayoutToStdOut()
Prints current ZooKeeper layout to stdout.
|
void |
setData(String path,
byte[] data,
boolean retryOnConnLoss)
Write data to ZooKeeper.
|
org.apache.zookeeper.data.Stat |
setData(String path,
byte[] data,
int version,
boolean retryOnConnLoss) |
void |
setData(String path,
File file,
boolean retryOnConnLoss)
Write file to ZooKeeper - default system encoding used.
|
public static final AtomicLong numOpens
public static final AtomicLong numCloses
public SolrZkClient(String zkServerAddress, int zkClientTimeout) throws InterruptedException, TimeoutException, IOException
zkServerAddress - zkClientTimeout - InterruptedExceptionTimeoutExceptionIOExceptionpublic SolrZkClient(String zkServerAddress, int zkClientTimeout, int zkClientConnectTimeout, OnReconnect onReonnect) throws InterruptedException, TimeoutException, IOException
public SolrZkClient(String zkServerAddress, int zkClientTimeout, ZkClientConnectionStrategy strat, OnReconnect onReconnect) throws InterruptedException, TimeoutException, IOException
zkServerAddress - zkClientTimeout - strat - onReconnect - InterruptedExceptionTimeoutExceptionIOExceptionpublic SolrZkClient(String zkServerAddress, int zkClientTimeout, ZkClientConnectionStrategy strat, OnReconnect onReconnect, int clientConnectTimeout) throws InterruptedException, TimeoutException, IOException
zkServerAddress - zkClientTimeout - strat - onReconnect - clientConnectTimeout - InterruptedExceptionTimeoutExceptionIOExceptionpublic boolean isConnected()
public void delete(String path, int version, boolean retryOnConnLoss) throws InterruptedException, org.apache.zookeeper.KeeperException
path - version - retryOnConnLoss - InterruptedExceptionorg.apache.zookeeper.KeeperExceptionpublic org.apache.zookeeper.data.Stat exists(String path, org.apache.zookeeper.Watcher watcher, boolean retryOnConnLoss) throws org.apache.zookeeper.KeeperException, InterruptedException
If the watch is non-null and the call is successful (no exception is thrown), a watch will be left on the node with the given path. The watch will be triggered by a successful operation that creates/delete the node or sets the data on the node.
path - the node pathwatcher - explicit watcherretryOnConnLoss - org.apache.zookeeper.KeeperException - If the server signals an errorInterruptedException - If the server transaction is interrupted.IllegalArgumentException - if an invalid path is specifiedpublic Boolean exists(String path, boolean retryOnConnLoss) throws org.apache.zookeeper.KeeperException, InterruptedException
path - retryOnConnLoss - org.apache.zookeeper.KeeperExceptionInterruptedExceptionpublic String create(String path, byte[] data, List<org.apache.zookeeper.data.ACL> acl, org.apache.zookeeper.CreateMode createMode, boolean retryOnConnLoss) throws org.apache.zookeeper.KeeperException, InterruptedException
path - data - acl - createMode - retryOnConnLoss - org.apache.zookeeper.KeeperExceptionInterruptedExceptionpublic List<String> getChildren(String path, org.apache.zookeeper.Watcher watcher, boolean retryOnConnLoss) throws org.apache.zookeeper.KeeperException, InterruptedException
path - watcher - retryOnConnLoss - org.apache.zookeeper.KeeperExceptionInterruptedExceptionpublic byte[] getData(String path, org.apache.zookeeper.Watcher watcher, org.apache.zookeeper.data.Stat stat, boolean retryOnConnLoss) throws org.apache.zookeeper.KeeperException, InterruptedException
path - watcher - stat - retryOnConnLoss - org.apache.zookeeper.KeeperExceptionInterruptedExceptionpublic org.apache.zookeeper.data.Stat setData(String path, byte[] data, int version, boolean retryOnConnLoss) throws org.apache.zookeeper.KeeperException, InterruptedException
path - data - version - retryOnConnLoss - org.apache.zookeeper.KeeperExceptionInterruptedExceptionpublic String create(String path, byte[] data, org.apache.zookeeper.CreateMode createMode, boolean retryOnConnLoss) throws org.apache.zookeeper.KeeperException, InterruptedException
path - data - createMode - retryOnConnLoss - org.apache.zookeeper.KeeperExceptionInterruptedExceptionpublic void makePath(String path, boolean retryOnConnLoss) throws org.apache.zookeeper.KeeperException, InterruptedException
path=/solr/group/node and none of the nodes, solr,
group, node exist, each will be created.path - retryOnConnLoss - org.apache.zookeeper.KeeperExceptionInterruptedExceptionpublic void makePath(String path, boolean failOnExists, boolean retryOnConnLoss) throws org.apache.zookeeper.KeeperException, InterruptedException
org.apache.zookeeper.KeeperExceptionInterruptedExceptionpublic void makePath(String path, File file, boolean failOnExists, boolean retryOnConnLoss) throws IOException, org.apache.zookeeper.KeeperException, InterruptedException
IOExceptionorg.apache.zookeeper.KeeperExceptionInterruptedExceptionpublic void makePath(String path, File file, boolean retryOnConnLoss) throws IOException, org.apache.zookeeper.KeeperException, InterruptedException
IOExceptionorg.apache.zookeeper.KeeperExceptionInterruptedExceptionpublic void makePath(String path, org.apache.zookeeper.CreateMode createMode, boolean retryOnConnLoss) throws org.apache.zookeeper.KeeperException, InterruptedException
org.apache.zookeeper.KeeperExceptionInterruptedExceptionpublic void makePath(String path, byte[] data, boolean retryOnConnLoss) throws org.apache.zookeeper.KeeperException, InterruptedException
path - data - to set on the last zkNoderetryOnConnLoss - org.apache.zookeeper.KeeperExceptionInterruptedExceptionpublic void makePath(String path, byte[] data, org.apache.zookeeper.CreateMode createMode, boolean retryOnConnLoss) throws org.apache.zookeeper.KeeperException, InterruptedException
path=/solr/group/node and none of the nodes, solr,
group, node exist, each will be created.path - data - to set on the last zkNodecreateMode - retryOnConnLoss - org.apache.zookeeper.KeeperExceptionInterruptedExceptionpublic void makePath(String path, byte[] data, org.apache.zookeeper.CreateMode createMode, org.apache.zookeeper.Watcher watcher, boolean retryOnConnLoss) throws org.apache.zookeeper.KeeperException, InterruptedException
path=/solr/group/node and none of the nodes, solr,
group, node exist, each will be created.path - data - to set on the last zkNodecreateMode - watcher - retryOnConnLoss - org.apache.zookeeper.KeeperExceptionInterruptedExceptionpublic void makePath(String path, byte[] data, org.apache.zookeeper.CreateMode createMode, org.apache.zookeeper.Watcher watcher, boolean failOnExists, boolean retryOnConnLoss) throws org.apache.zookeeper.KeeperException, InterruptedException
path=/solr/group/node and none of the nodes, solr,
group, node exist, each will be created.
Note: retryOnConnLoss is only respected for the final node - nodes
before that are always retried on connection loss.path - data - createMode - watcher - failOnExists - retryOnConnLoss - org.apache.zookeeper.KeeperExceptionInterruptedExceptionpublic void makePath(String zkPath, org.apache.zookeeper.CreateMode createMode, org.apache.zookeeper.Watcher watcher, boolean retryOnConnLoss) throws org.apache.zookeeper.KeeperException, InterruptedException
zkPath - createMode - watcher - retryOnConnLoss - org.apache.zookeeper.KeeperExceptionInterruptedExceptionpublic void setData(String path, byte[] data, boolean retryOnConnLoss) throws org.apache.zookeeper.KeeperException, InterruptedException
path - data - retryOnConnLoss - org.apache.zookeeper.KeeperExceptionInterruptedExceptionpublic void setData(String path, File file, boolean retryOnConnLoss) throws IOException, org.apache.zookeeper.KeeperException, InterruptedException
path - path to upload file to e.g. /solr/conf/solrconfig.xmlfile - path to file to be uploadedretryOnConnLoss - IOExceptionorg.apache.zookeeper.KeeperExceptionInterruptedExceptionpublic void printLayout(String path, int indent, StringBuilder string) throws org.apache.zookeeper.KeeperException, InterruptedException
path - indent - org.apache.zookeeper.KeeperExceptionInterruptedExceptionpublic void printLayoutToStdOut()
throws org.apache.zookeeper.KeeperException,
InterruptedException
org.apache.zookeeper.KeeperExceptionInterruptedExceptionpublic void close()
throws InterruptedException
InterruptedExceptionpublic boolean isClosed()
public SolrZooKeeper getSolrZooKeeper()
public void clean(String path) throws InterruptedException, org.apache.zookeeper.KeeperException
InterruptedExceptionorg.apache.zookeeper.KeeperExceptionCopyright © 2000-2012 Apache Software Foundation. All Rights Reserved.