EdColeman commented on code in PR #2569:
URL: https://github.com/apache/accumulo/pull/2569#discussion_r848495708
##########
server/base/src/main/java/org/apache/accumulo/server/conf/TableConfiguration.java:
##########
@@ -84,96 +73,54 @@ public TableConfiguration(ServerContext context, TableId
tableId, NamespaceConfi
newDeriver(conf -> createCompactionDispatcher(conf, context, tableId));
}
- void setZooCacheFactory(ZooCacheFactory zcf) {
- this.zcf = zcf;
- }
-
- private ZooCache getZooCache() {
- synchronized (propCaches) {
- PropCacheKey key = new PropCacheKey(context.getInstanceID(),
tableId.canonical());
- ZooCache propCache = propCaches.get(key);
- if (propCache == null) {
- propCache = zcf.getZooCache(context.getZooKeepers(),
context.getZooKeepersSessionTimeOut());
- propCaches.put(key, propCache);
- }
- return propCache;
- }
- }
-
- private ZooCachePropertyAccessor getPropCacheAccessor() {
- // updateAndGet below always calls compare and set, so avoid if not null
- ZooCachePropertyAccessor zcpa = propCacheAccessor.get();
- if (zcpa != null) {
- return zcpa;
+ @Override
+ public boolean isPropertySet(Property prop) {
+ if (_isPropertySet(prop)) {
+ return true;
}
- return propCacheAccessor
- .updateAndGet(pca -> pca == null ? new
ZooCachePropertyAccessor(getZooCache()) : pca);
- }
-
- private String getPath() {
- return context.getZooKeeperRoot() + Constants.ZTABLES + "/" + tableId +
Constants.ZTABLE_CONF;
+ return getParent().isPropertySet(prop);
}
- @Override
- public boolean isPropertySet(Property prop, boolean cacheAndWatch) {
- if (!cacheAndWatch) {
- throw new UnsupportedOperationException(
- "Table configuration only supports checking if a property is set in
cache.");
- }
-
- if (getPropCacheAccessor().isPropertySet(prop, getPath())) {
- return true;
+ private boolean _isPropertySet(Property property) {
+ Map<String,String> propMap = getSnapshot();
+ if (propMap == null) {
Review Comment:
Fixed in 3e0d3c94c8 - also added NonNull annotation.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]