/** * @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; } }
/** {@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 public void deregisterCacheEntryListener(CacheEntryListenerConfiguration<K, V> lsnrCfg) { try { ctx.continuousQueries().cancelJCacheQuery(lsnrCfg); } catch (IgniteCheckedException | IgniteException e) { throw cacheException(e); } }
/** * @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; } }