dlmarion commented on code in PR #3437:
URL: https://github.com/apache/accumulo/pull/3437#discussion_r1210280220
##########
server/manager/src/main/java/org/apache/accumulo/manager/ManagerClientServiceHandler.java:
##########
@@ -89,13 +93,22 @@
import org.apache.zookeeper.KeeperException.NoNodeException;
import org.slf4j.Logger;
+import com.github.benmanes.caffeine.cache.Cache;
+import com.github.benmanes.caffeine.cache.Caffeine;
+import com.github.benmanes.caffeine.cache.Weigher;
+
public class ManagerClientServiceHandler implements ManagerClientService.Iface
{
private static final Logger log = Manager.log;
private final Manager manager;
+ private final Cache<KeyExtent,Long> recentHostingRequest;
+
protected ManagerClientServiceHandler(Manager manager) {
this.manager = manager;
+ Weigher<KeyExtent,Long> weigher = (extent, t) -> Splitter.weigh(extent) +
8;
+ this.recentHostingRequest = Caffeine.newBuilder().expireAfterWrite(1,
TimeUnit.MINUTES)
+ .maximumWeight(10_000_000L).weigher(weigher).build();
Review Comment:
Ok, I wasn't sure what the Weigher and maxWeight meant. I think it would be
more clear if we did something like:
```
private static final long TEN_MB = 10 * 1024 * 1024;
```
and then use TEN_MB as the method parameter.
--
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]