@Override public boolean apply(DynamicCacheDescriptor desc) { return desc.cacheType().userCache(); } }
/** * @param name Cache name. * @return {@code True} if specified cache is system, {@code false} otherwise. */ public boolean systemCache(String name) { assert name != null; DynamicCacheDescriptor desc = cacheDescriptor(name); return desc != null && !desc.cacheType().userCache(); }
/** {@inheritDoc} */ @Override public Map<String, CacheConfiguration<?, ?>> startedCaches() { Map<Integer, DynamicCacheDescriptor> cachesMap = ctx.affinity().caches(); Map<String, CacheConfiguration<?, ?>> res = U.newHashMap(cachesMap.size()); for (DynamicCacheDescriptor desc : cachesMap.values()) { if (desc.cacheType().userCache()) res.put(desc.cacheName(), desc.cacheConfiguration()); } return res; }
/** * @param node Node to check. * @return Public cache names accessible on the given node. */ public Map<String, CacheConfiguration> nodePublicCaches(ClusterNode node) { Map<String, CacheConfiguration> caches = U.newHashMap(registeredCaches.size()); for (DynamicCacheDescriptor cacheDesc : ctx.cache().cacheDescriptors().values()) { if (!cacheDesc.cacheType().userCache()) continue; CachePredicate p = registeredCaches.get(cacheDesc.cacheName()); if (p != null && p.cacheNode(node)) caches.put(cacheDesc.cacheName(), cacheDesc.cacheConfiguration()); } return caches; }
/** * @param name Cache name. * @param <K> type of keys. * @param <V> type of values. * @return Cache instance for given name. */ public <K, V> IgniteInternalCache<K, V> publicCache(String name) { assert name != null; if (log.isDebugEnabled()) log.debug("Getting public cache for name: " + name); DynamicCacheDescriptor desc = cacheDescriptor(name); if (desc == null) throw new IllegalArgumentException("Cache is not started: " + name); if (!desc.cacheType().userCache()) throw new IllegalStateException("Failed to get cache because it is a system cache: " + name); IgniteCacheProxy<K, V> jcache = (IgniteCacheProxy<K, V>)jcacheProxy(name, true); if (jcache == null) throw new IllegalArgumentException("Cache is not started: " + name); return jcache.internalProxy(); }
/** * @param cacheName Cache name. */ private boolean isCacheMatchFilter(String cacheName) { if (arg instanceof VisorIdleVerifyDumpTaskArg) { DataStorageConfiguration dsCfg = ignite.context().config().getDataStorageConfiguration(); DynamicCacheDescriptor desc = ignite.context().cache().cacheDescriptor(cacheName); CacheConfiguration cc = desc.cacheConfiguration(); VisorIdleVerifyDumpTaskArg vdta = (VisorIdleVerifyDumpTaskArg)arg; switch (vdta.getCacheFilterEnum()) { case SYSTEM: return !desc.cacheType().userCache(); case NOT_PERSISTENT: return desc.cacheType().userCache() && !GridCacheUtils.isPersistentCache(cc, dsCfg); case PERSISTENT: return desc.cacheType().userCache() && GridCacheUtils.isPersistentCache(cc, dsCfg); case ALL: break; default: assert false : "Illegal cache filter: " + vdta.getCacheFilterEnum(); } } return true; }
/** * @param cacheName Cache name. * @param failIfNotStarted If {@code true} throws {@link IllegalArgumentException} if cache is not started, * otherwise returns {@code null} in this case. * @param checkThreadTx If {@code true} checks that current thread does not have active transactions. * @return Cache instance for given name. * @throws IgniteCheckedException If failed. */ @Nullable public <K, V> IgniteCacheProxy<K, V> publicJCache(String cacheName, boolean failIfNotStarted, boolean checkThreadTx) throws IgniteCheckedException { assert cacheName != null; if (log.isDebugEnabled()) log.debug("Getting public cache for name: " + cacheName); DynamicCacheDescriptor desc = cacheDescriptor(cacheName); if (desc != null && !desc.cacheType().userCache()) throw new IllegalStateException("Failed to get cache because it is a system cache: " + cacheName); IgniteCacheProxyImpl<?, ?> proxy = jcacheProxy(cacheName, true); // Try to start cache, there is no guarantee that cache will be instantiated. if (proxy == null) { dynamicStartCache(null, cacheName, null, false, failIfNotStarted, checkThreadTx).get(); proxy = jcacheProxy(cacheName, true); } return proxy != null ? (IgniteCacheProxy<K, V>)proxy.gatewayWrapper() : null; }
DynamicCacheDescriptor desc = e.getValue(); if (!desc.cacheType().userCache()) continue;
desc.cacheType(), desc.deploymentId(), cache.context().isNear(),
desc.cacheType(), desc.groupDescriptor(), desc.template(),
req.cacheType(desc.cacheType());
cache.cacheName(), cache.cacheId(), cache.cacheType(), cache.groupId(), cache.groupDescriptor().cacheOrGroupName(),
@Override public boolean apply(DynamicCacheDescriptor desc) { return desc.cacheType().userCache(); } }