/** {@inheritDoc} */ @Override public void addAttributes(Map<String, Object> attrs) throws GridException { if (ctx.isDaemon() || F.isEmpty(ctx.config().getCacheConfiguration())) return; GridCacheAttributes[] attrVals = new GridCacheAttributes[ctx.config().getCacheConfiguration().length]; Map<String, Boolean> attrPortable = new HashMap<>(); Collection<String> replicationCaches = new ArrayList<>(); Map<String, String> interceptors = new HashMap<>(); int i = 0; for (GridCacheConfiguration cfg : ctx.config().getCacheConfiguration()) { attrVals[i++] = new GridCacheAttributes(cfg); attrPortable.put(CU.mask(cfg.getName()), cfg.isPortableEnabled()); if (cfg.getDrSenderConfiguration() != null) replicationCaches.add(cfg.getName()); if (cfg.getInterceptor() != null) interceptors.put(cfg.getName(), cfg.getInterceptor().getClass().getName()); } attrs.put(ATTR_CACHE, attrVals); attrs.put(ATTR_CACHE_PORTABLE, attrPortable); attrs.put(ATTR_REPLICATION_CACHES, replicationCaches); if (!interceptors.isEmpty()) attrs.put(ATTR_CACHE_INTERCEPTORS, interceptors); }
/** * @return Timeout for initial map exchange before preloading. We make it {@code 4} times * bigger than network timeout by default. */ public long preloadExchangeTimeout() { long t1 = gridConfig().getNetworkTimeout() * 4; long t2 = gridConfig().getNetworkTimeout() * gridConfig().getCacheConfiguration().length * 2; long timeout = Math.max(t1, t2); return timeout < 0 ? Long.MAX_VALUE : timeout; }
/** * Gets portable type name by portable ID. * * @param typeId Type ID. * @return Name. */ private String portableName(int typeId) { Map<Integer, String> portableIds = this.portableIds; if (portableIds == null) { portableIds = new HashMap<>(); for (GridCacheConfiguration ccfg : ctx.config().getCacheConfiguration()){ GridCacheQueryConfiguration qryCfg = ccfg.getQueryConfiguration(); if (qryCfg != null) { for (GridCacheQueryTypeMetadata meta : qryCfg.getTypeMetadata()) portableIds.put(ctx.portable().typeId(meta.getType()), meta.getType()); } } this.portableIds = portableIds; } return portableIds.get(typeId); }
/** * @param space Space name. * @param typeId Type ID. * @return Type meta data if it was declared in configuration. */ @Nullable private GridCacheQueryTypeMetadata declaredType(String space, int typeId) { Map<TypeId, GridCacheQueryTypeMetadata> declaredTypesById = this.declaredTypesById; if (declaredTypesById == null) { declaredTypesById = new HashMap<>(); for (GridCacheConfiguration ccfg : ctx.config().getCacheConfiguration()){ GridCacheQueryConfiguration qryCfg = ccfg.getQueryConfiguration(); if (qryCfg != null) { for (GridCacheQueryTypeMetadata meta : qryCfg.getTypeMetadata()) declaredTypesById.put(new TypeId(ccfg.getName(), ctx.portable().typeId(meta.getType())), meta); } } this.declaredTypesById = declaredTypesById; } return declaredTypesById.get(new TypeId(space, typeId)); }
/** * */ private void ackCacheConfiguration() { GridCacheConfiguration[] cacheCfgs = cfg.getCacheConfiguration(); if (cacheCfgs == null || cacheCfgs.length == 0) U.warn(log, "Cache is not configured - in-memory data grid is off."); else { SB sb = new SB(); for (GridCacheConfiguration c : cacheCfgs) { String name = c.getName(); if (name == null) name = "<default>"; sb.a("'").a(name).a("', "); } String names = sb.toString(); U.log(log, "Configured caches [" + names.substring(0, names.length() - 2) + ']'); } }
if (F.isEmpty(gridCfg.getCacheConfiguration())) return null; for (GridCacheConfiguration ccfg : gridCfg.getCacheConfiguration()) { if (CU.isSystemCache(ccfg.getName())) continue;
F.isEmpty(gridCfg.getCacheConfiguration())) return; F.forEach(gridCfg.getCacheConfiguration(), new CI1<GridCacheConfiguration>() { @Override public void apply(GridCacheConfiguration c) { cacheCfgs.put(c.getName(), c);
F.isEmpty(gridCfg.getCacheConfiguration())) return; F.forEach(gridCfg.getCacheConfiguration(), new CI1<GridCacheConfiguration>() { @Override public void apply(GridCacheConfiguration c) { cacheCfgs.put(c.getName(), c);
for (GridCacheConfiguration cacheCfg : ggfsCtx.kernalContext().config().getCacheConfiguration()) { if (F.eq(dataCacheName, cacheCfg.getName())) { GridCacheEvictionPolicy evictPlc = cacheCfg.getEvictionPolicy();
for (GridCacheConfiguration cacheCfg : ggfsCtx.kernalContext().config().getCacheConfiguration()) { if (F.eq(dataCacheName, cacheCfg.getName())) { GridCacheEvictionPolicy evictPlc = cacheCfg.getEvictionPolicy();
", caches=" + cfg.getCacheConfiguration().length + ']');
/** * @throws GridException Thrown in case of any errors. */ @Override public void start() throws GridException { if (ctx.config().isDaemon()) return; if (!enabled()) U.warn(log, "Indexing is disabled (to enable please configure GridH2IndexingSpi)."); GridIndexingMarshaller m = new IdxMarshaller(); for (GridIndexingSpi spi : getSpis()) { spi.registerMarshaller(m); for (GridCacheConfiguration cacheCfg : ctx.config().getCacheConfiguration()) spi.registerSpace(cacheCfg.getName()); } execSvc = ctx.config().getExecutorService(); startSpi(); for (GridCacheConfiguration ccfg : ctx.config().getCacheConfiguration()){ GridCacheQueryConfiguration qryCfg = ccfg.getQueryConfiguration(); if (qryCfg != null) { for (GridCacheQueryTypeMetadata meta : qryCfg.getTypeMetadata()) declaredTypesByName.put(new TypeName(ccfg.getName(), meta.getType()), meta); if (qryCfg.getTypeResolver() != null) typeResolvers.put(ccfg.getName(), qryCfg.getTypeResolver()); } } if (log.isDebugEnabled()) log.debug(startInfo()); }
cctx.gridConfig().getNetworkTimeout() * cctx.gridConfig().getCacheConfiguration().length) { @Override public void onTimeout() { if (isDone())
for (GridCacheConfiguration ccfg : gridCfg.getCacheConfiguration()) { if (ccfg.getDrSenderConfiguration() != null && F.eq(ctx.name(), CU.cacheNameForDrSystemCache(ccfg.getName()))) {
/** * @param g Grid. * @return Data transfer object for node configuration data. */ public static VisorGridConfig from(GridEx g) { assert g != null; GridConfiguration c = g.configuration(); VisorGridConfig cfg = new VisorGridConfig(); cfg.license(VisorLicense.from(g)); cfg.basic(VisorBasicConfig.from(g, c)); cfg.metrics(VisorMetricsConfig.from(c)); cfg.spis(VisorSpisConfig.from(c)); cfg.p2p(VisorPeerToPeerConfig.from(c)); cfg.email(VisorEmailConfig.from(c)); cfg.lifecycle(VisorLifecycleConfig.from(c)); cfg.executeService(VisorExecutorServiceConfig.from(c)); cfg.segmentation(VisorSegmentationConfig.from(c)); cfg.includeProperties(compactArray(c.getIncludeProperties())); cfg.includeEventTypes(c.getIncludeEventTypes()); cfg.rest(VisorRestConfig.from(c)); cfg.userAttributes(c.getUserAttributes()); cfg.caches(VisorCacheConfig.list(c.getCacheConfiguration())); cfg.ggfss(VisorGgfsConfig.list(c.getGgfsConfiguration())); cfg.streamers(VisorStreamerConfig.list(c.getStreamerConfiguration())); cfg.drSenderHub(VisorDrSenderHubConfig.from(c.getDrSenderHubConfiguration())); cfg.drReceiverHub(VisorDrReceiverHubConfig.from(c.getDrReceiverHubConfiguration())); cfg.env(new HashMap<>(getenv())); cfg.systemProperties(getProperties()); return cfg; }
if (!F.isEmpty(ctx.config().getCacheConfiguration())) { if (depMode != CONTINUOUS && depMode != SHARED) U.warn(log, "Deployment mode for cache is not CONTINUOUS or SHARED " + maxPreloadOrder = validatePreloadOrder(ctx.config().getCacheConfiguration()); sysCaches.add(CU.SYS_CACHE_HADOOP_MR); for (GridCacheConfiguration ccfg : ctx.grid().configuration().getCacheConfiguration()) { if (ccfg.getDrSenderConfiguration() != null) sysCaches.add(CU.cacheNameForDrSystemCache(ccfg.getName())); GridCacheConfiguration[] cfgs = ctx.config().getCacheConfiguration();
if (!F.isEmpty(cfg.getCacheConfiguration())) { U.quietAndInfo(log, "Skipping deployment mode override for caches (custom closure " + "execution may not work for console Visor)"); boolean needSwap = false; GridCacheConfiguration[] caches = cfg.getCacheConfiguration(); GridCacheConfiguration[] cacheCfgs = cfg.getCacheConfiguration();
for (GridCacheConfiguration cacheCfg : cfg.getCacheConfiguration()) { if (cacheCfg.getDrSenderConfiguration() != null || cacheCfg.getDrReceiverConfiguration() != null) { hasHubCfg = true;
allResolversPassReq = cfg.isAllSegmentationResolversPassRequired(); daemon = cfg.isDaemon(); cacheCfg = cfg.getCacheConfiguration(); cacheSanityCheckEnabled = cfg.isCacheSanityCheckEnabled(); clientCfg = cfg.getClientConnectionConfiguration();