HarshMehta112 commented on issue #9084:
URL: https://github.com/apache/gravitino/issues/9084#issuecomment-3520047562

   @justinmclean Good catch — you’re right that the current implementation sets 
the flag before running runnable.run(), which means it could remain true even 
if the load fails. It also changes the flag’s meaning from “has loaded” to “has 
started loading.”
   
   Can we do it like 
   ```
    if (!hasLoadRole.compareAndSet(false, true)) {
       return;
     }
     try {
       runnable.run();
     } catch (Exception e) {
       hasLoadRole.set(false); // Reset flag if loading fails
       throw e;
     }
   ```
   This ensures the flag still means “has loaded” and handles failure cases 
correctly.


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