Ejemplo n.º 1
0
  /**
   * @param cctx Context.
   * @param id Partition ID.
   */
  @SuppressWarnings("ExternalizableWithoutPublicNoArgConstructor")
  GridDhtLocalPartition(GridCacheContext cctx, int id) {
    assert cctx != null;

    this.id = id;
    this.cctx = cctx;

    log = U.logger(cctx.kernalContext(), logRef, this);

    rent =
        new GridFutureAdapter<Object>() {
          @Override
          public String toString() {
            return "PartitionRentFuture [part=" + GridDhtLocalPartition.this + ", map=" + map + ']';
          }
        };

    map = new ConcurrentHashMap8<>(cctx.config().getStartSize() / cctx.affinity().partitions());

    int delQueueSize =
        CU.isSystemCache(cctx.name())
            ? 100
            : Math.max(MAX_DELETE_QUEUE_SIZE / cctx.affinity().partitions(), 20);

    rmvQueue = new GridCircularBuffer<>(U.ceilPow2(delQueueSize));
  }
  /**
   * @param cctx Context.
   * @param keys Keys.
   * @param topVer Topology version.
   * @param readThrough Read through flag.
   * @param forcePrimary If {@code true} then will force network trip to primary node even if called
   *     on backup node.
   * @param subjId Subject ID.
   * @param taskName Task name.
   * @param deserializeBinary Deserialize binary flag.
   * @param expiryPlc Expiry policy.
   * @param skipVals Skip values flag.
   * @param canRemap Flag indicating whether future can be remapped on a newer topology version.
   * @param needVer If {@code true} returns values as tuples containing value and version.
   * @param keepCacheObjects Keep cache objects flag.
   */
  public GridPartitionedGetFuture(
      GridCacheContext<K, V> cctx,
      Collection<KeyCacheObject> keys,
      AffinityTopologyVersion topVer,
      boolean readThrough,
      boolean forcePrimary,
      @Nullable UUID subjId,
      String taskName,
      boolean deserializeBinary,
      @Nullable IgniteCacheExpiryPolicy expiryPlc,
      boolean skipVals,
      boolean canRemap,
      boolean needVer,
      boolean keepCacheObjects) {
    super(
        cctx,
        keys,
        readThrough,
        forcePrimary,
        subjId,
        taskName,
        deserializeBinary,
        expiryPlc,
        skipVals,
        canRemap,
        needVer,
        keepCacheObjects);

    this.topVer = topVer;

    if (log == null) log = U.logger(cctx.kernalContext(), logRef, GridPartitionedGetFuture.class);
  }
Ejemplo n.º 3
0
  /** @param cctx Cache context. */
  public GridCacheMvcc(GridCacheContext<?, ?> cctx) {
    assert cctx != null;

    this.cctx = cctx;

    if (log == null) log = U.logger(cctx.kernalContext(), logRef, GridCacheMvcc.class);
  }
Ejemplo n.º 4
0
  /**
   * @param cctx Context.
   * @param tx Transaction.
   * @param commit Commit flag.
   */
  public GridNearTxFinishFuture(
      GridCacheSharedContext<K, V> cctx, GridNearTxLocal tx, boolean commit) {
    super(F.<IgniteInternalTx>identityReducer(tx));

    this.cctx = cctx;
    this.tx = tx;
    this.commit = commit;

    ignoreInterrupts(true);

    mappings = tx.mappings();

    futId = IgniteUuid.randomUuid();

    if (log == null) log = U.logger(cctx.kernalContext(), logRef, GridNearTxFinishFuture.class);
  }
Ejemplo n.º 5
0
  /**
   * @param cctx Context.
   * @param tx Transaction.
   * @param commit Commit flag.
   */
  public GridDhtTxFinishFuture(
      GridCacheSharedContext<K, V> cctx, GridDhtTxLocalAdapter tx, boolean commit) {
    super(F.<IgniteInternalTx>identityReducer(tx));

    this.cctx = cctx;
    this.tx = tx;
    this.commit = commit;

    dhtMap = tx.dhtMap();
    nearMap = tx.nearMap();

    futId = IgniteUuid.randomUuid();

    if (log == null) {
      msgLog = cctx.txFinishMessageLogger();
      log = U.logger(cctx.kernalContext(), logRef, GridDhtTxFinishFuture.class);
    }
  }
  /**
   * @param cctx Cache context.
   * @param completionCb Callback to invoke when future is completed.
   * @param writeVer Write version.
   * @param updateReq Update request.
   * @param updateRes Update response.
   */
  public GridDhtAtomicUpdateFuture(
      GridCacheContext cctx,
      CI2<GridNearAtomicUpdateRequest, GridNearAtomicUpdateResponse> completionCb,
      GridCacheVersion writeVer,
      GridNearAtomicUpdateRequest updateReq,
      GridNearAtomicUpdateResponse updateRes) {
    this.cctx = cctx;
    this.writeVer = writeVer;

    futVer = cctx.versions().next(updateReq.topologyVersion());
    this.updateReq = updateReq;
    this.completionCb = completionCb;
    this.updateRes = updateRes;

    if (log == null) log = U.logger(cctx.kernalContext(), logRef, GridDhtAtomicUpdateFuture.class);

    keys = new ArrayList<>(updateReq.keys().size());
    mappings = U.newHashMap(updateReq.keys().size());

    boolean topLocked =
        updateReq.topologyLocked() || (updateReq.fastMap() && !updateReq.clientRequest());

    waitForExchange = !topLocked;
  }