/** * Sets the map of cache event journal configurations, mapped by config name. * The config name may be a pattern with which the configuration will be * obtained in the future. * * @param eventJournalConfigs the cache event journal configuration map to set * @return this config instance */ public Config setCacheEventJournalConfigs(Map<String, EventJournalConfig> eventJournalConfigs) { this.cacheEventJournalConfigs.clear(); this.cacheEventJournalConfigs.putAll(eventJournalConfigs); for (Entry<String, EventJournalConfig> entry : eventJournalConfigs.entrySet()) { entry.getValue().setCacheName(entry.getKey()); } return this; }
@Override public void accept(EventJournalConfig eventJournalConfig, String name) { eventJournalConfig.setCacheName(name); if ("default".equals(name)) { eventJournalConfig.setEnabled(false); } } });
/** * Sets the map of cache event journal configurations, mapped by config name. * The config name may be a pattern with which the configuration will be * obtained in the future. * * @param eventJournalConfigs the cache event journal configuration map to set * @return this config instance */ public Config setCacheEventJournalConfigs(Map<String, EventJournalConfig> eventJournalConfigs) { this.cacheEventJournalConfigs.clear(); this.cacheEventJournalConfigs.putAll(eventJournalConfigs); for (Entry<String, EventJournalConfig> entry : eventJournalConfigs.entrySet()) { entry.getValue().setCacheName(entry.getKey()); } return this; }
@Override public void accept(EventJournalConfig eventJournalConfig, String name) { eventJournalConfig.setCacheName(name); if ("default".equals(name)) { eventJournalConfig.setEnabled(false); } } });
@Override protected IdentifiedDataSerializable getConfig() { EventJournalConfig config = new EventJournalConfig(); if (StringUtil.isNullOrEmpty(parameters.mapName) && StringUtil.isNullOrEmpty(parameters.cacheName)) { throw new IllegalArgumentException("Event journal config should have non-empty map name and/or cache name"); } if (!StringUtil.isNullOrEmpty(parameters.mapName)) { config.setMapName(parameters.mapName); } if (!StringUtil.isNullOrEmpty(parameters.cacheName)) { config.setCacheName(parameters.cacheName); } config.setEnabled(parameters.enabled); config.setTimeToLiveSeconds(parameters.timeToLiveSeconds); config.setCapacity(parameters.capacity); return config; }
@Override protected IdentifiedDataSerializable getConfig() { EventJournalConfig config = new EventJournalConfig(); if (StringUtil.isNullOrEmpty(parameters.mapName) && StringUtil.isNullOrEmpty(parameters.cacheName)) { throw new IllegalArgumentException("Event journal config should have non-empty map name and/or cache name"); } if (!StringUtil.isNullOrEmpty(parameters.mapName)) { config.setMapName(parameters.mapName); } if (!StringUtil.isNullOrEmpty(parameters.cacheName)) { config.setCacheName(parameters.cacheName); } config.setEnabled(parameters.enabled); config.setTimeToLiveSeconds(parameters.timeToLiveSeconds); config.setCapacity(parameters.capacity); return config; }
private static Config getConfig() { Config config = new Config(); config.addCacheConfig(new CacheSimpleConfig().setName(CACHE_NAME)); // Add an event journal config for cache which has custom capacity of 1000 (default 10_000) // and time to live seconds as 10 seconds (default 0 which means infinite) config.addEventJournalConfig(new EventJournalConfig().setEnabled(true) .setCacheName(CACHE_NAME) .setCapacity(1000) .setTimeToLiveSeconds(10)); return config; }