/** * @return {@code True} if local node in disconnected state. */ private boolean isLocalNodeDisconnected() { boolean disconnected = false; if (ignite instanceof IgniteKernal) disconnected = ((IgniteKernal)ignite).context().clientDisconnected(); return disconnected; }
/** {@inheritDoc} */ @Override public void ignite(Ignite ignite) { super.ignite(ignite); if (ignite != null) { IgniteKernal kernal = (IgniteKernal)ignite; proc = (CacheObjectBinaryProcessorImpl)kernal.context().cacheObjects(); } } }
@Override public void apply(Throwable t) { if (grid != null) grid.context().failure().process(new FailureContext(SYSTEM_WORKER_TERMINATION, t)); } },
/** * Returns checkpoint manager instance for given Grid. * * @param ignite Grid instance. * @return Checkpoint manager. */ private GridCheckpointManager checkpoints(Ignite ignite) { assert ignite != null; return ((IgniteKernal) ignite).context().checkpoint(); }
/** {@inheritDoc} */ @Override public Void call() throws IgniteCheckedException { assert ignite != null; GridCacheAdapter cache = ((IgniteKernal)ignite).context().cache().internalCache(cacheName); // On non-affinity node cache starts on demand, so it may not be running. if (cache != null) cache.context().dataStructures().blockSet(setId); return null; }
/** {@inheritDoc} */ @Override public void addTimeoutObject(IgniteSpiTimeoutObject obj) { Ignite ignite0 = ignite; if (!(ignite0 instanceof IgniteKernal)) throw new IgniteSpiException("Wrong Ignite instance is set: " + ignite0); ((IgniteKernal)ignite0).context().timeout().addTimeoutObject(new GridSpiTimeoutObject(obj)); }
/** {@inheritDoc} */ @Override public void removeTimeoutObject(IgniteSpiTimeoutObject obj) { Ignite ignite0 = ignite; if (!(ignite0 instanceof IgniteKernal)) throw new IgniteSpiException("Wrong Ignite instance is set: " + ignite0); ((IgniteKernal)ignite0).context().timeout().removeTimeoutObject(new GridSpiTimeoutObject(obj)); }
@Nullable @Override public IgniteBiTuple<Long, Long> execute() { IgniteFileSystem igfs = ((IgniteKernal)g).context().igfs().igfs(igfsName); if (igfs == null) return F.t(0L, 0L); IgfsMetrics metrics = igfs.metrics(); long loc = metrics.localSpaceSize(); return F.t(loc, metrics.maxSpaceSize()); } });
/** * @param node Node. * @param grpName Cache group name. * @return Cache group. */ private CacheGroupContext cacheGroup(Ignite node, String grpName) { for (CacheGroupContext grp : ((IgniteKernal)node).context().cache().cacheGroups()) { if (grpName.equals(grp.name())) return grp; } return null; }
@Override public void apply(GridWorker deadWorker, FailureType failureType) { if (grid != null) grid.context().failure().process(new FailureContext( failureType, new IgniteException(S.toString(GridWorker.class, deadWorker)))); } },
/** * @param ignite Ignite. * @return Size of the backup queue. */ private int futuresNum(Ignite ignite) { return ((IgniteKernal)ignite).context().cache().context().mvcc().atomicFutures().size(); }
/** * @param node Node. * @param cacheName Cache name. */ private void checkCache(Ignite node, final String cacheName) { assertNotNull(((IgniteKernal)node).context().cache().cache(cacheName)); } }
/** {@inheritDoc} */ @Override protected void afterTest() throws Exception { ((IgniteKernal)grid()).context().io(). removeMessageListener(GridTopic.TOPIC_COMM_USER.name()); }
/** * */ private void checkDetectionFutures() { for (int i = 0; i < NODES_CNT ; i++) { Ignite ignite = ignite(i); IgniteTxManager txMgr = ((IgniteKernal)ignite).context().cache().context().tm(); Collection<IgniteInternalFuture<?>> futs = txMgr.deadlockDetectionFutures(); assertTrue(futs.isEmpty()); } } }
/** {@inheritDoc} */ @Override protected void afterTest() throws Exception { for (String cacheName : new String[] {DEFAULT_CACHE_NAME, CU.UTILITY_CACHE_NAME}) { IgniteKernal kernal = (IgniteKernal)ignite(0); GridCacheAdapter<Object, Object> cache = kernal.context().cache().internalCache(cacheName); cache.removeAll(F.asList("1", "2", "3")); } }
/** * @param ignite Node. * @param expEnabled Expected notifier status. */ private void checkNotifier(Ignite ignite, boolean expEnabled) { ClusterProcessor proc = ((IgniteKernal)ignite).context().cluster(); if (expEnabled) assertNotNull(GridTestUtils.getFieldValue(proc, "updateNtfTimer")); else assertNull(GridTestUtils.getFieldValue(proc, "updateNtfTimer")); } }
/** * @param node Node. * @param topVer Topology version. * @param cache Cache name. * @return Affinity assignments. */ private List<List<ClusterNode>> affinity(Ignite node, AffinityTopologyVersion topVer, String cache) { GridCacheContext cctx = ((IgniteKernal)node).context().cache().internalCache(cache).context(); return cctx.affinity().assignments(topVer); }
/** * */ private void checkTransactions() { for (int i = 0; i < 3; i++) { IgniteTxManager tm = ((IgniteKernal)grid(i)).context().cache().context().tm(); assertEquals("Uncommitted transactions found on node [idx=" + i + ", mapSize=" + tm.idMapSize() + ']', 0, tm.idMapSize()); } }
/** * @throws Exception If failed. */ @Test public void testTask() throws Exception { Map map = U.field(((IgniteKernal)grid(0)).context().io(), "msgSetMap"); int initSize = map.size(); ComputeTaskFuture<?> fut = executeAsync(compute(grid(0).cluster().forRemotes()), Task.class, null); testMessageSet(fut, initSize, map); }
/** * @param node Node. */ private void checkNoTx(Ignite node) { IgniteTransactions txs = node.transactions(); assertNull(txs.tx()); assertNull(((IgniteKernal)node).context().cache().context().tm().tx()); } }