Accumulo
  1. Accumulo
  2. ACCUMULO-2894

MultiTableBatchWriter.getBatchWriter has dubious loop condition

    Details

    • Type: Improvement Improvement
    • Status: Open
    • Priority: Major Major
    • Resolution: Unresolved
    • Affects Version/s: 1.6.0
    • Fix Version/s: None
    • Component/s: client
    • Labels:
      None

      Description

      This while loop could use a variable instead of multiple break and continue labels.

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

        Activity

        Mike Drob created issue -

          People

          • Assignee:
            Unassigned
            Reporter:
            Mike Drob
          • Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

            • Created:
              Updated:

              Development