bdeggleston commented on code in PR #2144:
URL: https://github.com/apache/cassandra/pull/2144#discussion_r1128772547


##########
src/java/org/apache/cassandra/service/accord/AccordStateCache.java:
##########
@@ -149,17 +147,12 @@ public NamedMap(String name)
         }
     }
 
-    public final Map<Object, Node<?, ?>> active = new HashMap<>();
     private final Map<Object, Node<?, ?>> cache = new HashMap<>();
-    private final Map<Object, WriteOnlyGroup<?, ?>> pendingWriteOnly = new 
HashMap<>();
-    private final Set<Instance<?, ?>> instances = new HashSet<>();
+    private final Set<Instance<?, ?, ?>> instances = new HashSet<>();
 
-    private final NamedMap<Object, Future<?>> loadFutures = new 
NamedMap<>("loadFutures");
-    private final NamedMap<Object, Future<?>> saveFutures = new 
NamedMap<>("saveFutures");
-
-    private final NamedMap<Object, Future<Data>> readFutures = new 
NamedMap<>("readFutures");
-    private final NamedMap<Object, Future<?>> writeFutures = new 
NamedMap<>("writeFutures");
+    private final NamedMap<Object, AsyncResult<Void>> saveResults = new 
NamedMap<>("saveResults");
 
+    private int unreferenced = 0;
     Node<?, ?> head;

Review Comment:
   > Why don't you like inverting the inheritance order?
   
   Because Node is an implementation detail of the cache, and not the logical 
ancestor of accord state objects.
   
   > It's also more idiomatic, so it's less surprising to a reader familiar 
with such lists.
   
   I’d disagree with that. Having explicit head/tail pointers on the list 
container is _much_ more idiomatic than a container also being a dummy node. 
You could argue that this does put head/tail fields on the container, but it’s 
not nearly as straightforward or easy to identify. It does enable cleaner list 
manipulation methods, but is not the least surprising approach. 
   
   It also breaks the idiomatic linked list traversal pattern, and creates a 
special node you need to be aware of.



-- 
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]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to