accumulo-notifications mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From GitBox <...@apache.org>
Subject [GitHub] [accumulo] ctubbsii commented on a change in pull request #1201: fix #1123 replace observing config with continual derivation
Date Thu, 13 Jun 2019 04:29:24 GMT
ctubbsii commented on a change in pull request #1201: fix #1123 replace observing config with
continual derivation
URL: https://github.com/apache/accumulo/pull/1201#discussion_r293196784
 
 

 ##########
 File path: core/src/main/java/org/apache/accumulo/core/conf/AccumuloConfiguration.java
 ##########
 @@ -435,6 +438,60 @@ Integer getDeprecatedScanThreads(String name) {
     return null;
   }
 
+  private static class RefCount<T> {
+    T obj;
+    long count;
+
+    RefCount(long c, T r) {
+      this.count = c;
+      this.obj = r;
+    }
+  }
+
+  private class Deriver<T> implements Supplier<T> {
+
+    private AtomicReference<RefCount<T>> refref;
+    private Function<AccumuloConfiguration,T> factory;
+
+    Deriver(Function<AccumuloConfiguration,T> factory) {
+      this.factory = factory;
+      refref = new AtomicReference<>();
+    }
+
+    @Override
+    public T get() {
+      RefCount<T> rc = refref.get();
 
 Review comment:
   An inline comment in here somewhere, which explains what this method is supposed to do
would be helpful to future readers. Something like:
   ```java
     // check if the configuration changed; if no, return the previous object, otherwise regenerate
and return that
   ```

----------------------------------------------------------------
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.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

Mime
View raw message