/** {@inheritDoc} */ @Override public String getName() { return delegate.getName(); }
@Override public Object apply(IgniteCacheProxy<?, ?> c) { return c.getName(); } }));
@Override public boolean apply(IgniteCacheProxy<?, ?> c) { return F.eq(c.getName(), cacheName); } });
/** * @param name Cache name. * @return Cache instance for given name. */ @SuppressWarnings("unchecked") public <K, V> IgniteCacheProxy<K, V> jcache(String name) { assert name != null; IgniteCacheProxy<K, V> cache = (IgniteCacheProxy<K, V>)jcacheProxy(name, true); if (cache == null) { GridCacheAdapter<?, ?> cacheAdapter = caches.get(name); if (cacheAdapter != null) { cache = new IgniteCacheProxyImpl(cacheAdapter.context(), cacheAdapter, false); IgniteCacheProxyImpl<?, ?> prev = addjCacheProxy(name, (IgniteCacheProxyImpl<?, ?>)cache); if (prev != null) cache = (IgniteCacheProxy<K, V>)prev; completeProxyInitialize(cache.getName()); } } if (cache == null) throw new IllegalArgumentException("Cache is not configured: " + name); return cache; }
/** {@inheritDoc} */ @Override public GridRestRequest asRestRequest(GridRedisMessage msg) throws IgniteCheckedException { assert msg != null; GridRestCacheRequest restReq = new GridRestCacheRequest(); restReq.clientId(msg.clientId()); switch (msg.command()) { case FLUSHDB: restReq.command(CACHE_REMOVE_ALL); restReq.cacheName(msg.cacheName()); break; default: // CACHE_CLEAR Map<Object, Object> redisCaches = new HashMap<>(); for (IgniteCacheProxy<?, ?> cache : ctx.cache().publicCaches()) { if (cache.getName().startsWith(CACHE_NAME_PREFIX)) { redisCaches.put(cache.getName(), null); } } if (redisCaches.isEmpty()) throw new GridRedisGenericException("No Redis caches found"); restReq.command(CACHE_CLEAR); restReq.values(redisCaches); } return restReq; }
/** {@inheritDoc} */ @Override protected Map<String, VisorCacheConfiguration> run(VisorCacheConfigurationCollectorTaskArg arg) { Collection<IgniteCacheProxy<?, ?>> caches = ignite.context().cache().jcaches(); Pattern ptrn = arg.getRegex() != null ? Pattern.compile(arg.getRegex()) : null; boolean all = F.isEmpty(arg.getCacheNames()); boolean hasPtrn = ptrn != null; Map<String, VisorCacheConfiguration> res = U.newHashMap(caches.size()); for (IgniteCacheProxy<?, ?> cache : caches) { String cacheName = cache.getName(); boolean matched = hasPtrn ? ptrn.matcher(cacheName).find() : all || arg.getCacheNames().contains(cacheName); if (!VisorTaskUtils.isRestartingCache(ignite, cacheName) && matched) { VisorCacheConfiguration cfg = config(cache.getConfiguration(CacheConfiguration.class), cache.context().dynamicDeploymentId()); res.put(cacheName, cfg); } } return res; }
/** {@inheritDoc} */ @Override protected Collection<VisorCacheMetrics> run(final VisorCacheMetricsCollectorTaskArg arg) { assert arg != null; boolean showSysCaches = arg.isShowSystemCaches(); Collection<String> cacheNames = arg.getCacheNames(); assert cacheNames != null; GridCacheProcessor cacheProcessor = ignite.context().cache(); Collection<IgniteCacheProxy<?, ?>> caches = cacheProcessor.jcaches(); Collection<VisorCacheMetrics> res = new ArrayList<>(caches.size()); boolean allCaches = cacheNames.isEmpty(); for (IgniteCacheProxy ca : caches) { String cacheName = ca.getName(); if (!VisorTaskUtils.isRestartingCache(ignite, cacheName)) { GridCacheContext ctx = ca.context(); if (ctx.started() && (ctx.affinityNode() || ctx.isNear())) { VisorCacheMetrics cm = new VisorCacheMetrics(ignite, cacheName); if ((allCaches || cacheNames.contains(cacheName)) && (showSysCaches || !cm.isSystem())) res.add(cm); } } } return res; }
/** * @param name Cache name. * @return Cache. */ private <K, V> IgniteInternalCache<K, V> internalCacheEx(String name) { if (ctx.discovery().localNode().isClient()) { IgniteCacheProxy<K, V> proxy = (IgniteCacheProxy<K, V>)jcacheProxy(name, true); if (proxy == null) { GridCacheAdapter<?, ?> cacheAdapter = caches.get(name); if (cacheAdapter != null) { proxy = new IgniteCacheProxyImpl(cacheAdapter.context(), cacheAdapter, false); IgniteCacheProxyImpl<?, ?> prev = addjCacheProxy(name, (IgniteCacheProxyImpl<?, ?>)proxy); if (prev != null) proxy = (IgniteCacheProxy<K, V>)prev; completeProxyInitialize(proxy.getName()); } } assert proxy != null : name; return proxy.internalProxy(); } return internalCache(name); }
out("Running warmup [cacheName=" + U.maskName(cache.getName()) + ", method=" + warmupMethod + ']');
switch (type) { case OP_GET_NAME: writer.writeObject(cache.getName());
assert CACHE_NAME.equals(caches.iterator().next().getName());
"Waiting for correct partition state part=" + entry.getKey() + ", should be OWNING [state=" + entry.getValue() + "], node=" + g.name() + ", cache=" + c.getName());
/** {@inheritDoc} */ @Override public String getName() { return delegate.getName(); }
/** * @param name Cache name. * @return Cache instance for given name. */ @SuppressWarnings("unchecked") public <K, V> IgniteCacheProxy<K, V> jcache(String name) { assert name != null; IgniteCacheProxy<K, V> cache = (IgniteCacheProxy<K, V>)jcacheProxy(name, true); if (cache == null) { GridCacheAdapter<?, ?> cacheAdapter = caches.get(name); if (cacheAdapter != null) { cache = new IgniteCacheProxyImpl(cacheAdapter.context(), cacheAdapter, false); IgniteCacheProxyImpl<?, ?> prev = addjCacheProxy(name, (IgniteCacheProxyImpl<?, ?>)cache); if (prev != null) cache = (IgniteCacheProxy<K, V>)prev; completeProxyInitialize(cache.getName()); } } if (cache == null) throw new IllegalArgumentException("Cache is not configured: " + name); return cache; }
/** {@inheritDoc} */ @Override protected Map<String, VisorCacheConfiguration> run(VisorCacheConfigurationCollectorTaskArg arg) { Collection<IgniteCacheProxy<?, ?>> caches = ignite.context().cache().jcaches(); Collection<String> cacheNames = arg.getCacheNames(); boolean all = F.isEmpty(cacheNames); Map<String, VisorCacheConfiguration> res = U.newHashMap(all ? caches.size() : cacheNames.size()); for (IgniteCacheProxy<?, ?> cache : caches) { String cacheName = cache.getName(); if (all || cacheNames.contains(cacheName)) { res.put(cacheName, config(cache.getConfiguration(CacheConfiguration.class), cache.context().dynamicDeploymentId())); } } return res; }
/** {@inheritDoc} */ @Override public GridRestRequest asRestRequest(GridRedisMessage msg) throws IgniteCheckedException { assert msg != null; GridRestCacheRequest restReq = new GridRestCacheRequest(); restReq.clientId(msg.clientId()); switch (msg.command()) { case FLUSHDB: restReq.command(CACHE_REMOVE_ALL); restReq.cacheName(msg.cacheName()); break; default: // CACHE_CLEAR Map<Object, Object> redisCaches = new HashMap<>(); for (IgniteCacheProxy<?, ?> cache : ctx.cache().publicCaches()) { if (cache.getName().startsWith(CACHE_NAME_PREFIX)) { redisCaches.put(cache.getName(), null); } } if (redisCaches.isEmpty()) throw new GridRedisGenericException("No Redis caches found"); restReq.command(CACHE_CLEAR); restReq.values(redisCaches); } return restReq; }
/** {@inheritDoc} */ @Override protected Collection<VisorCacheMetrics> run(final VisorCacheMetricsCollectorTaskArg arg) { assert arg != null; boolean showSysCaches = arg.isShowSystemCaches(); Collection<String> cacheNames = arg.getCacheNames(); assert cacheNames != null; GridCacheProcessor cacheProcessor = ignite.context().cache(); Collection<IgniteCacheProxy<?, ?>> caches = cacheProcessor.jcaches(); Collection<VisorCacheMetrics> res = new ArrayList<>(caches.size()); boolean allCaches = cacheNames.isEmpty(); for (IgniteCacheProxy ca : caches) { GridCacheContext ctx = ca.context(); if (ctx.started() && (ctx.affinityNode() || ctx.isNear())) { String cacheName = ca.getName(); VisorCacheMetrics cm = new VisorCacheMetrics(ignite, cacheName); if ((allCaches || cacheNames.contains(cacheName)) && (showSysCaches || !cm.isSystem())) res.add(cm); } } return res; }
/** * @param name Cache name. * @return Cache. */ private <K, V> IgniteInternalCache<K, V> internalCacheEx(String name) { if (ctx.discovery().localNode().isClient()) { IgniteCacheProxy<K, V> proxy = (IgniteCacheProxy<K, V>)jcacheProxy(name, true); if (proxy == null) { GridCacheAdapter<?, ?> cacheAdapter = caches.get(name); if (cacheAdapter != null) { proxy = new IgniteCacheProxyImpl(cacheAdapter.context(), cacheAdapter, false); IgniteCacheProxyImpl<?, ?> prev = addjCacheProxy(name, (IgniteCacheProxyImpl<?, ?>)proxy); if (prev != null) proxy = (IgniteCacheProxy<K, V>)prev; completeProxyInitialize(proxy.getName()); } } assert proxy != null : name; return proxy.internalProxy(); } return internalCache(name); }
switch (type) { case OP_GET_NAME: writer.writeObject(cache.getName());