/** * @param ctx Kernal context. * @return Continuous query manager. */ private CacheContinuousQueryManager manager(GridKernalContext ctx) { GridCacheContext<K, V> cacheCtx = cacheContext(ctx); return cacheCtx == null ? null : cacheCtx.continuousQueries(); }
/** * @param ctx0 Cache context. * @param tx Transaction. * @param key Key. * @return Map of listeners to be notified by this update. */ public Map<UUID, CacheContinuousQueryListener> continuousQueryListeners(GridCacheContext ctx0, @Nullable IgniteInternalTx tx, KeyCacheObject key) { boolean internal = key != null && key.internal() || !ctx0.userCache(); return ctx0.continuousQueries().notifyContinuousQueries(tx) ? ctx0.continuousQueries().updateListeners(internal, false) : null; }
@Override public void run() { try { Iterable<CacheEntryEvent<?, ?>> entries = serviceCache.context().continuousQueries().existingEntries(false, null); onSystemCacheUpdated(entries); } catch (IgniteCheckedException e) { U.error(log, "Failed to load service entries: " + e, e); } } });
/** {@inheritDoc} */ @Override public void onKernalStop(boolean cancel) { super.onKernalStop(cancel); for (GridCacheRemovable ds : dsMap.values()) { if (ds instanceof GridCacheSemaphoreEx) ((GridCacheSemaphoreEx)ds).stop(); if (ds instanceof GridCacheLockEx) ((GridCacheLockEx)ds).onStop(); } CountDownLatch init0 = initLatch; if (init0 != null && init0.getCount() > 0) { initFailed = true; init0.countDown(); initLatch = null; } Iterator<Map.Entry<Integer, UUID>> iter = qryIdMap.entrySet().iterator(); while (iter.hasNext()) { Map.Entry<Integer, UUID> e = iter.next(); iter.remove(); GridCacheContext cctx = ctx.cache().context().cacheContext(e.getKey()); cctx.continuousQueries().cancelInternalQuery(e.getValue()); } }
/** {@inheritDoc} */ @Override public void deregisterCacheEntryListener(CacheEntryListenerConfiguration<K, V> lsnrCfg) { GridCacheContext<K, V> ctx = getContextSafe(); try { ctx.continuousQueries().cancelJCacheQuery(lsnrCfg); } catch (IgniteCheckedException | IgniteException e) { throw cacheException(e); } }
/** {@inheritDoc} */ @Override protected void onKernalStop0(boolean cancel) { busyLock.block(); if (queueQryId != null) cctx.continuousQueries().cancelInternalQuery(queueQryId); for (GridCacheQueueProxy q : queuesMap.values()) q.delegate().onKernalStop(); }
/** * @param part Partition ID. */ public void onPartitionEvicted(int part) { List<GridCacheContext> caches = this.caches; for (GridCacheContext cctx : caches) { if (cctx.isDrEnabled()) cctx.dr().partitionEvicted(part); cctx.continuousQueries().onPartitionEvicted(part); } }
/** {@inheritDoc} */ @Override public void unregister(UUID routineId, GridKernalContext ctx) { assert routineId != null; assert ctx != null; GridCacheAdapter<K, V> cache = ctx.cache().internalCache(cacheName); if (cache != null) cache.context().continuousQueries().unregisterListener(internal, routineId); }
/** * @param ctx Context. * @return Managers present in both, DHT and Near caches. */ @SuppressWarnings("IfMayBeConditional") private Collection<GridCacheManager> dhtExcludes(GridCacheContext ctx) { if (ctx.config().getCacheMode() == LOCAL || !isNearEnabled(ctx)) return Collections.emptyList(); else return F.asList(ctx.queries(), ctx.continuousQueries(), ctx.store()); }
/** {@inheritDoc} */ @Override public void registerCacheEntryListener(CacheEntryListenerConfiguration<K, V> lsnrCfg) { GridCacheContext<K, V> ctx = getContextSafe(); try { CacheOperationContext opCtx = ctx.operationContextPerCall(); ctx.continuousQueries().executeJCacheQuery(lsnrCfg, false, opCtx != null && opCtx.isKeepBinary()); } catch (IgniteCheckedException | IgniteException e) { throw cacheException(e); } }
/** * @param cctx Cache context. * @throws IgniteCheckedException If failed. */ private void startQuery(GridCacheContext cctx) throws IgniteCheckedException { if (!qryIdMap.containsKey(cctx.cacheId())) { synchronized (this) { if (!qryIdMap.containsKey(cctx.cacheId())) { qryIdMap.put(cctx.cacheId(), cctx.continuousQueries().executeInternalQuery( new DataStructuresEntryListener(), new DataStructuresEntryFilter(), cctx.isReplicated() && cctx.affinityNode(), false, false, true )); } } } }
/** * @param ctx Context. * @return DHT managers. */ private List<GridCacheManager> dhtManagers(GridCacheContext ctx) { return F.asList(ctx.store(), ctx.events(), ctx.evicts(), ctx.queries(), ctx.continuousQueries(), ctx.dr()); }
skipCtx = cctx.continuousQueries().skipUpdateCounter(skipCtx, part, cntr, topVer, primary);
ctx0.continuousQueries().closeBackupUpdateCountersGaps(ctx0, part.id(), topVer, gaps);
/** * @param cctx Cache context. * @param key Cache key. */ protected GridCacheMapEntry( GridCacheContext<?, ?> cctx, KeyCacheObject key ) { if (log == null) log = U.logger(cctx.kernalContext(), logRef, GridCacheMapEntry.class); key = (KeyCacheObject)cctx.kernalContext().cacheObjects().prepareForCache(key, cctx); assert key != null; this.key = key; this.hash = key.hashCode(); this.cctx = cctx; this.listenerLock = cctx.continuousQueries().getListenerReadLock(); ver = cctx.shared().versions().startVersion(); }
/** {@inheritDoc} */ @Override protected void afterTest() throws Exception { // Wait for all routines are unregistered GridTestUtils.waitForCondition(new PA() { @Override public boolean apply() { for (Ignite node : G.allGrids()) { GridContinuousProcessor proc = ((IgniteEx)node).context().continuous(); if(((Map)U.field(proc, "rmtInfos")).size() > 0) return false; } return true; } }, 3000); for (Ignite node : G.allGrids()) { GridKernalContext ctx = ((IgniteEx)node).context(); GridContinuousProcessor proc = ctx.continuous(); final int locInfosCnt = ctx.service() instanceof GridServiceProcessor ? 1 : 0; assertEquals(locInfosCnt, ((Map)U.field(proc, "locInfos")).size()); assertEquals(0, ((Map)U.field(proc, "rmtInfos")).size()); assertEquals(0, ((Map)U.field(proc, "startFuts")).size()); assertEquals(0, ((Map)U.field(proc, "stopFuts")).size()); assertEquals(0, ((Map)U.field(proc, "bufCheckThreads")).size()); CacheContinuousQueryManager mgr = ((IgniteEx)node).context().cache().internalCache(DEFAULT_CACHE_NAME).context().continuousQueries(); assertEquals(0, ((Map)U.field(mgr, "lsnrs")).size()); MvccCachingManager cachingMgr = ((IgniteEx)node).context().cache().context().mvccCaching(); assertEquals(0, ((Map)U.field(cachingMgr, "enlistCache")).size()); assertEquals(0, ((Map)U.field(cachingMgr, "cntrs")).size()); } super.afterTest(); }
uuid = grid(0).context().cache().cache(cache.getName()).context().continuousQueries() .executeInternalQuery(lsnr, new SerializableFilter(), false, true, true, false); grid(0).context().cache().cache(cache.getName()).context().continuousQueries() .cancelInternalQuery(uuid);
cctx.continuousQueries().onEntryExpired(entry, entry.key(), expiredVal);
cctx.continuousQueries().onEntryExpired(entry, entry.key(), expiredVal);
/** * @throws Exception If failed. */ @Test public void testBackupCleanerTaskFinalize() throws Exception { final String CACHE_NAME = "LOCAL_CACHE"; CacheConfiguration<Integer, Integer> cCfg = new CacheConfiguration<>(); cCfg.setName(CACHE_NAME); cCfg.setCacheMode(cacheMode()); IgniteCache<Integer, Integer> cache = grid(0).getOrCreateCache(cCfg); CacheContinuousQueryManager qm = grid(0).context().cache(). internalCache(CACHE_NAME).context().continuousQueries(); assertNotNull(qm.getCancelableTask()); cache.destroy(); assertNull(qm.getCancelableTask()); }