/** * @return {@code True} in case replication is enabled. */ public boolean isDrEnabled() { assert cache != null; return cacheCfg.getDrSenderConfiguration() != null && !cache.isNear(); }
/** {@inheritDoc} */ @Override public void resetMetrics() { boolean isDrSndCache = cacheCfg.getDrSenderConfiguration() != null; boolean isDrRcvCache = cacheCfg.getDrReceiverConfiguration() != null; metrics = new GridCacheMetricsAdapter(isDrSndCache, isDrRcvCache); }
/** {@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); }
/** {@inheritDoc} */ @Override public void resetMetrics() { boolean isDrSndCache = cacheCfg.getDrSenderConfiguration() != null; boolean isDrRcvCache = cacheCfg.getDrReceiverConfiguration() != null; GridCacheMetricsAdapter m = new GridCacheMetricsAdapter(isDrSndCache, isDrRcvCache); m.delegate(ctx.dht().near().metrics0()); metrics = m; }
/** {@inheritDoc} */ @Override public void resetMetrics() { boolean isDrSndCache = cacheCfg.getDrSenderConfiguration() != null; boolean isDrRcvCache = cacheCfg.getDrReceiverConfiguration() != null; GridCacheMetricsAdapter m = new GridCacheMetricsAdapter(isDrSndCache, isDrRcvCache); if (ctx.dht().near() != null) m.delegate(ctx.dht().near().metrics0()); metrics = m; }
/** * Perform DR if needed. * * @param drType DR type. * @param val Value. * @param valBytes Value bytes. * @param ver Version. * @throws GridException In case of exception. */ private void drReplicate(GridDrType drType, @Nullable V val, @Nullable byte[] valBytes, GridCacheVersion ver) throws GridException{ if (cctx.isDrEnabled() && drType != DR_NONE && !isInternal()) { GridDrSenderCacheConfiguration drSndCfg = cctx.config().getDrSenderConfiguration(); GridDrSenderCacheEntryFilter<K, V> drFilter = drSndCfg != null ? (GridDrSenderCacheEntryFilter<K, V>)drSndCfg.getEntryFilter() : null; GridDrRawEntry<K, V> entry = new GridDrRawEntry<>(key, keyBytes, val, valBytes, rawTtl(), rawExpireTime(), ver.drVersion()); boolean apply = drFilter == null; if (!apply) { // Unmarshall entry and pass it to filter. entry.unmarshal(cctx.marshaller()); apply = drFilter.accept(entry); } if (apply) cctx.dr().replicate(entry, drType); else cctx.cache().metrics0().onSenderCacheEntryFiltered(); } }
boolean isDrSndCache = cacheCfg.getDrSenderConfiguration() != null; boolean isDrRcvCache = cacheCfg.getDrReceiverConfiguration() != null; if (ccfg.getDrSenderConfiguration() != null && F.eq(ctx.name(), CU.cacheNameForDrSystemCache(ccfg.getName()))) { drSysCache = true;
/** * @param cfg Configuration. * @param objs Extra components. * @throws GridException If failed to inject. */ private void prepare(GridCacheConfiguration cfg, Object... objs) throws GridException { prepare(cfg, cfg.getEvictionPolicy(), false); prepare(cfg, cfg.getNearEvictionPolicy(), true); prepare(cfg, cfg.getAffinity(), false); prepare(cfg, cfg.getAffinityMapper(), false); prepare(cfg, cfg.getCloner(), false); prepare(cfg, cfg.getStore(), false); prepare(cfg, cfg.getEvictionFilter(), false); prepare(cfg, cfg.getInterceptor(), false); GridDrSenderCacheConfiguration drSndCfg = cfg.getDrSenderConfiguration(); if (drSndCfg != null) prepare(cfg, drSndCfg.getEntryFilter(), false); GridDrReceiverCacheConfiguration drRcvCfg = cfg.getDrReceiverConfiguration(); if (drRcvCfg != null) prepare(cfg, drRcvCfg.getConflictResolver(), false); for (Object obj : objs) prepare(cfg, obj, false); }
if (ccfg.getDrSenderConfiguration() != null) sysCaches.add(CU.cacheNameForDrSystemCache(ccfg.getName()));
"\" because it is reserved for internal purposes."); if (ccfg.getDrSenderConfiguration() != null) drSysCaches.add(CU.cacheNameForDrSystemCache(ccfg.getName()));
new GridCacheDrReceiveAttributes(cfg.getDrReceiverConfiguration()) : null; drSndAttrs = cfg.getDrSenderConfiguration() != null ? new GridCacheDrSendAttributes(cfg.getDrSenderConfiguration()) : null;
cfg.drReceiveConfig(VisorDrReceiverConfig.from(ccfg.getDrReceiverConfiguration())); if (ccfg.getDrSenderConfiguration() != null) cfg.drSendConfig(VisorDrSenderConfig.from(ccfg.getDrSenderConfiguration()));
dgcSuspectLockTimeout = cc.getDgcSuspectLockTimeout(); distro = cc.getDistributionMode(); drSndCacheCfg = cc.getDrSenderConfiguration() != null ? new GridDrSenderCacheConfiguration(cc.getDrSenderConfiguration()) : null; drRcvCacheCfg = cc.getDrReceiverConfiguration() != null ? new GridDrReceiverCacheConfiguration(cc.getDrReceiverConfiguration()) : null;
if (cacheCfg.getDrSenderConfiguration() != null || cacheCfg.getDrReceiverConfiguration() != null) { hasHubCfg = true;
GridDrSenderCacheConfiguration drSndCfg = cc.getDrSenderConfiguration();