- 使用 Spring Initializr 创建 Spring Boot 应用程序
- 在Spring Boot中配置Cassandra
- 在 Spring Boot 上配置 Tomcat 连接池
- 将Camel消息路由到嵌入WildFly的Artemis上
本文整理了Java中org.apache.helix.manager.zk.ZkClient.deleteRecursively()
方法的一些代码示例,展示了ZkClient.deleteRecursively()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。ZkClient.deleteRecursively()
方法的具体详情如下:
包路径:org.apache.helix.manager.zk.ZkClient
类名称:ZkClient
方法名:deleteRecursively
暂无
代码示例来源:origin: org.apache.helix/helix-core
private void delete(String zkPath) {
client.deleteRecursively(zkPath);
}
代码示例来源:origin: org.apache.helix/helix-core
public static void dropChildren(ZkClient client, String parentPath, ZNRecord nodeRecord) {
// TODO: check if parentPath exists
String id = nodeRecord.getId();
String temp = parentPath + "/" + id;
client.deleteRecursively(temp);
}
代码示例来源:origin: org.apache.helix/helix-core
if (recreateIfExists) {
logger.warn("Root directory exists.Cleaning the root directory:" + root);
_zkClient.deleteRecursively(root);
} else {
logger.info("Cluster " + clusterName + " already exists");
代码示例来源:origin: org.apache.helix/helix-core
@Override
public void addStateModelDef(String clusterName, String stateModelDef,
StateModelDefinition stateModel, boolean recreateIfExists) {
logger
.info("Add StateModelDef {} in cluster {} with StateModel {}.", stateModelDef, clusterName,
stateModel == null ? "NULL" : stateModel.toString());
if (!ZKUtil.isClusterSetup(clusterName, _zkClient)) {
throw new HelixException("cluster " + clusterName + " is not setup yet");
}
String stateModelDefPath = PropertyPathBuilder.stateModelDef(clusterName);
String stateModelPath = stateModelDefPath + "/" + stateModelDef;
if (_zkClient.exists(stateModelPath)) {
if (recreateIfExists) {
logger.info(
"Operation.State Model directory exists:" + stateModelPath + ", remove and recreate.");
_zkClient.deleteRecursively(stateModelPath);
} else {
logger.info("Skip the operation. State Model directory exists:" + stateModelPath);
return;
}
}
HelixDataAccessor accessor =
new ZKHelixDataAccessor(clusterName, new ZkBaseDataAccessor<ZNRecord>(_zkClient));
Builder keyBuilder = accessor.keyBuilder();
accessor.setProperty(keyBuilder.stateModelDef(stateModelDef), stateModel);
}
代码示例来源:origin: org.apache.helix/helix-core
@Override
public void dropCluster(String clusterName) {
logger.info("Deleting cluster {}.", clusterName);
HelixDataAccessor accessor =
new ZKHelixDataAccessor(clusterName, new ZkBaseDataAccessor<ZNRecord>(_zkClient));
Builder keyBuilder = accessor.keyBuilder();
String root = "/" + clusterName;
if (accessor.getChildNames(keyBuilder.liveInstances()).size() > 0) {
throw new HelixException(
"There are still live instances in the cluster, shut them down first.");
}
if (accessor.getProperty(keyBuilder.controllerLeader()) != null) {
throw new HelixException("There are still LEADER in the cluster, shut them down first.");
}
_zkClient.deleteRecursively(root);
}
代码示例来源:origin: apache/helix
@Override
public Representation delete() {
String zkPath = getZKPath();
try {
ZkClient zkClient =
(ZkClient) getContext().getAttributes().get(RestAdminApplication.ZKCLIENT);
zkClient.deleteRecursively(zkPath);
getResponse().setStatus(Status.SUCCESS_OK);
} catch (Exception e) {
getResponse().setEntity(ClusterRepresentationUtil.getErrorAsJsonStringFromException(e),
MediaType.APPLICATION_JSON);
getResponse().setStatus(Status.SUCCESS_OK);
LOG.error("Error in delete zkPath: " + zkPath, e);
}
return null;
}
代码示例来源:origin: apache/helix
@Override
public Representation delete() {
String zkPath = getZKPath();
try {
ZkClient zkClient =
(ZkClient) getContext().getAttributes().get(RestAdminApplication.ZKCLIENT);
List<String> childNames = zkClient.getChildren(zkPath);
if (childNames != null) {
for (String childName : childNames) {
String childPath = zkPath.equals("/") ? "/" + childName : zkPath + "/" + childName;
zkClient.deleteRecursively(childPath);
}
}
getResponse().setStatus(Status.SUCCESS_OK);
} catch (Exception e) {
getResponse().setEntity(ClusterRepresentationUtil.getErrorAsJsonStringFromException(e),
MediaType.APPLICATION_JSON);
getResponse().setStatus(Status.SUCCESS_OK);
LOG.error("Error in delete zkChild: " + zkPath, e);
}
return null;
}
}
代码示例来源:origin: apache/helix
@Override
public Representation post(Representation entity) {
String zkPath = getZKPath();
try {
JsonParameters jsonParameters = new JsonParameters(entity);
String command = jsonParameters.getCommand();
ZkClient zkClient =
(ZkClient) getContext().getAttributes().get(RestAdminApplication.ZKCLIENT);
if (command.equalsIgnoreCase(JsonParameters.ZK_DELETE_CHILDREN)) {
List<String> childNames = zkClient.getChildren(zkPath);
if (childNames != null) {
for (String childName : childNames) {
String childPath = zkPath.equals("/") ? "/" + childName : zkPath + "/" + childName;
zkClient.deleteRecursively(childPath);
}
}
} else {
throw new HelixException("Unsupported command: " + command + ". Should be one of ["
+ JsonParameters.ZK_DELETE_CHILDREN + "]");
}
getResponse().setStatus(Status.SUCCESS_OK);
} catch (Exception e) {
getResponse().setEntity(ClusterRepresentationUtil.getErrorAsJsonStringFromException(e),
MediaType.APPLICATION_JSON);
getResponse().setStatus(Status.SUCCESS_OK);
LOG.error("Error in post zkPath: " + zkPath, e);
}
return null;
}
代码示例来源:origin: org.apache.helix/helix-core
_zkclient.deleteRecursively(path);
代码示例来源:origin: org.apache.helix/helix-core
@Override
public void dropInstance(String clusterName, InstanceConfig instanceConfig) {
logger.info("Drop instance {} from cluster {}.", instanceConfig.getInstanceName(), clusterName);
String instanceName = instanceConfig.getInstanceName();
String instanceConfigPath = PropertyPathBuilder.instanceConfig(clusterName, instanceName);
if (!_zkClient.exists(instanceConfigPath)) {
throw new HelixException(
"Node " + instanceName + " does not exist in config for cluster " + clusterName);
}
String instancePath = PropertyPathBuilder.instance(clusterName, instanceName);
if (!_zkClient.exists(instancePath)) {
throw new HelixException(
"Node " + instanceName + " does not exist in instances for cluster " + clusterName);
}
String liveInstancePath = PropertyPathBuilder.liveInstance(clusterName, instanceName);
if (_zkClient.exists(liveInstancePath)) {
throw new HelixException(
"Node " + instanceName + " is still alive for cluster " + clusterName + ", can't drop.");
}
// delete config path
String instanceConfigsPath = PropertyPathBuilder.instanceConfig(clusterName);
ZKUtil.dropChildren(_zkClient, instanceConfigsPath, instanceConfig.getRecord());
// delete instance path
_zkClient.deleteRecursively(instancePath);
}
代码示例来源:origin: apache/helix
@Test()
void testGetStat() {
String path = "/tmp/getStatTest";
_zkClient.deleteRecursively(path);
Stat stat, newStat;
stat = _zkClient.getStat(path);
AssertJUnit.assertNull(stat);
_zkClient.createPersistent(path, true);
stat = _zkClient.getStat(path);
AssertJUnit.assertNotNull(stat);
newStat = _zkClient.getStat(path);
AssertJUnit.assertEquals(stat, newStat);
_zkClient.writeData(path, new ZNRecord("Test"));
newStat = _zkClient.getStat(path);
AssertJUnit.assertNotSame(stat, newStat);
}
本文整理了Java中org.I0Itec.zkclient.ZkClient.fireDataChangedEvents()方法的一些代码示例,展示了ZkClient.fireDataChangedE
本文整理了Java中org.I0Itec.zkclient.ZkClient.fireAllEvents()方法的一些代码示例,展示了ZkClient.fireAllEvents()的具体用法。这些代
本文整理了Java中org.I0Itec.zkclient.ZkClient.serialize()方法的一些代码示例,展示了ZkClient.serialize()的具体用法。这些代码示例主要来源于
本文整理了Java中org.I0Itec.zkclient.ZkClient.fireStateChangedEvent()方法的一些代码示例,展示了ZkClient.fireStateChanged
本文整理了Java中org.I0Itec.zkclient.ZkClient.processStateChanged()方法的一些代码示例,展示了ZkClient.processStateChange
本文整理了Java中org.I0Itec.zkclient.ZkClient.getEventLock()方法的一些代码示例,展示了ZkClient.getEventLock()的具体用法。这些代码示
本文整理了Java中org.I0Itec.zkclient.ZkClient.waitForKeeperState()方法的一些代码示例,展示了ZkClient.waitForKeeperState(
本文整理了Java中org.I0Itec.zkclient.ZkClient.setShutdownTrigger()方法的一些代码示例,展示了ZkClient.setShutdownTrigger(
本文整理了Java中org.I0Itec.zkclient.ZkClient.fireNewSessionEvents()方法的一些代码示例,展示了ZkClient.fireNewSessionEve
本文整理了Java中org.I0Itec.zkclient.ZkClient.retryUntilConnected()方法的一些代码示例,展示了ZkClient.retryUntilConnecte
本文整理了Java中org.I0Itec.zkclient.ZkClient.watchForChilds()方法的一些代码示例,展示了ZkClient.watchForChilds()的具体用法。这
本文整理了Java中org.I0Itec.zkclient.ZkClient.create()方法的一些代码示例,展示了ZkClient.create()的具体用法。这些代码示例主要来源于Github
本文整理了Java中org.I0Itec.zkclient.ZkClient.unsubscribeAll()方法的一些代码示例,展示了ZkClient.unsubscribeAll()的具体用法。这
本文整理了Java中org.I0Itec.zkclient.ZkClient.hasListeners()方法的一些代码示例,展示了ZkClient.hasListeners()的具体用法。这些代码示
本文整理了Java中org.I0Itec.zkclient.ZkClient.writeDataReturnStat()方法的一些代码示例,展示了ZkClient.writeDataReturnSta
本文整理了Java中org.I0Itec.zkclient.ZkClient.setZkSerializer()方法的一些代码示例,展示了ZkClient.setZkSerializer()的具体用法
本文整理了Java中org.I0Itec.zkclient.ZkClient.waitUntilExists()方法的一些代码示例,展示了ZkClient.waitUntilExists()的具体用法
本文整理了Java中org.I0Itec.zkclient.ZkClient.fireChildChangedEvents()方法的一些代码示例,展示了ZkClient.fireChildChange
本文整理了Java中org.I0Itec.zkclient.ZkClient.setCurrentState()方法的一些代码示例,展示了ZkClient.setCurrentState()的具体用法
本文整理了Java中org.I0Itec.zkclient.ZkClient.getShutdownTrigger()方法的一些代码示例,展示了ZkClient.getShutdownTrigger(
我是一名优秀的程序员,十分优秀!