Ejemplo n.º 1
0
  /**
   * This method has poor performance, so use with care. It is currently only used by {@code DGC}.
   *
   * @return Remote candidates.
   */
  public Collection<GridCacheMvccCandidate> remoteCandidates() {
    Collection<GridCacheMvccCandidate> rmtCands = new LinkedList<>();

    for (GridDistributedCacheEntry entry : locked()) rmtCands.addAll(entry.remoteMvccSnapshot());

    return rmtCands;
  }
Ejemplo n.º 2
0
  /**
   * This method has poor performance, so use with care. It is currently only used by {@code DGC}.
   *
   * @return Local candidates.
   */
  public Collection<GridCacheMvccCandidate> localCandidates() {
    Collection<GridCacheMvccCandidate> locCands = new LinkedList<>();

    for (GridDistributedCacheEntry entry : locked()) {
      try {
        locCands.addAll(entry.localCandidates());
      } catch (GridCacheEntryRemovedException ignore) {
        // No-op.
      }
    }

    return locCands;
  }
Ejemplo n.º 3
0
  /**
   * @param leftNodeId Left node ID.
   * @param topVer Topology version.
   */
  public void removeExplicitNodeLocks(UUID leftNodeId, AffinityTopologyVersion topVer) {
    for (GridDistributedCacheEntry entry : locked()) {
      try {
        entry.removeExplicitNodeLocks(leftNodeId);

        entry.context().evicts().touch(entry, topVer);
      } catch (GridCacheEntryRemovedException ignore) {
        if (log.isDebugEnabled())
          log.debug(
              "Attempted to remove node locks from removed entry in mvcc manager "
                  + "disco callback (will ignore): "
                  + entry);
      }
    }
  }
Ejemplo n.º 4
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()));
        }
      }
    }
  }
Ejemplo n.º 5
0
 /** {@inheritDoc} */
 @Override
 public void onFreed(GridDistributedCacheEntry entry) {
   if (entry.isNear()) nearLocked.remove(entry.txKey());
   else locked.remove(entry.txKey());
 }
Ejemplo n.º 6
0
 /** {@inheritDoc} */
 @Override
 public void onLocked(GridDistributedCacheEntry entry) {
   if (entry.isNear()) nearLocked.put(entry.txKey(), entry);
   else locked.put(entry.txKey(), entry);
 }