|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.apache.solr.common.cloud.SolrZkClient
public class SolrZkClient
All Solr ZooKeeper interactions should go through this class rather than ZooKeeper. This class handles synchronous connects and reconnections.
Field Summary | |
---|---|
static AtomicLong |
numCloses
|
static AtomicLong |
numOpens
|
Constructor Summary | |
---|---|
SolrZkClient(String zkServerAddress,
int zkClientTimeout)
|
|
SolrZkClient(String zkServerAddress,
int zkClientTimeout,
int zkClientConnectTimeout,
OnReconnect onReonnect)
|
|
SolrZkClient(String zkServerAddress,
int zkClientTimeout,
int clientConnectTimeout,
ZkClientConnectionStrategy strat,
OnReconnect onReconnect)
|
|
SolrZkClient(String zkServerAddress,
int zkClientTimeout,
int clientConnectTimeout,
ZkClientConnectionStrategy strat,
OnReconnect onReconnect,
BeforeReconnect beforeReconnect)
|
|
SolrZkClient(String zkServerAddress,
int zkClientTimeout,
ZkClientConnectionStrategy strat,
OnReconnect onReconnect)
|
Method Summary | |
---|---|
void |
clean(String path)
|
void |
close()
|
String |
create(String path,
byte[] data,
org.apache.zookeeper.CreateMode createMode,
boolean retryOnConnLoss)
Returns path of created node |
String |
create(String path,
byte[] data,
List<org.apache.zookeeper.data.ACL> acl,
org.apache.zookeeper.CreateMode createMode,
boolean retryOnConnLoss)
Returns path of created node |
void |
delete(String path,
int version,
boolean retryOnConnLoss)
|
Boolean |
exists(String path,
boolean retryOnConnLoss)
Returns true if path exists |
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)
Returns children of the node at the path |
ConnectionManager |
getConnectionManager()
|
byte[] |
getData(String path,
org.apache.zookeeper.Watcher watcher,
org.apache.zookeeper.data.Stat stat,
boolean retryOnConnLoss)
Returns node's data |
SolrZooKeeper |
getSolrZooKeeper()
|
ZkClientConnectionStrategy |
getZkClientConnectionStrategy()
|
int |
getZkClientTimeout()
|
boolean |
isClosed()
|
boolean |
isConnected()
Returns true if client is connected |
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. |
org.apache.zookeeper.data.Stat |
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)
Returns node's state |
org.apache.zookeeper.data.Stat |
setData(String path,
File file,
boolean retryOnConnLoss)
Write file to ZooKeeper - default system encoding used. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final AtomicLong numOpens
public static final AtomicLong numCloses
Constructor Detail |
---|
public SolrZkClient(String zkServerAddress, int zkClientTimeout)
public SolrZkClient(String zkServerAddress, int zkClientTimeout, int zkClientConnectTimeout, OnReconnect onReonnect)
public SolrZkClient(String zkServerAddress, int zkClientTimeout, ZkClientConnectionStrategy strat, OnReconnect onReconnect)
public SolrZkClient(String zkServerAddress, int zkClientTimeout, int clientConnectTimeout, ZkClientConnectionStrategy strat, OnReconnect onReconnect)
public SolrZkClient(String zkServerAddress, int zkClientTimeout, int clientConnectTimeout, ZkClientConnectionStrategy strat, OnReconnect onReconnect, BeforeReconnect beforeReconnect)
Method Detail |
---|
public int getZkClientTimeout()
public ConnectionManager getConnectionManager()
public ZkClientConnectionStrategy getZkClientConnectionStrategy()
public boolean isConnected()
public void delete(String path, int version, boolean retryOnConnLoss) throws InterruptedException, org.apache.zookeeper.KeeperException
InterruptedException
org.apache.zookeeper.KeeperException
public 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 watcher
org.apache.zookeeper.KeeperException
- If the server signals an error
InterruptedException
- 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
org.apache.zookeeper.KeeperException
InterruptedException
public 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
org.apache.zookeeper.KeeperException
InterruptedException
public List<String> getChildren(String path, org.apache.zookeeper.Watcher watcher, boolean retryOnConnLoss) throws org.apache.zookeeper.KeeperException, InterruptedException
org.apache.zookeeper.KeeperException
InterruptedException
public byte[] getData(String path, org.apache.zookeeper.Watcher watcher, org.apache.zookeeper.data.Stat stat, boolean retryOnConnLoss) throws org.apache.zookeeper.KeeperException, InterruptedException
org.apache.zookeeper.KeeperException
InterruptedException
public org.apache.zookeeper.data.Stat setData(String path, byte[] data, int version, boolean retryOnConnLoss) throws org.apache.zookeeper.KeeperException, InterruptedException
org.apache.zookeeper.KeeperException
InterruptedException
public String create(String path, byte[] data, org.apache.zookeeper.CreateMode createMode, boolean retryOnConnLoss) throws org.apache.zookeeper.KeeperException, InterruptedException
org.apache.zookeeper.KeeperException
InterruptedException
public 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.
org.apache.zookeeper.KeeperException
InterruptedException
public void makePath(String path, boolean failOnExists, boolean retryOnConnLoss) throws org.apache.zookeeper.KeeperException, InterruptedException
org.apache.zookeeper.KeeperException
InterruptedException
public void makePath(String path, File file, boolean failOnExists, boolean retryOnConnLoss) throws IOException, org.apache.zookeeper.KeeperException, InterruptedException
IOException
org.apache.zookeeper.KeeperException
InterruptedException
public void makePath(String path, File file, boolean retryOnConnLoss) throws IOException, org.apache.zookeeper.KeeperException, InterruptedException
IOException
org.apache.zookeeper.KeeperException
InterruptedException
public void makePath(String path, org.apache.zookeeper.CreateMode createMode, boolean retryOnConnLoss) throws org.apache.zookeeper.KeeperException, InterruptedException
org.apache.zookeeper.KeeperException
InterruptedException
public void makePath(String path, byte[] data, boolean retryOnConnLoss) throws org.apache.zookeeper.KeeperException, InterruptedException
data
- to set on the last zkNode
org.apache.zookeeper.KeeperException
InterruptedException
public 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.
data
- to set on the last zkNode
org.apache.zookeeper.KeeperException
InterruptedException
public 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.
data
- to set on the last zkNode
org.apache.zookeeper.KeeperException
InterruptedException
public 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.
org.apache.zookeeper.KeeperException
InterruptedException
public void makePath(String zkPath, org.apache.zookeeper.CreateMode createMode, org.apache.zookeeper.Watcher watcher, boolean retryOnConnLoss) throws org.apache.zookeeper.KeeperException, InterruptedException
org.apache.zookeeper.KeeperException
InterruptedException
public org.apache.zookeeper.data.Stat setData(String path, byte[] data, boolean retryOnConnLoss) throws org.apache.zookeeper.KeeperException, InterruptedException
org.apache.zookeeper.KeeperException
InterruptedException
public org.apache.zookeeper.data.Stat 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 uploaded
IOException
org.apache.zookeeper.KeeperException
InterruptedException
public void printLayout(String path, int indent, StringBuilder string) throws org.apache.zookeeper.KeeperException, InterruptedException
org.apache.zookeeper.KeeperException
InterruptedException
public void printLayoutToStdOut() throws org.apache.zookeeper.KeeperException, InterruptedException
org.apache.zookeeper.KeeperException
InterruptedException
public static String prettyPrint(String input, int indent)
public void close()
public boolean isClosed()
public SolrZooKeeper getSolrZooKeeper()
public void clean(String path) throws InterruptedException, org.apache.zookeeper.KeeperException
InterruptedException
org.apache.zookeeper.KeeperException
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |