Example #1
0
  /**
   * @param ctx Cache registry.
   * @param implicit Implicit flag.
   * @param implicitSingle Implicit with one key flag.
   * @param concurrency Concurrency.
   * @param isolation Isolation.
   * @param timeout Timeout.
   * @param invalidate Invalidation policy.
   * @param syncCommit Synchronous commit flag.
   * @param syncRollback Synchronous rollback flag.
   * @param swapEnabled Whether to use swap storage.
   * @param storeEnabled Whether to use read/write through.
   */
  GridNearTxLocal(
      GridCacheContext<K, V> ctx,
      boolean implicit,
      boolean implicitSingle,
      GridCacheTxConcurrency concurrency,
      GridCacheTxIsolation isolation,
      long timeout,
      boolean invalidate,
      boolean syncCommit,
      boolean syncRollback,
      boolean swapEnabled,
      boolean storeEnabled) {
    super(
        ctx,
        ctx.versions().next(),
        implicit,
        implicitSingle,
        concurrency,
        isolation,
        timeout,
        invalidate,
        swapEnabled,
        storeEnabled);

    assert ctx != null;

    this.syncCommit = syncCommit;
    this.syncRollback = syncRollback;
  }
Example #2
0
  /**
   * @param cctx Registry.
   * @param keys Keys to lock.
   * @param tx Transaction.
   * @param read Read flag.
   * @param retval Flag to return value or not.
   * @param timeout Lock acquisition timeout.
   * @param filter Filter.
   */
  public GridNearLockFuture(
      GridCacheContext<K, V> cctx,
      Collection<? extends K> keys,
      @Nullable GridNearTxLocal<K, V> tx,
      boolean read,
      boolean retval,
      long timeout,
      GridPredicate<GridCacheEntry<K, V>>[] filter) {
    super(cctx.kernalContext(), CU.boolReducer());
    assert cctx != null;
    assert keys != null;

    this.cctx = cctx;
    this.keys = keys;
    this.tx = tx;
    this.read = read;
    this.retval = retval;
    this.timeout = timeout;
    this.filter = filter;

    threadId = tx == null ? Thread.currentThread().getId() : tx.threadId();

    lockVer = tx != null ? tx.xidVersion() : cctx.versions().next();

    futId = GridUuid.randomUuid();

    entries = new ArrayList<>(keys.size());

    log = U.logger(ctx, logRef, GridNearLockFuture.class);

    if (timeout > 0) {
      timeoutObj = new LockTimeoutObject();

      cctx.time().addTimeoutObject(timeoutObj);
    }

    valMap = new ConcurrentHashMap8<>(keys.size(), 1f);
  }