/** {@inheritDoc} */ @Override public R call() throws Exception { return cache().unwrap(clazz); } }
/** * @param cache Cache. * @return Affinity. */ public static <K> Affinity<K> affinity(IgniteCache<K, ?> cache) { return cache.unwrap(Ignite.class).affinity(cache.getName()); }
/** * @param cache Cache. * @return Local node. */ public static ClusterNode localNode(IgniteCache<?, ?> cache) { return cache.unwrap(Ignite.class).cluster().localNode(); }
@Override public void apply(Integer key, IgniteCache<Object, Object> cache) { Map<Integer, Integer> map = new HashMap<>(); for (int i = 0; i < 50; i++) map.put(i, i); map.put(key, key); Ignite ignite = cache.unwrap(Ignite.class); try (Transaction tx = ignite.transactions().txStart(concurrency, isolation)) { cache.putAll(map); tx.commit(); } } });
/** * @param cache Cache. * @return Cache. */ protected static <K, V> GridCacheAdapter<K, V> internalCache0(IgniteCache<K, V> cache) { if (isMultiJvmObject(cache)) throw new UnsupportedOperationException("Operation can't be supported automatically for multi jvm " + "(send closure instead)."); return ((IgniteKernal)cache.unwrap(Ignite.class)).internalCache(cache.getName()); }
@Override public void apply(IgniteCache<Object, Object> cache) { final IgniteTransactions txs = cache.unwrap(Ignite.class).transactions(); Map<Integer, Integer> vals = new LinkedHashMap<>(); for (int i = 0; i < TOTAL; i++) vals.put(i, N); try (Transaction tx = txs.txStart(PESSIMISTIC, REPEATABLE_READ)) { writeAllByMode(cache, vals, writeMode, INTEGER_CODEC); tx.commit(); } } };
@Override public void apply(IgniteCache<Object, Object> cache) { final IgniteTransactions txs = cache.unwrap(Ignite.class).transactions(); Map<Integer, MvccTestAccount> accounts = new HashMap<>(); for (int i = 0; i < ACCOUNTS; i++) accounts.put(i, new MvccTestAccount(ACCOUNT_START_VAL, 1)); try (Transaction tx = txs.txStart(PESSIMISTIC, REPEATABLE_READ)) { cache.putAll(accounts); tx.commit(); } } };
/** * @param cache Cache. * @return Cache context. */ public static <K, V> GridCacheContext<K, V> cacheContext(IgniteCache<K, V> cache) { return ((IgniteKernal)cache.unwrap(Ignite.class)).<K, V>internalCache(cache.getName()).context(); }
@Override public void apply(Integer key, IgniteCache<Object, Object> cache) { Ignite ignite = cache.unwrap(Ignite.class); try (Transaction tx = ignite.transactions().txStart(concurrency, isolation)) { cache.put(key, key); tx.commit(); } } });
/** * @param cache Cache. * @return Near cache. */ protected static <K, V> GridNearCacheAdapter<K, V> near(IgniteCache<K, V> cache) { return ((IgniteKernal)cache.unwrap(Ignite.class)).<K, V>internalCache(cache.getName()).context().near(); }
/** * @param cache Cache. */ protected <K, V> GridCacheAdapter<K, V> cacheFromCtx(IgniteCache<K, V> cache) { return ((IgniteKernal)cache.unwrap(Ignite.class)).<K, V>internalCache(cache.getName()).context().cache(); }
/** * @param cache Cache. * @return Colocated cache. */ protected static <K, V> GridDhtColocatedCache<K, V> colocated(IgniteCache<K, V> cache) { return ((IgniteKernal)cache.unwrap(Ignite.class)).<K, V>internalCache(cache.getName()).context().colocated(); }
@Override public void apply(Integer key, IgniteCache<Object, Object> cache) { Ignite ignite = cache.unwrap(Ignite.class); try (Transaction tx = ignite.transactions().txStart(concurrency, isolation)) { cache.put(key, key); tx.commit(); } } });
@Override public void apply(Integer key, IgniteCache<Object, Object> cache) { Ignite ignite = cache.unwrap(Ignite.class); try (Transaction tx = ignite.transactions().txStart(concurrency, isolation)) { cache.put(key, key); tx.commit(); } } });
@Override public void apply(Integer key, IgniteCache<Object, Object> cache) { Ignite ignite = cache.unwrap(Ignite.class); try (Transaction tx = ignite.transactions().txStart(concurrency, isolation)) { cache.put(key, key); tx.commit(); } } });
@Override public void apply(Integer key, IgniteCache<Object, Object> cache) { Ignite ignite = cache.unwrap(Ignite.class); try (Transaction tx = ignite.transactions().txStart(concurrency, isolation)) { cache.put(key, key); tx.commit(); } } });
/** {@inheritDoc} */ @Override protected void beforeTest() throws Exception { assert jcache().unwrap(Ignite.class).transactions().tx() == null; assertEquals(0, jcache().localSize()); }
/** * @param cache Cache. * @return DHT cache. */ protected static <K, V> GridDhtCacheAdapter<K, V> dht(IgniteCache<K, V> cache) { return nearEnabled(cache) ? near(cache).dht() : ((IgniteKernal)cache.unwrap(Ignite.class)).<K, V>internalCache(cache.getName()).context().dht(); }
/** {@inheritDoc} */ @Override protected void beforeTest() throws Exception { super.beforeTest(); if (testsCfg.awaitPartitionMapExchange()) awaitPartitionMapExchange(); assert jcache().unwrap(Ignite.class).transactions().tx() == null; assertEquals(0, jcache().localSize()); assertEquals(0, jcache().size()); }
/** {@inheritDoc} */ @Override protected void afterTest() throws Exception { TestIndexingSpi.forceFail(false); Transaction tx = jcache().unwrap(Ignite.class).transactions().tx(); if (tx != null) { tx.close(); fail("Cache transaction remained after test completion: " + tx); } for (int key = 0; key <= lastKey; key++) grid(0).cache(DEFAULT_CACHE_NAME).remove(key); assertEquals(0, jcache(0).size(CachePeekMode.ALL)); }