Exemple #1
0
  private byte[] getInternal(Tier tier, long hashCode) {
    byte[] existingData;

    /**
     * Need SPIN to retrieve data from the underlying array because the index might have changed
     * with the _split.
     */

    // Map key to an array index
    int index = tier.getMainIndex(hashCode, _level, _split);

    do {
      // Read existing data at the index
      existingData = _dataArray.get(index);

      // Check that key is still mapped to the known index
      int indexNew = tier.getMainIndex(hashCode, _level, _split);
      if (indexNew == index) break;
      index = indexNew;
    } while (true);

    return existingData;
  }