Package com.asakusafw.yaess.core

Examples of com.asakusafw.yaess.core.ExecutionLockProvider


        Map<String, String> conf = new HashMap<String, String>();
        conf.put(BasicLockProvider.KEY_DIRECTORY, lockDir.getAbsolutePath());

        ServiceProfile<ExecutionLockProvider> profile = new ServiceProfile<ExecutionLockProvider>(
                "testing", BasicLockProvider.class, conf, ProfileContext.system(getClass().getClassLoader()));
        ExecutionLockProvider instance = profile.newInstance();
        ExecutionLock lock = instance.newInstance("batch");
        try {
            lock.beginFlow("flow", "exec");
            assertThat(lockDir.list().length, is(greaterThan(start)));
        } finally {
            lock.close();
View Full Code Here


        Map<String, String> conf = new HashMap<String, String>();
        conf.put(BasicLockProvider.KEY_DIRECTORY, "${LOCATION}");

        ServiceProfile<ExecutionLockProvider> profile = new ServiceProfile<ExecutionLockProvider>(
                "testing", BasicLockProvider.class, conf, new ProfileContext(getClass().getClassLoader(), var));
        ExecutionLockProvider instance = profile.newInstance();
        ExecutionLock lock = instance.newInstance("batch");
        try {
            lock.beginFlow("flow", "exec");
            assertThat(lockDir.list().length, is(greaterThan(start)));
        } finally {
            lock.close();
View Full Code Here

        conf.put(BasicLockProvider.KEY_DIRECTORY, folder.getRoot().getAbsolutePath());
        conf.put(ExecutionLockProvider.KEY_SCOPE, ExecutionLock.Scope.WORLD.getSymbol());

        ServiceProfile<ExecutionLockProvider> profile = new ServiceProfile<ExecutionLockProvider>(
                "testing", BasicLockProvider.class, conf, ProfileContext.system(getClass().getClassLoader()));
        ExecutionLockProvider instance1 = profile.newInstance();
        ExecutionLockProvider instance2 = profile.newInstance();

        ExecutionLock lock = instance1.newInstance("batch1");
        try {
            try {
                instance2.newInstance("batch1");
                fail("cannot run same batch");
            } catch (IOException e) {
                // ok.
            }
            try {
                instance2.newInstance("batch2");
                fail("cannot run any batch");
            } catch (IOException e) {
                // ok.
            }
            // can acquire any flow/exec lock in same
View Full Code Here

        conf.put(BasicLockProvider.KEY_DIRECTORY, folder.getRoot().getAbsolutePath());
        conf.put(ExecutionLockProvider.KEY_SCOPE, ExecutionLock.Scope.BATCH.getSymbol());

        ServiceProfile<ExecutionLockProvider> profile = new ServiceProfile<ExecutionLockProvider>(
                "testing", BasicLockProvider.class, conf, ProfileContext.system(getClass().getClassLoader()));
        ExecutionLockProvider instance1 = profile.newInstance();
        ExecutionLockProvider instance2 = profile.newInstance();

        ExecutionLock lock = instance1.newInstance("batch1");
        try {
            lock.beginFlow("flow1", "exec1");
            try {
                instance2.newInstance("batch1");
                fail("cannot run same batch");
            } catch (IOException e) {
                // ok.
            }
            ExecutionLock other = instance2.newInstance("batch2");
            try {
                // can acquire any flow/exec lock
                other.beginFlow("flow2", "exec1");
                other.endFlow("flow2", "exec1");
                other.beginFlow("flow1", "exec2");
View Full Code Here

        conf.put(BasicLockProvider.KEY_DIRECTORY, folder.getRoot().getAbsolutePath());
        conf.put(ExecutionLockProvider.KEY_SCOPE, ExecutionLock.Scope.FLOW.getSymbol());

        ServiceProfile<ExecutionLockProvider> profile = new ServiceProfile<ExecutionLockProvider>(
                "testing", BasicLockProvider.class, conf, ProfileContext.system(getClass().getClassLoader()));
        ExecutionLockProvider instance1 = profile.newInstance();
        ExecutionLockProvider instance2 = profile.newInstance();

        ExecutionLock lock = instance1.newInstance("batch1");
        try {
            lock.beginFlow("flow1", "exec1");
            ExecutionLock other = instance2.newInstance("batch1");
            try {
                // can acquire other flow lock
                other.beginFlow("flow2", "exec1");
                other.endFlow("flow2", "exec1");
                other.beginFlow("flow2", "exec2");
                other.endFlow("flow2", "exec2");

                try {
                    other.beginFlow("flow1", "exec2");
                    fail("cannot run same flow");
                } catch (IOException e) {
                    // ok.
                }
            } finally {
                other.close();
            }

            other = instance2.newInstance("batch2");
            try {
                // can acquire any flow lock if batch is different
                other.beginFlow("flow1", "exec1");
            } finally {
                other.close();
View Full Code Here

        conf.put(BasicLockProvider.KEY_DIRECTORY, folder.getRoot().getAbsolutePath());
        conf.put(ExecutionLockProvider.KEY_SCOPE, ExecutionLock.Scope.EXECUTION.getSymbol());

        ServiceProfile<ExecutionLockProvider> profile = new ServiceProfile<ExecutionLockProvider>(
                "testing", BasicLockProvider.class, conf, ProfileContext.system(getClass().getClassLoader()));
        ExecutionLockProvider instance1 = profile.newInstance();
        ExecutionLockProvider instance2 = profile.newInstance();

        ExecutionLock lock = instance1.newInstance("batch1");
        try {
            lock.beginFlow("flow1", "exec1");
            ExecutionLock other = instance2.newInstance("batch1");
            try {
                // can acquire other flow lock
                other.beginFlow("flow2", "exec1");
                other.endFlow("flow2", "exec1");
                other.beginFlow("flow2", "exec2");
                other.endFlow("flow2", "exec2");

                // can acquire other execution lock
                other.beginFlow("flow1", "exec2");
                other.endFlow("flow1", "exec2");

                try {
                    other.beginFlow("flow1", "exec1");
                    fail("cannot run same execution");
                } catch (IOException e) {
                    // ok.
                }
            } finally {
                other.close();
            }

            other = instance2.newInstance("batch2");
            try {
                // can acquire any flow lock if batch is different
                other.beginFlow("flow1", "exec1");
            } finally {
                other.close();
View Full Code Here

        Map<String, String> conf = new HashMap<String, String>();
        conf.put(BasicLockProvider.KEY_DIRECTORY, lockDir.getAbsolutePath());

        ServiceProfile<ExecutionLockProvider> profile = new ServiceProfile<ExecutionLockProvider>(
                "testing", BasicLockProvider.class, conf, ProfileContext.system(getClass().getClassLoader()));
        ExecutionLockProvider instance = profile.newInstance();
        ExecutionLock lock = instance.newInstance("batch");
        try {
            lock.beginFlow("a", "b");
            lock.endFlow("a", "b");
        } finally {
            lock.close();
View Full Code Here

    @Test(expected = IOException.class)
    public void missing_directory_config() throws Exception {
        Map<String, String> conf = new HashMap<String, String>();
        ServiceProfile<ExecutionLockProvider> profile = new ServiceProfile<ExecutionLockProvider>(
                "testing", BasicLockProvider.class, conf, ProfileContext.system(getClass().getClassLoader()));
        ExecutionLockProvider instance = profile.newInstance();
        instance.newInstance("batch");
    }
View Full Code Here

        Map<String, String> conf = new HashMap<String, String>();
        conf.put(BasicLockProvider.KEY_DIRECTORY, lockDir.getAbsolutePath());

        ServiceProfile<ExecutionLockProvider> profile = new ServiceProfile<ExecutionLockProvider>(
                "testing", BasicLockProvider.class, conf, ProfileContext.system(getClass().getClassLoader()));
        ExecutionLockProvider instance = profile.newInstance();
        instance.newInstance("batch");
    }
View Full Code Here

        }
        LOG.debug("Loading execution monitor feature");
        ExecutionMonitorProvider monitors = profile.getMonitors().newInstance();

        LOG.debug("Loading execution lock feature");
        ExecutionLockProvider locks = profile.getLocks().newInstance();

        LOG.debug("Loading job scheduling feature");
        JobScheduler scheduler = profile.getScheduler().newInstance();

        LOG.debug("Loading hadoop execution feature");
View Full Code Here

TOP

Related Classes of com.asakusafw.yaess.core.ExecutionLockProvider

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.