/** * @param cctx Context. * @param tx Transaction. */ public GridNearOptimisticSerializableTxPrepareFuture(GridCacheSharedContext cctx, GridNearTxLocal tx) { super(cctx, tx); assert tx.optimistic() && tx.serializable() : tx; }
/** * @param cctx Context. * @param tx Transaction. */ public GridNearOptimisticTxPrepareFuture(GridCacheSharedContext cctx, GridNearTxLocal tx) { super(cctx, tx); assert tx.optimistic() && !tx.serializable() : tx; }
/** {@inheritDoc} */ @Override protected IgniteCacheExpiryPolicy accessPolicy( GridCacheContext ctx, IgniteTxKey key, @Nullable ExpiryPolicy expiryPlc ) { assert optimistic(); IgniteCacheExpiryPolicy plc = ctx.cache().expiryPolicy(expiryPlc); if (plc != null) { if (accessMap == null) accessMap = new HashMap<>(); accessMap.put(key, plc); } return plc; }
/** {@inheritDoc} */ @Override protected IgniteCacheExpiryPolicy accessPolicy(GridCacheContext cacheCtx, Collection<KeyCacheObject> keys) { assert optimistic(); if (accessMap != null) { for (Map.Entry<IgniteTxKey, IgniteCacheExpiryPolicy> e : accessMap.entrySet()) { if (e.getKey().cacheId() == cacheCtx.cacheId() && keys.contains(e.getKey().key())) return e.getValue(); } } return null; }
/** * @return {@code True} if 'fast finish' path can be used for transaction completion. */ private boolean fastFinish() { return !queryEnlisted() && writeMap().isEmpty() && ((optimistic() && !serializable()) || readMap().isEmpty()); }
/** * Checks filter for non-pessimistic transactions. * * @param cctx Cache context. * @param key Key. * @param val Value. * @param filter Filter to check. * @return {@code True} if passed or pessimistic. */ private boolean filter( GridCacheContext cctx, KeyCacheObject key, CacheObject val, CacheEntryPredicate[] filter) { return pessimistic() || (optimistic() && implicit()) || isAll(cctx, key, val, filter); }
log.debug("Loading missed values for missed map: " + missedMap); final boolean needReadVer = (serializable() && optimistic()) || needVer;
assert optimistic();
@Override public Object call() throws Exception { IgniteCache<Integer, String> cache = txIgniteNode.cache(DEFAULT_CACHE_NAME); assertNotNull(cache); TransactionProxyImpl tx = (TransactionProxyImpl)txIgniteNode.transactions().txStart(); GridNearTxLocal txEx = tx.tx(); assertTrue(txEx.optimistic()); cache.putAll(map); try { txEx.prepareNearTxLocal().get(3, TimeUnit.SECONDS); } catch (IgniteFutureTimeoutCheckedException ignored) { info("Failed to wait for prepare future completion: " + partial); } return null; } }).get();
assert tx != null; tx.writeMap().isEmpty(); assert tx.optimistic() || tx.readMap().isEmpty();
if (optimistic()) { fut = serializable() ? new GridNearOptimisticSerializableTxPrepareFuture(cctx, this) :
assert optimistic() : e;
assert !firstClientReq || tx.optimistic() : tx;
/** * @param cctx Context. * @param tx Transaction. */ protected GridNearOptimisticTxPrepareFutureAdapter(GridCacheSharedContext cctx, GridNearTxLocal tx) { super(cctx, tx); assert tx.optimistic() : tx; if (tx.timeout() > 0) { // Init keyLockFut to make sure it is created when {@link #onNearTxLocalTimeout} is called. for (IgniteTxEntry e : tx.writeEntries()) { if (e.context().isNear() || e.context().isLocal()) { keyLockFut = new KeyLockFuture(); break; } } if (tx.serializable() && keyLockFut == null) { for (IgniteTxEntry e : tx.readEntries()) { if (e.context().isNear() || e.context().isLocal()) { keyLockFut = new KeyLockFuture(); break; } } } if (keyLockFut != null) add((IgniteInternalFuture)keyLockFut); } }
IgniteCacheExpiryPolicy expiryPlc0 = optimistic() ? accessPolicy(cacheCtx, keys) : cacheCtx.cache().expiryPolicy(expiryPlc);
assert optimistic() || readCommitted() || skipVals;
boolean needReadVer = (serializable() && optimistic()) || needVer; assert optimistic() && repeatableRead() : this; optimistic() ? accessPolicy(cacheCtx, txKey, expiryPlc) : null;
GridCacheVersion readVer = null; if (optimistic() && !implicit()) { try { if (needReadVer) { if (optimistic() && serializable()) { txEntry = addEntry(op, old, assert optimistic() : txEntry; assert optimistic() : txEntry;
userPrepare((serializable() && optimistic()) ? F.concat(false, req.writes(), req.reads()) : req.writes());
assert prep != null || optimistic();