/** {@inheritDoc} */ @Override public String getKeyType() { CacheConfiguration ccfg = cctx.config(); return ccfg != null ? ccfg.getKeyType().getName() : null; }
/** {@inheritDoc} */ @Override public <C extends Configuration<K, V>> C getConfiguration(Class<C> clazz) { GridCacheContext<K, V> ctx = getContextSafe(); CacheConfiguration cfg = ctx.config(); if (!clazz.isAssignableFrom(cfg.getClass())) throw new IllegalArgumentException(); return clazz.cast(cfg); }
/** {@inheritDoc} */ @Override public String getValueType() { CacheConfiguration ccfg = cctx.config(); return ccfg != null ? ccfg.getValueType().getName() : null; }
/** {@inheritDoc} */ @Override public boolean isReadThrough() { CacheConfiguration ccfg = cctx.config(); return ccfg != null && ccfg.isReadThrough(); }
/** * Checks if near cache is enabled for cache context. * * @param ctx Cache context to check. * @return {@code True} if near cache is enabled, {@code false} otherwise. */ public static boolean isNearEnabled(GridCacheContext ctx) { return isNearEnabled(ctx.config()); }
/** {@inheritDoc} */ @Override public boolean isStoreByValue() { CacheConfiguration ccfg = cctx.config(); return ccfg != null && ccfg.isStoreByValue(); }
/** {@inheritDoc} */ @Override public boolean isManagementEnabled() { CacheConfiguration ccfg = cctx.config(); return ccfg != null && ccfg.isManagementEnabled(); }
/** {@inheritDoc} */ @Override public boolean isWriteThrough() { CacheConfiguration ccfg = cctx.config(); return ccfg != null && ccfg.isWriteThrough(); }
/** * Checks if it is possible to directly read data memory without entry creation (this * is optimization to avoid unnecessary blocking synchronization on cache entry). * * @param expiryPlc Optional expiry policy for read operation. * @param readers {@code True} if need update near cache readers. * @return {@code True} if it is possible to directly read offheap instead of using {@link GridCacheEntryEx#innerGet}. */ public boolean readNoEntry(@Nullable IgniteCacheExpiryPolicy expiryPlc, boolean readers) { return mvccEnabled() || (!config().isOnheapCacheEnabled() && !readers && expiryPlc == null); }
/** {@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 start0() throws IgniteCheckedException { super.start0(); assert cctx.config().getCacheMode() == LOCAL; }
/** * Startup info. * * @return Startup info. */ protected final String startInfo() { return "Cache started: " + U.maskName(ctx.config().getName()); }
/** * Throws atomicity modes compatibility validation exception. * * @param ctx1 Cache context. * @param ctx2 Another cache context. */ public static void throwAtomicityModesMismatchException(GridCacheContext ctx1, GridCacheContext ctx2) { throw new IgniteException("Caches with transactional_snapshot atomicity mode cannot participate in the same" + " transaction with caches having another atomicity mode. [cacheName=" + ctx1.name() + ", cacheMode=" + ctx1.config().getAtomicityMode() + ", anotherCacheName=" + ctx2.name() + " anotherCacheMode=" + ctx2.config().getAtomicityMode() + ']'); }
/** {@inheritDoc} */ @Override public CacheQueryFuture<?> queryDistributed(GridCacheQueryBean qry, Collection<ClusterNode> nodes) { assert cctx.config().getCacheMode() == LOCAL; throw new IgniteException("Distributed queries are not available for local cache " + "(use 'CacheQuery.execute(grid.forLocal())' instead) [cacheName=" + cctx.name() + ']'); }
/** {@inheritDoc} */ @Override public void start() throws IgniteCheckedException { if (map == null) { map = new GridCacheLocalConcurrentMap( ctx, entryFactory(), ctx.config().getNearConfiguration().getNearStartSize()); } }
/** {@inheritDoc} */ @Override public void onReconnected() { map = new GridCacheLocalConcurrentMap( ctx, entryFactory(), ctx.config().getNearConfiguration().getNearStartSize()); }
/** {@inheritDoc} */ @Override public boolean hasInterceptor(GridCacheSharedContext cctx) { for (int i = 0; i < activeCacheIds.size(); i++) { int cacheId = activeCacheIds.get(i); CacheInterceptor interceptor = cctx.cacheContext(cacheId).config().getInterceptor(); if (interceptor != null) return true; } return false; }
/** * @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()); }
/** * @param type Event type. * @return {@code True} if event is recordable. */ public boolean isRecordable(int type) { GridCacheContext cctx0 = cctx; // Event recording is impossible in recovery mode. if (cctx0 != null && cctx0.kernalContext().recoveryMode()) return false; return cctx0 != null && cctx0.userCache() && cctx0.gridEvents().isRecordable(type) && !cctx0.config().isEventsDisabled(); }