Package net.sf.ehcache.config

Examples of net.sf.ehcache.config.CacheWriterConfiguration


            cfg.copyOnRead(true).copyOnWrite(true)
                .addCopyStrategy(copyStrategyConfiguration);
        }
        if(configuration instanceof CompleteConfiguration) {
            if(((CompleteConfiguration)configuration).isWriteThrough()) {
                cfg.addCacheWriter(new CacheWriterConfiguration().writeMode(CacheWriterConfiguration.WriteMode.WRITE_THROUGH));
            }
        }
        return cfg;
    }
View Full Code Here


                .getElementValueComparatorConfiguration();
        if (elementValueComparatorConfiguration != null
                && !elementValueComparatorConfiguration.equals(CacheConfiguration.DEFAULT_ELEMENT_VALUE_COMPARATOR_CONFIGURATION)) {
            element.addChildElement(new ElementValueComparatorConfigurationElement(element, elementValueComparatorConfiguration));
        }
        CacheWriterConfiguration cacheWriterConfiguration = cacheConfiguration.getCacheWriterConfiguration();
        if (cacheWriterConfiguration != null && !CacheConfiguration.DEFAULT_CACHE_WRITER_CONFIGURATION.equals(cacheWriterConfiguration)) {
            element.addChildElement(new CacheWriterConfigurationElement(element, cacheWriterConfiguration));
        }
        addAllFactoryConfigsAsChildElements(element, "cacheDecoratorFactory", cacheConfiguration.getCacheDecoratorConfigurations());
        TerracottaConfiguration terracottaConfiguration = cacheConfiguration.getTerracottaConfiguration();
View Full Code Here

     *
     * @param cacheConfiguration the cache configuration
     * @param cache              the cache
     */
    private static void registerCacheWriter(CacheConfiguration cacheConfiguration, Ehcache cache) {
        CacheWriterConfiguration config = cacheConfiguration.getCacheWriterConfiguration();
        if (config != null) {
            CacheWriter cacheWriter = createCacheWriter(config, cache);
            cache.registerCacheWriter(cacheWriter);
        }
    }
View Full Code Here

     * required by the {@link net.sf.ehcache.config.CacheWriterConfiguration#getWriteBehindConcurrency}
     *
     * @param config the configuration for the queue
     */
    public WriteBehindQueueManager(CacheConfiguration config) {
        CacheWriterConfiguration cacheWriterConfiguration = config.getCacheWriterConfiguration();
        int writeBehindConcurrency = cacheWriterConfiguration.getWriteBehindConcurrency();
        for (int i = 0; i < writeBehindConcurrency; i++) {
            this.queues.add(new WriteBehindQueue(config));
        }
    }
View Full Code Here

        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);
    }
View Full Code Here

    public int getWriterMaxQueueSize() {
        int result = 0;
        for (String cacheName : getCacheNames()) {
            Ehcache cache = cacheManager.getEhcache(cacheName);
            if (cache != null) {
                CacheWriterConfiguration writerConfig = cache.getCacheConfiguration().getCacheWriterConfiguration();
                result += (writerConfig.getWriteBehindMaxQueueSize() * writerConfig.getWriteBehindConcurrency());
            }
        }
        return result;
    }
View Full Code Here

TOP

Related Classes of net.sf.ehcache.config.CacheWriterConfiguration

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.