Package com.asakusafw.runtime.util.lock

Examples of com.asakusafw.runtime.util.lock.ConstantRetryStrategy


            long retryInterval = configuration.getLong(KEY_CACHE_RETRY_INTERVAL, DEFAULT_CACHE_RETRY_INTERVAL);
            FileCacheRepository unit = new HadoopFileCacheRepository(
                    configuration,
                    repositoryPath,
                    new LocalFileLockProvider<Path>(new File(temporary, PATH_LOCK_DIRECTORY)),
                    new ConstantRetryStrategy(retryCount, retryInterval));
            ExecutorService executor = Executors.newFixedThreadPool(threads, DAEMON_THREAD_FACTORY);
            try {
                BatchFileCacheRepository repo = new ConcurrentBatchFileCacheRepository(unit, executor);
                return repo.resolve(libraryPaths);
            } finally {
View Full Code Here


    @Test
    public void simple() throws Exception {
        File cacheRepo = folder.newFolder();
        Configuration configuration = new ConfigurationProvider().newInstance();
        LockProvider<Path> locks = new LocalFileLockProvider<Path>(folder.newFolder());
        RetryStrategy retrier = new ConstantRetryStrategy();
        HadoopFileCacheRepository cache = new HadoopFileCacheRepository(configuration, path(cacheRepo), locks, retrier);

        File source = put(folder.newFile(), "Hello, world!");
        Path resolved = cache.resolve(path(source));
View Full Code Here

    @Test
    public void update() throws Exception {
        File cacheRepo = folder.newFolder();
        Configuration configuration = new ConfigurationProvider().newInstance();
        LockProvider<Path> locks = new LocalFileLockProvider<Path>(folder.newFolder());
        RetryStrategy retrier = new ConstantRetryStrategy();
        HadoopFileCacheRepository cache = new HadoopFileCacheRepository(configuration, path(cacheRepo), locks, retrier);

        File source = put(folder.newFile(), "Hello, world!");
        Path first = cache.resolve(path(source));
View Full Code Here

    @Test
    public void cached() throws Exception {
        File cacheRepo = folder.newFolder();
        Configuration configuration = new ConfigurationProvider().newInstance();
        LockProvider<Path> locks = new LocalFileLockProvider<Path>(folder.newFolder());
        RetryStrategy retrier = new ConstantRetryStrategy();
        HadoopFileCacheRepository cache = new HadoopFileCacheRepository(configuration, path(cacheRepo), locks, retrier);

        File source = put(folder.newFile(), "Hello, world!");
        Path first = cache.resolve(path(source));
        long timestamp = file(first).lastModified();
View Full Code Here

        final Path path = path(source);
        File cacheRepo = folder.newFolder();
        Configuration configuration = new ConfigurationProvider().newInstance();
        LockProvider<Path> locks = new LocalFileLockProvider<Path>(folder.newFolder());
        RetryStrategy retrier = new ConstantRetryStrategy(30, 100, 200);
        final FileCacheRepository cache = new HadoopFileCacheRepository(configuration, path(cacheRepo), locks, retrier);

        List<Future<Path>> futures = new ArrayList<Future<Path>>();
        int count = 10;
        final CountDownLatch latch = new CountDownLatch(count);
View Full Code Here

TOP

Related Classes of com.asakusafw.runtime.util.lock.ConstantRetryStrategy

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.