/** {@inheritDoc} */ @SuppressWarnings({"RedundantTypeArguments"}) @Nullable @Override public GridTuple<V> peek(boolean failFast, K key, GridPredicate<GridCacheEntry<K, V>>[] filter) throws GridCacheFilterFailedException { GridCacheTxEntry<K, V> e = txMap == null ? null : txMap.get(key); if (e != null) { // We should look at tx entry previous value. If this is a user peek then previous // value is the same as value. If this is a filter evaluation peek then previous value holds // value visible to filter while value contains value enlisted for write. if (!F.isAll(e.cached().wrap(false), filter)) return e.hasPreviousValue() ? F.t(CU.<V>failed(failFast, e.previousValue())) : null; return e.hasPreviousValue() ? F.t(e.previousValue()) : null; } return null; }
/** * @param failFast Fail fast flag. * @param filter Filter. * @return Value from persistent store. * @throws GridException In case of any errors. * @throws GridCacheFilterFailedException If filter failed. */ @SuppressWarnings({"unchecked"}) @Nullable private V peekDb(boolean failFast, GridPredicate<GridCacheEntry<K, V>>[] filter) throws GridException, GridCacheFilterFailedException { if (!cctx.isAll(wrap(false), filter)) return CU.failed(failFast); synchronized (this) { if (checkExpired()) return null; } return cctx.store().loadFromStore(cctx.tm().localTxx(), key); }
/** * @param failFast Fail fast flag. * @param filter Filter. * @return Value from swap storage. * @throws GridException In case of any errors. * @throws GridCacheFilterFailedException If filter failed. */ @SuppressWarnings({"unchecked"}) @Nullable private GridTuple<V> peekSwap(boolean failFast, GridPredicate<GridCacheEntry<K, V>>[] filter) throws GridException, GridCacheFilterFailedException { if (!cctx.isAll(wrap(false), filter)) return F.t((V)CU.failed(failFast)); synchronized (this) { if (checkExpired()) return null; } GridCacheSwapEntry<V> e = cctx.swap().read(this, false); return e != null ? F.t(e.value()) : null; }
return F.t(CU.<V>failed(failFast));