@Override
  public void nextValue(RowKey key, IntegralDataTypeHolder value, int increment, int initialValue) {
    final AdvancedCache<RowKey, Object> identifierCache =
        provider.getCache(IDENTIFIER_STORE).getAdvancedCache();
    boolean done = false;
    do {
      // read value
      // skip locking proposed by Sanne
      Object valueFromDb = identifierCache.withFlags(Flag.SKIP_LOCKING).get(key);
      if (valueFromDb == null) {
        // if not there, insert initial value
        value.initialize(initialValue);
        // TODO should we use GridTypes here?
        valueFromDb = new Long(value.makeValue().longValue());
        final Object oldValue = identifierCache.putIfAbsent(key, valueFromDb);
        // check in case somebody has inserted it behind our back
        if (oldValue != null) {
          value.initialize(((Number) oldValue).longValue());
          valueFromDb = oldValue;
        }
      } else {
        // read the value from the table
        value.initialize(((Number) valueFromDb).longValue());
      }

      // update value
      final IntegralDataTypeHolder updateValue = value.copy();
      // increment value
      updateValue.add(increment);
      // TODO should we use GridTypes here?
      final Object newValueFromDb = updateValue.makeValue().longValue();
      done = identifierCache.replace(key, valueFromDb, newValueFromDb);
    } while (!done);
  }
 @Override
 public void nextValue(RowKey key, IntegralDataTypeHolder value, int increment, int initialValue) {
   value.initialize(getDataStore().nextValue(key, increment, initialValue));
 }