Exemplo n.º 1
0
  /** {@inheritDoc} */
  @Override
  protected void updateExplicitVersion(IgniteTxEntry txEntry, GridCacheEntryEx entry)
      throws GridCacheEntryRemovedException {
    if (entry.detached()) {
      GridCacheMvccCandidate cand = cctx.mvcc().explicitLock(threadId(), entry.txKey());

      if (cand != null && !xidVersion().equals(cand.version())) {
        GridCacheVersion candVer = cand.version();

        txEntry.explicitVersion(candVer);

        if (candVer.isLess(minVer)) minVer = candVer;
      }
    } else super.updateExplicitVersion(txEntry, entry);
  }
Exemplo n.º 2
0
  /**
   * @param entries Entries.
   * @param dhtVer DHT version.
   * @param pendingVers Pending versions.
   * @param committedVers Committed versions.
   * @param rolledbackVers Rolled back versions.
   */
  void readyNearLocks(
      Collection<IgniteTxEntry> entries,
      GridCacheVersion dhtVer,
      Collection<GridCacheVersion> pendingVers,
      Collection<GridCacheVersion> committedVers,
      Collection<GridCacheVersion> rolledbackVers) {
    for (IgniteTxEntry txEntry : entries) {
      while (true) {
        GridCacheContext cacheCtx = txEntry.cached().context();

        assert cacheCtx.isNear();

        GridDistributedCacheEntry entry = (GridDistributedCacheEntry) txEntry.cached();

        try {
          // Handle explicit locks.
          GridCacheVersion explicit = txEntry.explicitVersion();

          if (explicit == null) {
            entry.readyNearLock(xidVer, dhtVer, committedVers, rolledbackVers, pendingVers);
          }

          break;
        } catch (GridCacheEntryRemovedException ignored) {
          assert entry.obsoleteVersion() != null;

          if (log.isDebugEnabled())
            log.debug(
                "Replacing obsolete entry in remote transaction [entry="
                    + entry
                    + ", tx="
                    + this
                    + ']');

          // Replace the entry.
          txEntry.cached(txEntry.context().cache().entryEx(txEntry.key()));
        }
      }
    }
  }