public void resolveConflict(Transaction me, Transaction other) {
    long transferred = 0;
    ContentionManager otherManager = other.getContentionManager();
    for (int attempts = 0; ; attempts++) {
      long otherPriority = otherManager.getPriority();
      long delta = otherPriority - priority;
      if (delta < 0 || attempts > delta * delta) {
        transferred = 0;
        other.abort();
        return;
      }
      // Unsafe increment, but too expensive to synchronize.
      if (priority > transferred) {
        otherManager.setPriority(otherPriority + priority - transferred);
        transferred = priority;
      }
      if (attempts < delta) {
        sleep(SLEEP_PERIOD);
      }
    }
  }