Examples of ExecutorConfig


Examples of com.hazelcast.config.ExecutorConfig

        } catch (IllegalAccessException ignored) {
        }
    }

    public ManagedExecutorService register(String name, int poolSize, int queueCapacity, ExecutorType type) {
        ExecutorConfig cfg = nodeEngine.getConfig().getExecutorConfigs().get(name);
        if (cfg != null) {
            poolSize = cfg.getPoolSize();
            queueCapacity = cfg.getQueueCapacity() <= 0 ? Integer.MAX_VALUE : cfg.getQueueCapacity();
        }
        ManagedExecutorService executor = createExecutor(name, poolSize, queueCapacity, type);
        if (executors.putIfAbsent(name, executor) != null) {
            throw new IllegalArgumentException("ExecutorService['" + name + "'] already exists!");
        }
View Full Code Here

Examples of com.hazelcast.config.ExecutorConfig

        } catch (FileNotFoundException e) {
            config = new Config();
        }

        for (int k = 1; k <= LOAD_EXECUTORS_COUNT; k++) {
            config.addExecutorConfig(new ExecutorConfig("e" + k).setPoolSize(k));
        }
        TestApp testApp = new TestApp(Hazelcast.newHazelcastInstance(config));
        testApp.start(args);
    }
View Full Code Here

Examples of com.hazelcast.config.ExecutorConfig

    }

    @Override
    public ManagedExecutorService register(String name, int defaultPoolSize, int defaultQueueCapacity,
                                           ExecutorType type) {
        ExecutorConfig cfg = nodeEngine.getConfig().getExecutorConfigs().get(name);

        int poolSize = defaultPoolSize;
        int queueCapacity = defaultQueueCapacity;
        if (cfg != null) {
            poolSize = cfg.getPoolSize();
            if (cfg.getQueueCapacity() <= 0) {
                queueCapacity = Integer.MAX_VALUE;
            } else {
                queueCapacity = cfg.getQueueCapacity();
            }
        }

        ManagedExecutorService executor = createExecutor(name, poolSize, queueCapacity, type);
        if (executors.putIfAbsent(name, executor) != null) {
View Full Code Here

Examples of com.hazelcast.config.ExecutorConfig

        } catch (FileNotFoundException e) {
            config = new Config();
        }

        for (int k = 1; k <= LOAD_EXECUTORS_COUNT; k++) {
            config.addExecutorConfig(new ExecutorConfig("e" + k).setPoolSize(k));
        }
        ConsoleApp consoleApp = new ConsoleApp(Hazelcast.newHazelcastInstance(null));
        consoleApp.start(args);
    }
View Full Code Here

Examples of com.hazelcast.config.ExecutorConfig

        return createSingleNodeExecutorService(name, ExecutorConfig.DEFAULT_POOL_SIZE);
    }

    private IExecutorService createSingleNodeExecutorService(String name, int poolSize) {
        final Config config = new Config();
        config.addExecutorConfig(new ExecutorConfig(name, poolSize));
        final HazelcastInstance instance = createHazelcastInstance(config);
        return instance.getExecutorService(name);
    }
View Full Code Here

Examples of com.hazelcast.config.ExecutorConfig

    }

    @Test
    public void testManagedContextAndLocal() throws Exception {
        final Config config = new Config();
        config.addExecutorConfig(new ExecutorConfig("test", 1));
        final AtomicBoolean initialized = new AtomicBoolean();
        config.setManagedContext(new ManagedContext() {
            @Override
            public Object initialize(Object obj) {
                if (obj instanceof RunnableWithManagedContext) {
View Full Code Here

Examples of com.hazelcast.config.ExecutorConfig

    }

    @Test
    public void hazelcastInstanceAwareAndLocal() throws Exception {
        final Config config = new Config();
        config.addExecutorConfig(new ExecutorConfig("test", 1));
        final HazelcastInstance instance = createHazelcastInstance(config);
        IExecutorService executor = instance.getExecutorService("test");

        HazelcastInstanceAwareRunnable task = new HazelcastInstanceAwareRunnable();
        // if 'setHazelcastInstance' not called we expect a RuntimeException
View Full Code Here

Examples of com.hazelcast.config.ExecutorConfig

    @Test
    public void testStatsIssue2039() throws InterruptedException, ExecutionException, TimeoutException {
        final Config config = new Config();
        final String name = "testStatsIssue2039";
        config.addExecutorConfig(new ExecutorConfig(name).setQueueCapacity(1).setPoolSize(1));
        final HazelcastInstance instance = createHazelcastInstance(config);
        final IExecutorService executorService = instance.getExecutorService(name);


        executorService.execute(new SleepLatchRunnable());
View Full Code Here

Examples of com.hazelcast.config.ExecutorConfig

        assertEquals("spring-group-pass", groupConfig.getPassword());
    }

    @Test
    public void testExecutorConfig() {
        ExecutorConfig testExecConfig = config.getExecutorConfig("testExec");
        assertNotNull(testExecConfig);
        assertEquals("testExec", testExecConfig.getName());
        assertEquals(2, testExecConfig.getPoolSize());
        assertEquals(100, testExecConfig.getQueueCapacity());
        ExecutorConfig testExec2Config = config.getExecutorConfig("testExec2");
        assertNotNull(testExec2Config);
        assertEquals("testExec2", testExec2Config.getName());
        assertEquals(5, testExec2Config.getPoolSize());
        assertEquals(300, testExec2Config.getQueueCapacity());
    }
View Full Code Here

Examples of com.hazelcast.config.ExecutorConfig

        } catch (FileNotFoundException e) {
            config = new Config();
        }

        for (int k = 1; k <= LOAD_EXECUTORS_COUNT; k++) {
            config.addExecutorConfig(new ExecutorConfig("e" + k).setPoolSize(k));
        }
        ConsoleApp consoleApp = new ConsoleApp(Hazelcast.newHazelcastInstance(config));
        consoleApp.start(args);
    }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.