/** * Check for errors/inconsistencies in this configuration. Add any erros found as * {@link ConfigError} in the errors collection. * @param errors collection to add errors to. */ public void validate(Collection<ConfigError> errors) { if (writeMode.equals(WriteMode.WRITE_BEHIND)) { if (!getWriteBatching() && getWriteBatchSize() != 1) { errors.add(new ConfigError("Configured Write Batch Size is not equal to 1 with Write Batching turned off.")); } } } }
/** * Create a new write behind queue. * * @param config the configuration for the queue */ public AbstractWriteBehindQueue(CacheConfiguration config) { this.stopping = false; this.stopped = true; this.cacheName = config.getName(); // making a copy of the configuration locally to ensure that it will not be changed at runtime final CacheWriterConfiguration cacheWriterConfig = config.getCacheWriterConfiguration(); this.minWriteDelayMs = cacheWriterConfig.getMinWriteDelay() * MS_IN_SEC; this.maxWriteDelayMs = cacheWriterConfig.getMaxWriteDelay() * MS_IN_SEC; this.rateLimitPerSecond = cacheWriterConfig.getRateLimitPerSecond(); this.maxQueueSize = cacheWriterConfig.getWriteBehindMaxQueueSize(); this.writeBatching = cacheWriterConfig.getWriteBatching(); this.writeBatchSize = cacheWriterConfig.getWriteBatchSize(); this.retryAttempts = cacheWriterConfig.getRetryAttempts(); this.retryAttemptDelaySeconds = cacheWriterConfig.getRetryAttemptDelaySeconds(); this.processingThread = new Thread(new ProcessingThread(), cacheName + " write-behind"); this.processingThread.setDaemon(true); }
if (!cacheWriterConfiguration.getWriteBatching() && cacheWriterConfiguration.getWriteBatchSize() != 1) { throw new InvalidConfigurationException("CacheWriter Batch Size !=1 and CacheWriter Batching " + "turned off");
@Override public WriteBehind createWriteBehind(Ehcache cache) { final CacheWriterConfiguration config = cache.getCacheConfiguration().getCacheWriterConfiguration(); final AsyncConfig asyncConfig = new WriteBehindAsyncConfig(config.getMinWriteDelay() * 1000, config.getMaxWriteDelay() * 1000, config.getWriteBatching(), config.getWriteBatchSize(), cache.getCacheConfiguration() .getTerracottaConfiguration().isSynchronousWrites(), config.getRetryAttempts(), config.getRetryAttemptDelaySeconds() * 1000, config.getRateLimitPerSecond(), config.getWriteBehindMaxQueueSize()); final AsyncCoordinator asyncCoordinator = asyncCoordinatorFactory.getOrCreateAsyncCoordinator(cache, asyncConfig); return new AsyncWriteBehind(asyncCoordinator, config.getWriteBehindConcurrency()); }
/** * Check for errors/inconsistencies in this configuration. Add any erros found as * {@link ConfigError} in the errors collection. * @param errors collection to add errors to. */ public void validate(Collection<ConfigError> errors) { if (writeMode.equals(WriteMode.WRITE_BEHIND)) { if (!getWriteBatching() && getWriteBatchSize() != 1) { errors.add(new ConfigError("Configured Write Batch Size is not equal to 1 with Write Batching turned off.")); } } } }
/** * Check for errors/inconsistencies in this configuration. Add any erros found as * {@link ConfigError} in the errors collection. * @param errors collection to add errors to. */ public void validate(Collection<ConfigError> errors) { if (writeMode.equals(WriteMode.WRITE_BEHIND)) { if (!getWriteBatching() && getWriteBatchSize() != 1) { errors.add(new ConfigError("Configured Write Batch Size is not equal to 1 with Write Batching turned off.")); } } } }
/** * Check for errors/inconsistencies in this configuration. Add any erros found as * {@link ConfigError} in the errors collection. * @param errors collection to add errors to. */ public void validate(Collection<ConfigError> errors) { if (writeMode.equals(WriteMode.WRITE_BEHIND)) { if (!getWriteBatching() && getWriteBatchSize() != 1) { errors.add(new ConfigError("Write Batch Size !=1 with Write Batching turned off.")); } } } }
addAttribute(new SimpleNodeAttribute("writeMode", cacheWriterConfiguration.getWriteMode()).optional(true).defaultValue( CacheWriterConfiguration.DEFAULT_WRITE_MODE)); addAttribute(new SimpleNodeAttribute("writeBatchSize", cacheWriterConfiguration.getWriteBatchSize()).optional(true).defaultValue( CacheWriterConfiguration.DEFAULT_WRITE_BATCH_SIZE)); addAttribute(new SimpleNodeAttribute("maxWriteDelay", cacheWriterConfiguration.getMaxWriteDelay()).optional(true).defaultValue(
/** * Create a new write behind queue. * * @param config the configuration for the queue */ public AbstractWriteBehindQueue(CacheConfiguration config) { this.stopping = false; this.stopped = true; this.cacheName = config.getName(); // making a copy of the configuration locally to ensure that it will not be changed at runtime final CacheWriterConfiguration cacheWriterConfig = config.getCacheWriterConfiguration(); this.minWriteDelayMs = cacheWriterConfig.getMinWriteDelay() * MS_IN_SEC; this.maxWriteDelayMs = cacheWriterConfig.getMaxWriteDelay() * MS_IN_SEC; this.rateLimitPerSecond = cacheWriterConfig.getRateLimitPerSecond(); this.maxQueueSize = cacheWriterConfig.getWriteBehindMaxQueueSize(); this.writeBatching = cacheWriterConfig.getWriteBatching(); this.writeBatchSize = cacheWriterConfig.getWriteBatchSize(); this.retryAttempts = cacheWriterConfig.getRetryAttempts(); this.retryAttemptDelaySeconds = cacheWriterConfig.getRetryAttemptDelaySeconds(); this.processingThread = new Thread(new ProcessingThread(), cacheName + " write-behind"); this.processingThread.setDaemon(true); }
/** * Create a new write behind queue. * * @param config the configuration for the queue */ public AbstractWriteBehindQueue(CacheConfiguration config) { this.stopping = false; this.stopped = true; this.cacheName = config.getName(); // making a copy of the configuration locally to ensure that it will not be changed at runtime final CacheWriterConfiguration cacheWriterConfig = config.getCacheWriterConfiguration(); this.minWriteDelayMs = cacheWriterConfig.getMinWriteDelay() * MS_IN_SEC; this.maxWriteDelayMs = cacheWriterConfig.getMaxWriteDelay() * MS_IN_SEC; this.rateLimitPerSecond = cacheWriterConfig.getRateLimitPerSecond(); this.maxQueueSize = cacheWriterConfig.getWriteBehindMaxQueueSize(); this.writeBatching = cacheWriterConfig.getWriteBatching(); this.writeBatchSize = cacheWriterConfig.getWriteBatchSize(); this.retryAttempts = cacheWriterConfig.getRetryAttempts(); this.retryAttemptDelaySeconds = cacheWriterConfig.getRetryAttemptDelaySeconds(); this.processingThread = new Thread(new ProcessingThread(), cacheName + " write-behind"); this.processingThread.setDaemon(true); }
if (!cacheWriterConfiguration.getWriteBatching() && cacheWriterConfiguration.getWriteBatchSize() != 1) { throw new InvalidConfigurationException("CacheWriter Batch Size !=1 and CacheWriter Batching " + "turned off");
if (!cacheWriterConfiguration.getWriteBatching() && cacheWriterConfiguration.getWriteBatchSize() != 1) { throw new InvalidConfigurationException("CacheWriter Batch Size !=1 and CacheWriter Batching " + "turned off");
/** * Create a new write behind queue. * * @param config the configuration for the queue */ public AbstractWriteBehindQueue(CacheConfiguration config) { this.stopping = false; this.stopped = true; this.cacheName = config.getName(); // making a copy of the configuration locally to ensure that it will not be changed at runtime final CacheWriterConfiguration cacheWriterConfig = config.getCacheWriterConfiguration(); this.minWriteDelayMs = cacheWriterConfig.getMinWriteDelay() * MS_IN_SEC; this.maxWriteDelayMs = cacheWriterConfig.getMaxWriteDelay() * MS_IN_SEC; this.rateLimitPerSecond = cacheWriterConfig.getRateLimitPerSecond(); this.maxQueueSize = cacheWriterConfig.getWriteBehindMaxQueueSize(); this.writeBatching = cacheWriterConfig.getWriteBatching(); this.writeBatchSize = cacheWriterConfig.getWriteBatchSize(); this.retryAttempts = cacheWriterConfig.getRetryAttempts(); this.retryAttemptDelaySeconds = cacheWriterConfig.getRetryAttemptDelaySeconds(); this.processingThread = new Thread(new ProcessingThread(), cacheName + " write-behind"); this.processingThread.setDaemon(true); }
if (!cacheWriterConfiguration.getWriteBatching() && cacheWriterConfiguration.getWriteBatchSize() != 1) { throw new InvalidConfigurationException("CacheWriter Batch Size !=1 and CacheWriter Batching " + "turned off");
public WriteBehind createWriteBehind(Ehcache cache) { ConcurrentMap<String, ConcurrentMap<String, AsyncCoordinator>> asyncCoordinatorRoot = getAsyncCoordinatorRoot(); String cacheMgrName = cache.getCacheManager().getName(); if (!cache.getCacheManager().isNamed()) { cacheMgrName = DEFAULT_CACHE_MANAGER_NAME; } ConcurrentMap<String, AsyncCoordinator> asyncCoordinatorMap = getOrCreateAsyncCoordinatorMap(asyncCoordinatorRoot, cacheMgrName); final CacheWriterConfiguration config = cache.getCacheConfiguration().getCacheWriterConfiguration(); final AsyncConfig asyncConfig = new WriteBehindAsyncConfig(config.getMinWriteDelay() * 1000, config .getMaxWriteDelay() * 1000, config.getWriteBatching(), config.getWriteBatchSize(), cache .getCacheConfiguration().getTerracottaConfiguration().isSynchronousWrites(), config.getRetryAttempts(), config .getRetryAttemptDelaySeconds() * 1000, config.getRateLimitPerSecond()); AsyncCoordinator asyncCoordinator = getOrCreateAsyncCoordinator(asyncCoordinatorMap, cache, asyncConfig); return new AsyncWriteBehind(asyncCoordinator, cache, getSingletonDsoSerializationStrategy()); }
addAttribute(new SimpleNodeAttribute("writeMode", cacheWriterConfiguration.getWriteMode()).optional(true).defaultValue( CacheWriterConfiguration.DEFAULT_WRITE_MODE)); addAttribute(new SimpleNodeAttribute("writeBatchSize", cacheWriterConfiguration.getWriteBatchSize()).optional(true).defaultValue( CacheWriterConfiguration.DEFAULT_WRITE_BATCH_SIZE)); addAttribute(new SimpleNodeAttribute("maxWriteDelay", cacheWriterConfiguration.getMaxWriteDelay()).optional(true).defaultValue(
addAttribute(new SimpleNodeAttribute("writeMode", cacheWriterConfiguration.getWriteMode()).optional(true).defaultValue( CacheWriterConfiguration.DEFAULT_WRITE_MODE)); addAttribute(new SimpleNodeAttribute("writeBatchSize", cacheWriterConfiguration.getWriteBatchSize()).optional(true).defaultValue( CacheWriterConfiguration.DEFAULT_WRITE_BATCH_SIZE)); addAttribute(new SimpleNodeAttribute("maxWriteDelay", cacheWriterConfiguration.getMaxWriteDelay()).optional(true).defaultValue(
addAttribute(new SimpleNodeAttribute("writeMode", cacheWriterConfiguration.getWriteMode()).optional(true).defaultValue( CacheWriterConfiguration.DEFAULT_WRITE_MODE)); addAttribute(new SimpleNodeAttribute("writeBatchSize", cacheWriterConfiguration.getWriteBatchSize()).optional(true).defaultValue( CacheWriterConfiguration.DEFAULT_WRITE_BATCH_SIZE)); addAttribute(new SimpleNodeAttribute("maxWriteDelay", cacheWriterConfiguration.getMaxWriteDelay()).optional(true).defaultValue(