gpt4 book ai didi

org.apache.accumulo.fate.zookeeper.ZooCache.clear()方法的使用及代码示例

转载 作者:知者 更新时间:2024-03-14 01:47:31 27 4
gpt4 key购买 nike

本文整理了Java中org.apache.accumulo.fate.zookeeper.ZooCache.clear()方法的一些代码示例,展示了ZooCache.clear()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。ZooCache.clear()方法的具体详情如下:
包路径:org.apache.accumulo.fate.zookeeper.ZooCache
类名称:ZooCache
方法名:clear

ZooCache.clear介绍

[英]Clears this cache.
[中]清除此缓存。

代码示例

代码示例来源:origin: apache/accumulo

@Override
 protected void finalize() {
  if (zooCache != null)
   zooCache.clear();
 }
}

代码示例来源:origin: apache/accumulo

@Override
public void invalidateCache() {
 if (propCache != null)
  propCache.clear();
}

代码示例来源:origin: apache/accumulo

/**
 * Clears the internal {@link ZooCache}.
 */
void invalidateCache() {
 propCache.clear();
}

代码示例来源:origin: apache/accumulo

@Override
public void invalidateCache(String tserver) {
 zc.clear(root + "/" + tserver);
}

代码示例来源:origin: apache/accumulo

@Override
public void invalidateCache(ClientContext context, String server) {
 ZooCache zooCache = context.getZooCache();
 String root = context.getZooKeeperRoot() + Constants.ZTSERVERS;
 zooCache.clear(root + "/" + server);
}

代码示例来源:origin: apache/accumulo

/**
 * 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, Table.ID table, Set<TablePermission> perms)
  throws KeeperException, InterruptedException {
 synchronized (zooCache) {
  zooCache.clear();
  zoo.putPersistentData(ZKUserPath + "/" + user + ZKUserTablePerms + "/" + table,
    ZKSecurityTool.convertTablePermissions(perms), NodeExistsPolicy.FAIL);
 }
}

代码示例来源:origin: apache/accumulo

private void createUserNodeInZk(String principal) throws KeeperException, InterruptedException {
 synchronized (zooCache) {
  zooCache.clear();
  IZooReaderWriter zoo = context.getZooReaderWriter();
  zoo.putPrivatePersistentData(zkUserPath + "/" + principal, new byte[0],
    NodeExistsPolicy.FAIL);
 }
}

代码示例来源:origin: apache/accumulo

/**
 * 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, Namespace.ID namespace,
  Set<NamespacePermission> perms) throws KeeperException, InterruptedException {
 synchronized (zooCache) {
  zooCache.clear();
  zoo.putPersistentData(ZKUserPath + "/" + user + ZKUserNamespacePerms + "/" + namespace,
    ZKSecurityTool.convertNamespacePermissions(perms), NodeExistsPolicy.FAIL);
 }
}

代码示例来源:origin: apache/accumulo

/**
 * Sets up the user in ZK for the provided user. No checking for existence is done here, it should
 * be done before calling.
 */
private void constructUser(String user, byte[] pass)
  throws KeeperException, InterruptedException {
 synchronized (zooCache) {
  zooCache.clear();
  IZooReaderWriter zoo = context.getZooReaderWriter();
  zoo.putPrivatePersistentData(ZKUserPath + "/" + user, pass, NodeExistsPolicy.FAIL);
 }
}

代码示例来源:origin: apache/accumulo

/**
 * Clears the zoo cache from instance/root/{PATH}
 *
 * @param context
 *          The Accumulo client context
 * @param zooPath
 *          A zookeeper path
 */
public static void clearCacheByPath(ClientContext context, final String zooPath) {
 String thePath = zooPath.startsWith("/") ? zooPath : "/" + zooPath;
 getZooCache(context).clear(context.getZooKeeperRoot() + thePath);
 instanceToMapCache.invalidate(context.getInstanceID());
}

代码示例来源:origin: apache/accumulo

public static void clearCache(ClientContext context) {
 getZooCache(context).clear(context.getZooKeeperRoot() + Constants.ZTABLES);
 getZooCache(context).clear(context.getZooKeeperRoot() + Constants.ZNAMESPACES);
 instanceToMapCache.invalidate(context.getInstanceID());
}

代码示例来源:origin: apache/accumulo

@Override
public void cleanNamespacePermissions(String namespace) throws AccumuloSecurityException {
 try {
  synchronized (zooCache) {
   zooCache.clear();
   for (String user : zooCache.getChildren(ZKUserPath))
    zoo.recursiveDelete(ZKUserPath + "/" + user + ZKUserNamespacePerms + "/" + namespace,
      NodeMissingPolicy.SKIP);
  }
 } catch (KeeperException e) {
  log.error("{}", e.getMessage(), e);
  throw new AccumuloSecurityException("unknownUser", SecurityErrorCode.CONNECTION_ERROR, e);
 } catch (InterruptedException e) {
  log.error("{}", e.getMessage(), e);
  throw new RuntimeException(e);
 }
}

代码示例来源:origin: apache/accumulo

@Override
public void put(String path, byte[] bs) throws DistributedStoreException {
 try {
  path = relative(path);
  context.getZooReaderWriter().putPersistentData(path, bs, NodeExistsPolicy.OVERWRITE);
  cache.clear();
  log.debug("Wrote {} to {}", new String(bs, UTF_8), path);
 } catch (Exception ex) {
  throw new DistributedStoreException(ex);
 }
}

代码示例来源:origin: apache/accumulo

@Override
public void cleanTablePermissions(String table) throws AccumuloSecurityException {
 try {
  synchronized (zooCache) {
   zooCache.clear();
   for (String user : zooCache.getChildren(ZKUserPath))
    zoo.recursiveDelete(ZKUserPath + "/" + user + ZKUserTablePerms + "/" + table,
      NodeMissingPolicy.SKIP);
  }
 } catch (KeeperException e) {
  log.error("{}", e.getMessage(), e);
  throw new AccumuloSecurityException("unknownUser", SecurityErrorCode.CONNECTION_ERROR, e);
 } catch (InterruptedException e) {
  log.error("{}", e.getMessage(), e);
  throw new RuntimeException(e);
 }
}

代码示例来源:origin: apache/accumulo

@Override
public void changeAuthorizations(String user, Authorizations authorizations)
  throws AccumuloSecurityException {
 try {
  synchronized (zooCache) {
   zooCache.clear();
   context.getZooReaderWriter().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: apache/accumulo

@Override
public void dropUser(String user) throws AccumuloSecurityException {
 try {
  synchronized (zooCache) {
   IZooReaderWriter zoo = context.getZooReaderWriter();
   zoo.recursiveDelete(ZKUserPath + "/" + user + ZKUserAuths, NodeMissingPolicy.SKIP);
   zooCache.clear(ZKUserPath + "/" + user);
  }
 } catch (InterruptedException e) {
  log.error("{}", e.getMessage(), e);
  throw new RuntimeException(e);
 } catch (KeeperException e) {
  log.error("{}", e.getMessage(), e);
  if (e.code().equals(KeeperException.Code.NONODE))
   throw new AccumuloSecurityException(user, SecurityErrorCode.USER_DOESNT_EXIST, e);
  throw new AccumuloSecurityException(user, SecurityErrorCode.CONNECTION_ERROR, e);
 }
}

代码示例来源:origin: apache/accumulo

@Override
public void dropUser(String user) throws AccumuloSecurityException {
 try {
  synchronized (zooCache) {
   zooCache.clear();
   context.getZooReaderWriter().recursiveDelete(ZKUserPath + "/" + user,
     NodeMissingPolicy.FAIL);
  }
 } catch (InterruptedException e) {
  log.error("{}", e.getMessage(), e);
  throw new RuntimeException(e);
 } catch (KeeperException e) {
  if (e.code().equals(KeeperException.Code.NONODE)) {
   throw new AccumuloSecurityException(user, SecurityErrorCode.USER_DOESNT_EXIST, e);
  }
  log.error("{}", e.getMessage(), e);
  throw new AccumuloSecurityException(user, SecurityErrorCode.CONNECTION_ERROR, e);
 }
}

代码示例来源:origin: apache/accumulo

@Override
 public void remove(String path) throws DistributedStoreException {
  try {
   log.debug("Removing {}", path);
   path = relative(path);
   IZooReaderWriter zoo = context.getZooReaderWriter();
   if (zoo.exists(path))
    zoo.recursiveDelete(path, NodeMissingPolicy.SKIP);
   cache.clear();
  } catch (Exception ex) {
   throw new DistributedStoreException(ex);
  }
 }
}

代码示例来源:origin: apache/accumulo

@Override
public void cleanUser(String user) throws AccumuloSecurityException {
 try {
  synchronized (zooCache) {
   zoo.recursiveDelete(ZKUserPath + "/" + user + ZKUserSysPerms, NodeMissingPolicy.SKIP);
   zoo.recursiveDelete(ZKUserPath + "/" + user + ZKUserTablePerms, NodeMissingPolicy.SKIP);
   zoo.recursiveDelete(ZKUserPath + "/" + user + ZKUserNamespacePerms, NodeMissingPolicy.SKIP);
   zooCache.clear(ZKUserPath + "/" + user);
  }
 } catch (InterruptedException e) {
  log.error("{}", e.getMessage(), e);
  throw new RuntimeException(e);
 } catch (KeeperException e) {
  log.error("{}", e.getMessage(), e);
  if (e.code().equals(KeeperException.Code.NONODE))
   throw new AccumuloSecurityException(user, SecurityErrorCode.USER_DOESNT_EXIST, e);
  throw new AccumuloSecurityException(user, SecurityErrorCode.CONNECTION_ERROR, e);
 }
}

代码示例来源:origin: apache/accumulo

@Override
public boolean authenticateUser(String principal, AuthenticationToken token)
  throws AccumuloSecurityException {
 if (!(token instanceof PasswordToken))
  throw new AccumuloSecurityException(principal, SecurityErrorCode.INVALID_TOKEN);
 PasswordToken pt = (PasswordToken) token;
 byte[] pass;
 String zpath = ZKUserPath + "/" + principal;
 pass = zooCache.get(zpath);
 boolean result = ZKSecurityTool.checkPass(pt.getPassword(), pass);
 if (!result) {
  zooCache.clear(zpath);
  pass = zooCache.get(zpath);
  result = ZKSecurityTool.checkPass(pt.getPassword(), pass);
 }
 return result;
}

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com