/** * @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 )); } } } }
/** {@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 cfg Listener configuration. * @param onStart Whether listener is created on node start. * @throws IgniteCheckedException If failed. */ public void executeJCacheQuery(CacheEntryListenerConfiguration cfg, boolean onStart, boolean keepBinary) throws IgniteCheckedException { JCacheQuery lsnr = new JCacheQuery(cfg, onStart, keepBinary); JCacheQuery old = jCacheLsnrs.putIfAbsent(cfg, lsnr); if (old != null) throw new IllegalArgumentException("Listener is already registered for configuration: " + cfg); try { lsnr.execute(); } catch (IgniteCheckedException e) { cancelJCacheQuery(cfg); throw e; } }
.executeInternalQuery(lsnr, new SerializableFilter(), false, true, true, false); if (uuid != null) grid(0).context().cache().cache(cache.getName()).context().continuousQueries() .cancelInternalQuery(uuid);
CacheEvictionManager evictMgr = (nearEnabled || cfg.isOnheapCacheEnabled()) ? new GridCacheEvictionManager() : new CacheOffheapEvictionManager(); GridCacheQueryManager qryMgr = queryManager(cfg); CacheContinuousQueryManager contQryMgr = new CacheContinuousQueryManager(); CacheDataStructuresManager dataStructuresMgr = new CacheDataStructuresManager(); GridCacheTtlManager ttlMgr = new GridCacheTtlManager();
/** {@inheritDoc} */ @SuppressWarnings("unchecked") @Override protected void onKernalStart0() throws IgniteCheckedException { Iterable<CacheEntryListenerConfiguration> cfgs = cctx.config().getCacheEntryListenerConfigurations(); if (cfgs != null) { for (CacheEntryListenerConfiguration cfg : cfgs) executeJCacheQuery(cfg, true, false); } }
@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); } } });
throws IgniteCheckedException return executeQuery0( locLsnr, new IgniteOutClosure<CacheContinuousQueryHandler>() {
final UUID routineId = ctx.continuousQueries().executeQuery( locLsnr, locTransLsnr,
ctx0.continuousQueries().closeBackupUpdateCountersGaps(ctx0, part.id(), topVer, gaps);
new GridCacheEvictionManager(), new GridCacheLocalQueryManager<K, V>(), new CacheContinuousQueryManager(), new CacheDataStructuresManager(), new GridCacheTtlManager(),
/** {@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); } }
@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); } } });
throws IgniteCheckedException return executeQuery0( locLsnr, new IgniteOutClosure<CacheContinuousQueryHandler>() {
final UUID routineId = ctx.continuousQueries().executeQuery( locLsnr, locTransLsnr,
super.onKernalStart(); jobMetaCache().context().continuousQueries().executeInternalQuery( new CacheEntryUpdatedListener<HadoopJobId, HadoopJobMetadata>() { @Override public void onUpdated(final Iterable<CacheEntryEvent<? extends HadoopJobId,
/** {@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()); } }
CacheEvictionManager evictMgr = (nearEnabled || cfg.isOnheapCacheEnabled()) ? new GridCacheEvictionManager() : new CacheOffheapEvictionManager(); GridCacheQueryManager qryMgr = queryManager(cfg); CacheContinuousQueryManager contQryMgr = new CacheContinuousQueryManager(); CacheDataStructuresManager dataStructuresMgr = new CacheDataStructuresManager(); GridCacheTtlManager ttlMgr = new GridCacheTtlManager();
/** {@inheritDoc} */ @SuppressWarnings("unchecked") @Override protected void onKernalStart0() throws IgniteCheckedException { Iterable<CacheEntryListenerConfiguration> cfgs = cctx.config().getCacheEntryListenerConfigurations(); if (cfgs != null) { for (CacheEntryListenerConfiguration cfg : cfgs) executeJCacheQuery(cfg, true, false); } }
/** {@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); } }