コード例 #1
0
 private boolean eventuallyGetMaxKeyInDB(final FDate key, final boolean force) {
   // not updating highest allowed key, since this already happened during key adjustment
   final FDate newMaxKeyInDB = getAdjustKeyProvider().getHighestAllowedKey();
   if (newMaxKeyInDB != null) {
     if (newMaxKeyInDB.isAfter(maxKeyInDB)) {
       maxKeyInDB = newMaxKeyInDB;
       return true;
     } else {
       return false;
     }
   }
   // fallback to normal procedure if curHighWaterMark is not provided by provider
   if (maxKeyInDB == null || force) {
     final V maxValue = readNewestValueFromDB(maxKey());
     if (maxValue != null) {
       final FDate maxValueKey = extractKey(key, maxValue);
       if (maxKeyInDB == null || maxValueKey.compareTo(maxKeyInDB) <= -1) {
         maxKeyInDB = maxValueKey;
         getValuesMap().put(maxValueKey, maxValue);
         return true;
       }
     }
   }
   return false;
 }
コード例 #2
0
  private boolean isPotentiallyAlreadyEvicted(final FDate key, final V value) {
    final boolean isEvictedBeforeCurrentFurtherValues =
        (value == null || extractKey(key, value).isAfter(key))
            && (key.isAfter(minKeyInDB) || key.isAfter(minKeyInDBFromLoadFurtherValues));
    if (isEvictedBeforeCurrentFurtherValues) {
      return true;
    }
    final boolean mightBeEvictedAfterFurtherValues = value != null && furtherValues.isEmpty();
    if (mightBeEvictedAfterFurtherValues) {
      final FDate valueKey = extractKey(key, value);
      final boolean isEvictedAfterCurrentFurtherValues =
          valueKey.isBefore(key) && valueKey.isBeforeOrEqualTo(maxKeyInDB);
      if (isEvictedAfterCurrentFurtherValues) {
        return true;
      }
    }

    return false;
  }