/** * @return Stop info. */ protected String stopInfo() { return "Cache manager stopped: " + cctx.name(); }
/** * @return Cache name. */ protected final String cacheName() { return cctx.name(); }
/** * @return Stop info. */ protected String kernalStopInfo() { return "Cache manager received onKernalStop() callback: " + cctx.name(); }
/** * @return Start info. */ protected String kernalStartInfo() { return "Cache manager received onKernalStart() callback: " + cctx.name(); }
/** * @param cacheName Cache name. * @return {@code True} if group contains cache with given name. */ public boolean hasCache(String cacheName) { List<GridCacheContext> caches = this.caches; for (GridCacheContext cacheContext : caches) if (cacheContext.name().equals(cacheName)) return true; return false; }
/** {@inheritDoc} */ @Override public GridCloseableIterator scanQueryDistributed(GridCacheQueryAdapter qry, Collection<ClusterNode> nodes) throws IgniteCheckedException { assert cctx.isLocal() : cctx.name(); throw new IgniteException("Distributed scan query are not available for local cache " + "(use 'CacheQuery.executeScanQuery(grid.forLocal())' instead) [cacheName=" + cctx.name() + ']'); }
/** * @param part Partition. * @param topVer Topology version. * @return Exception. */ private ClusterTopologyServerNotFoundException serverNotFoundError(int part, AffinityTopologyVersion topVer) { return new ClusterTopologyServerNotFoundException("Failed to map keys for cache " + "(all partition nodes left the grid) [topVer=" + topVer + ", part=" + part + ", cache=" + cctx.name() + ']'); }
/** * @param ctx Callback invoked when cache is stopped. */ public void onCacheStop(GridCacheContext ctx) { Iterator<Map.Entry<UUID, RemoteRoutineInfo>> it = rmtInfos.entrySet().iterator(); while (it.hasNext()) { Map.Entry<UUID, RemoteRoutineInfo> entry = it.next(); GridContinuousHandler hnd = entry.getValue().hnd; if (hnd.isQuery() && F.eq(ctx.name(), hnd.cacheName())) it.remove(); } }
/** * @param cctx Cache context. * @param tableName Target table name. */ TableCacheFilter(GridCacheContext cctx, String tableName) { this.cctx = cctx; this.tableName = tableName; cacheName = cctx.name(); query = cctx.kernalContext().query(); }
/** * @param ctx Cache context. */ private void checkTransactional(GridCacheContext ctx) { if (!ctx.transactional()) throw new TransactionException("Failed to start transaction on non-transactional cache: " + ctx.name()); } }
/** * @param part Partition. * @param topVer Topology version. * @return Exception. */ protected final ClusterTopologyServerNotFoundException serverNotFoundError(int part, AffinityTopologyVersion topVer) { return new ClusterTopologyServerNotFoundException("Failed to map keys for cache " + "(all partition nodes left the grid) [topVer=" + topVer + ", part" + part + ", cache=" + cctx.name() + ", localNodeId=" + cctx.localNodeId() + ']'); }
/** * @param cctx Cache context. * @param ctgr Category. */ GridCacheLogger(GridCacheContext<?, ?> cctx, String ctgr) { assert cctx != null; assert ctgr != null; this.cctx = cctx; this.ctgr = ctgr; cacheName = '<' + cctx.name() + "> "; log = cctx.kernalContext().log(ctgr); }
/** * @param grp Group. */ private boolean isGrpExcluded(CacheGroupContext grp) { if (arg.getExcludeCaches().contains(grp.name())) return true; for (GridCacheContext cacheCtx : grp.caches()) { if (arg.getExcludeCaches().contains(cacheCtx.name())) return true; } return false; }
/** * @param topVer Topology version. * @return Affinity assignments. */ public List<List<ClusterNode>> assignments(AffinityTopologyVersion topVer) { if (cctx.isLocal()) topVer = LOC_CACHE_TOP_VER; GridAffinityAssignmentCache aff0 = aff; if (aff0 == null) throw new IgniteException(FAILED_TO_FIND_CACHE_ERR_MSG + cctx.name()); return aff0.assignments(topVer); }
/** {@inheritDoc} */ @Override public CacheQueryFuture<?> queryFieldsDistributed(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 printMemoryStats() { X.println(">>> "); X.println(">>> Eviction manager memory stats [igniteInstanceName=" + cctx.igniteInstanceName() + ", cache=" + cctx.name() + ']'); }
/** * @return Error. */ private IllegalStateException suspendedError() { throw new IgniteCacheRestartingException(new IgniteFutureImpl<>(suspendFut), ctx.name()); }
/** * @param cacheCtx Cache context. * @throws IgniteCheckedException If updates are not allowed. */ private void checkUpdatesAllowed(GridCacheContext cacheCtx) throws IgniteCheckedException { if (!cacheCtx.updatesAllowed()) { throw new IgniteTxRollbackCheckedException(new CacheException( "Updates are not allowed for transactional cache: " + cacheCtx.name() + ". Configure " + "persistence store on client or use remote closure execution to start transactions " + "from server nodes.")); } }
/** {@inheritDoc} */ @Override public void printMemoryStats() { try { X.println(">>>"); X.println(">>> TTL processor memory stats [igniteInstanceName=" + cctx.igniteInstanceName() + ", cache=" + cctx.name() + ']'); X.println(">>> pendingEntriesSize: " + pendingSize()); } catch (IgniteCheckedException e) { U.error(log, "Failed to print statistics: " + e, e); } }
/** {@inheritDoc} */ @Override public void run(int idx) throws Exception { GridCacheContext<String, Integer> ctx = ((IgniteKernal)ignite).<String, Integer>internalCache(cacheName).context(); int size = 0; for (String key : map.keySet()) if (ctx.affinity().keyLocalNode(key, ctx.discovery().topologyVersionEx())) size++; assertEquals("Incorrect key size on cache #" + idx, size, ignite.cache(ctx.name()).localSize(ALL)); } }