accumulo-notifications mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Mike Drob (JIRA)" <j...@apache.org>
Subject [jira] [Created] (ACCUMULO-2894) MultiTableBatchWriter.getBatchWriter has dubious loop condition
Date Wed, 11 Jun 2014 21:16:05 GMT
Mike Drob created ACCUMULO-2894:
-----------------------------------

             Summary: MultiTableBatchWriter.getBatchWriter has dubious loop condition
                 Key: ACCUMULO-2894
                 URL: https://issues.apache.org/jira/browse/ACCUMULO-2894
             Project: Accumulo
          Issue Type: Improvement
          Components: client
    Affects Versions: 1.6.0
            Reporter: Mike Drob


This while loop could use a variable instead of multiple break and continue labels.
{code}
    while (true) {
      long cacheResetCount = Tables.getCacheResetCount();

      // cacheResetCount could change after this point in time, but I think thats ok because
just want to ensure this methods sees changes
      // made before it was called.
      
      long internalResetCount = cacheLastState.get();

      if (cacheResetCount > internalResetCount) {
        if (!cacheLastState.compareAndSet(internalResetCount, cacheResetCount)) {
          continue; // concurrent operation, lets not possibly move cacheLastState backwards
in the case where a thread pauses for along time
        }

        nameToIdCache.invalidateAll();
        break;
      }

      break;
    }
{code}



--
This message was sent by Atlassian JIRA
(v6.2#6252)

Mime
View raw message