- 使用 Spring Initializr 创建 Spring Boot 应用程序
- 在Spring Boot中配置Cassandra
- 在 Spring Boot 上配置 Tomcat 连接池
- 将Camel消息路由到嵌入WildFly的Artemis上
本文整理了Java中org.apache.accumulo.server.zookeeper.ZooReaderWriter.putPersistentData()
方法的一些代码示例,展示了ZooReaderWriter.putPersistentData()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。ZooReaderWriter.putPersistentData()
方法的具体详情如下:
包路径:org.apache.accumulo.server.zookeeper.ZooReaderWriter
类名称:ZooReaderWriter
方法名:putPersistentData
暂无
代码示例来源:origin: org.apache.accumulo/accumulo-server-base
public void addWork(String workId, byte[] data) throws KeeperException, InterruptedException {
if (workId.equalsIgnoreCase(LOCKS_NODE))
throw new IllegalArgumentException("locks is reserved work id");
zoo.mkdirs(path);
zoo.putPersistentData(path + "/" + workId, data, NodeExistsPolicy.SKIP);
}
代码示例来源:origin: org.apache.accumulo/accumulo-server
public void addWork(String workId, byte[] data) throws KeeperException, InterruptedException {
if (workId.equalsIgnoreCase(LOCKS_NODE))
throw new IllegalArgumentException("locks is reserved work id");
zoo.mkdirs(path);
zoo.putPersistentData(path + "/" + workId, data, NodeExistsPolicy.SKIP);
}
代码示例来源:origin: org.apache.accumulo/accumulo-server
public static boolean setTableProperty(String tableId, String property, String value) throws KeeperException, InterruptedException {
if (!isPropertyValid(property, value))
return false;
// create the zk node for per-table properties for this table if it doesn't already exist
String zkTablePath = getTablePath(tableId);
ZooReaderWriter.getInstance().putPersistentData(zkTablePath, new byte[0], NodeExistsPolicy.SKIP);
// create the zk node for this property and set it's data to the specified value
String zPath = zkTablePath + "/" + property;
ZooReaderWriter.getInstance().putPersistentData(zPath, value.getBytes(UTF_8), NodeExistsPolicy.OVERWRITE);
return true;
}
代码示例来源:origin: org.apache.accumulo/accumulo-master
public MasterTime(Master master) throws IOException {
this.zPath = ZooUtil.getRoot(master.getInstance()) + Constants.ZMASTER_TICK;
this.zk = ZooReaderWriter.getInstance();
this.master = master;
try {
zk.putPersistentData(zPath, "0".getBytes(StandardCharsets.UTF_8), NodeExistsPolicy.SKIP);
skewAmount = Long.parseLong(new String(zk.getData(zPath, null), StandardCharsets.UTF_8))
- System.nanoTime();
} catch (Exception ex) {
throw new IOException("Error updating master time", ex);
}
this.timer = new Timer();
timer.schedule(this, 0, MILLISECONDS.convert(10, SECONDS));
}
代码示例来源:origin: org.apache.accumulo/accumulo-server-base
void saveToZooKeeper(ZooReaderWriter zoorw, Instance instance)
throws IOException, KeeperException, InterruptedException {
zoorw.putPersistentData(getZPath(instance), encode(), NodeExistsPolicy.OVERWRITE);
}
代码示例来源:origin: org.apache.accumulo/accumulo-server-base
private void updateState(TServerInstance tsi, Path path, WalState state)
throws WalMarkerException {
byte[] data = (state.toString() + "," + path.toString()).getBytes(UTF_8);
try {
NodeExistsPolicy policy = NodeExistsPolicy.OVERWRITE;
if (state == WalState.OPEN) {
policy = NodeExistsPolicy.FAIL;
}
log.debug("Setting {} to {}", path.getName(), state);
zoo.putPersistentData(root() + "/" + tsi.toString() + "/" + path.getName(), data, policy);
} catch (KeeperException | InterruptedException e) {
throw new WalMarkerException(e);
}
}
代码示例来源:origin: org.apache.accumulo/accumulo-server
private void setMasterGoalState(MasterGoalState state) {
try {
ZooReaderWriter.getInstance().putPersistentData(ZooUtil.getRoot(instance) + Constants.ZMASTER_GOAL_STATE, state.name().getBytes(UTF_8),
NodeExistsPolicy.OVERWRITE);
} catch (Exception ex) {
log.error("Unable to set master goal state in zookeeper");
}
}
代码示例来源:origin: org.apache.accumulo/accumulo-server-base
public static boolean setTableProperty(String tableId, String property, String value)
throws KeeperException, InterruptedException {
if (!isPropertyValid(property, value))
return false;
// create the zk node for per-table properties for this table if it doesn't already exist
String zkTablePath = getTablePath(tableId);
ZooReaderWriter.getInstance().putPersistentData(zkTablePath, new byte[0],
NodeExistsPolicy.SKIP);
// create the zk node for this property and set it's data to the specified value
String zPath = zkTablePath + "/" + property;
ZooReaderWriter.getInstance().putPersistentData(zPath, value.getBytes(UTF_8),
NodeExistsPolicy.OVERWRITE);
return true;
}
代码示例来源:origin: org.apache.accumulo/accumulo-server-base
public static boolean setNamespaceProperty(String namespaceId, String property, String value)
throws KeeperException, InterruptedException {
if (!isPropertyValid(property, value))
return false;
// create the zk node for per-namespace properties for this namespace if it doesn't already
// exist
String zkNamespacePath = getPath(namespaceId);
ZooReaderWriter.getInstance().putPersistentData(zkNamespacePath, new byte[0],
NodeExistsPolicy.SKIP);
// create the zk node for this property and set it's data to the specified value
String zPath = zkNamespacePath + "/" + property;
ZooReaderWriter.getInstance().putPersistentData(zPath, value.getBytes(UTF_8),
NodeExistsPolicy.OVERWRITE);
return true;
}
代码示例来源:origin: org.apache.accumulo/accumulo-master
void setMasterGoalState(MasterGoalState state) {
try {
ZooReaderWriter.getInstance().putPersistentData(
ZooUtil.getRoot(getInstance()) + Constants.ZMASTER_GOAL_STATE, state.name().getBytes(),
NodeExistsPolicy.OVERWRITE);
} catch (Exception ex) {
log.error("Unable to set master goal state in zookeeper");
}
}
代码示例来源:origin: org.apache.accumulo/accumulo-server
@Override
public void put(String path, byte[] bs) throws DistributedStoreException {
try {
path = relative(path);
ZooReaderWriter.getInstance().putPersistentData(path, bs, NodeExistsPolicy.OVERWRITE);
cache.clear();
log.debug("Wrote " + new String(bs, UTF_8) + " to " + path);
} catch (Exception ex) {
throw new DistributedStoreException(ex);
}
}
代码示例来源:origin: org.apache.accumulo/accumulo-server-base
@Override
public void put(String path, byte[] bs) throws DistributedStoreException {
try {
path = relative(path);
ZooReaderWriter.getInstance().putPersistentData(path, bs, NodeExistsPolicy.OVERWRITE);
cache.clear();
log.debug("Wrote " + new String(bs, UTF_8) + " to " + path);
} catch (Exception ex) {
throw new DistributedStoreException(ex);
}
}
代码示例来源:origin: org.apache.accumulo/accumulo-server-base
private String root() throws WalMarkerException {
String root = ZooUtil.getRoot(instance) + ZWALS;
try {
if (!checkedExistance && !zoo.exists(root)) {
zoo.putPersistentData(root, new byte[0], NodeExistsPolicy.SKIP);
}
checkedExistance = true;
} catch (KeeperException | InterruptedException e) {
throw new WalMarkerException(e);
}
return root;
}
代码示例来源:origin: org.apache.accumulo/accumulo-server-base
@Override
public void changeAuthorizations(String user, Authorizations authorizations)
throws AccumuloSecurityException {
try {
synchronized (zooCache) {
zooCache.clear();
ZooReaderWriter.getInstance().putPersistentData(ZKUserPath + "/" + user + ZKUserAuths,
ZKSecurityTool.convertAuthorizations(authorizations), NodeExistsPolicy.OVERWRITE);
}
} catch (KeeperException e) {
log.error("{}", e.getMessage(), e);
throw new AccumuloSecurityException(user, SecurityErrorCode.CONNECTION_ERROR, e);
} catch (InterruptedException e) {
log.error("{}", e.getMessage(), e);
throw new RuntimeException(e);
}
}
代码示例来源:origin: org.apache.accumulo/accumulo-server
void saveToZooKeeper() throws Exception {
ZooReaderWriter.getInstance().putPersistentData(getZPath(), encode(), NodeExistsPolicy.OVERWRITE);
}
代码示例来源:origin: org.apache.accumulo/accumulo-server-base
public void initWalMarker(TServerInstance tsi) throws WalMarkerException {
byte[] data = new byte[0];
try {
zoo.putPersistentData(root() + "/" + tsi.toString(), data, NodeExistsPolicy.FAIL);
} catch (KeeperException | InterruptedException e) {
throw new WalMarkerException(e);
}
}
代码示例来源:origin: org.apache.accumulo/accumulo-server-base
/**
* Sets up a new table configuration for the provided user/table. No checking for existence is
* done here, it should be done before calling.
*/
private void createTablePerm(String user, String table, Set<TablePermission> perms)
throws KeeperException, InterruptedException {
synchronized (zooCache) {
zooCache.clear();
ZooReaderWriter.getInstance().putPersistentData(
ZKUserPath + "/" + user + ZKUserTablePerms + "/" + table,
ZKSecurityTool.convertTablePermissions(perms), NodeExistsPolicy.FAIL);
}
}
代码示例来源:origin: org.apache.accumulo/accumulo-server-base
/**
* Sets up a new namespace configuration for the provided user/table. No checking for existence is
* done here, it should be done before calling.
*/
private void createNamespacePerm(String user, String namespace, Set<NamespacePermission> perms)
throws KeeperException, InterruptedException {
synchronized (zooCache) {
zooCache.clear();
ZooReaderWriter.getInstance().putPersistentData(
ZKUserPath + "/" + user + ZKUserNamespacePerms + "/" + namespace,
ZKSecurityTool.convertNamespacePermissions(perms), NodeExistsPolicy.FAIL);
}
}
代码示例来源:origin: org.apache.accumulo/accumulo-server
/**
* Utility program that will change the goal state for the master from the command line.
*/
public static void main(String[] args) throws Exception {
if (args.length != 1 || MasterGoalState.valueOf(args[0]) == null) {
System.err.println("Usage: accumulo " + SetGoalState.class.getName() + " [NORMAL|SAFE_MODE|CLEAN_STOP]");
System.exit(-1);
}
SecurityUtil.serverLogin();
FileSystem fs = FileUtil.getFileSystem(CachedConfiguration.getInstance(), ServerConfiguration.getSiteConfiguration());
Accumulo.waitForZookeeperAndHdfs(fs);
ZooReaderWriter.getInstance().putPersistentData(ZooUtil.getRoot(HdfsZooInstance.getInstance()) + Constants.ZMASTER_GOAL_STATE, args[0].getBytes(UTF_8),
NodeExistsPolicy.OVERWRITE);
}
代码示例来源:origin: org.apache.accumulo/accumulo-server
public static boolean setSystemProperty(String property, String value) throws KeeperException, InterruptedException {
Property p = Property.getPropertyByKey(property);
if ((p != null && !p.getType().isValidFormat(value)) || !Property.isValidZooPropertyKey(property))
return false;
// create the zk node for this property and set it's data to the specified value
String zPath = ZooUtil.getRoot(HdfsZooInstance.getInstance()) + Constants.ZCONFIG + "/" + property;
ZooReaderWriter.getInstance().putPersistentData(zPath, value.getBytes(UTF_8), NodeExistsPolicy.OVERWRITE);
return true;
}
本文整理了Java中org.apache.accumulo.server.zookeeper.ZooReaderWriter.putPersistentData()方法的一些代码示例,展示了ZooRe
本文整理了Java中org.apache.accumulo.fate.zookeeper.ZooReaderWriter.putPersistentData()方法的一些代码示例,展示了ZooRead
我是一名优秀的程序员,十分优秀!