DomGarguilo commented on PR #5338:
URL: https://github.com/apache/accumulo/pull/5338#issuecomment-2660436373

   I had the same thought and tried this on a earlier iteration. The problem
   is the flag would be true before clear() is called.
   
   On Fri, Feb 14, 2025 at 5:55 PM Christopher L. Shannon <
   ***@***.***> wrote:
   
   > ***@***.**** commented on this pull request.
   > ------------------------------
   >
   > In core/src/main/java/org/apache/accumulo/core/zookeeper/ZooCache.java
   > <https://github.com/apache/accumulo/pull/5338#discussion_r1956802654>:
   >
   > >      nodeCache.clear();
   >      updateCount.incrementAndGet();
   >      log.trace("{} cleared all from cache", cacheId);
   >    }
   >
   >    public void close() {
   > +    if (closed) {
   >
   > Changes here are fine, but I was wondering if it would be better to use a
   > final AtomicBoolean for the closed flag instead of a volatile. The atomic
   > classes are really nice for use cases like this. You could then do
   > something like:
   >
   > public void close() {
   > if (closed.compareAndSet(false, true)) {
   > clear();
   > }
   > }
   >
   > —
   > Reply to this email directly, view it on GitHub
   > 
<https://github.com/apache/accumulo/pull/5338#pullrequestreview-2618950822>,
   > or unsubscribe
   > 
<https://github.com/notifications/unsubscribe-auth/ALMD2IMYWBNIXAV7TKVLANL2PZXX7AVCNFSM6AAAAABXFH67GKVHI2DSMVQWIX3LMV43YUDVNRWFEZLROVSXG5CSMV3GSZLXHMZDMMJYHE2TAOBSGI>
   > .
   > You are receiving this because you were assigned.Message ID:
   > ***@***.***>
   >
   


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

Reply via email to