Search in sources :

Example 21 with ExecutorConfig

use of com.hazelcast.config.ExecutorConfig in project hazelcast by hazelcast.

the class MemberDomConfigProcessor method handleExecutor.

protected void handleExecutor(Node node) throws Exception {
    String name = getTextContent(getNamedItemNode(node, "name"));
    ExecutorConfig executorConfig = ConfigUtils.getByNameOrNew(config.getExecutorConfigs(), name, ExecutorConfig.class);
    handleViaReflection(node, config, executorConfig);
}
Also used : ExecutorConfig(com.hazelcast.config.ExecutorConfig) ScheduledExecutorConfig(com.hazelcast.config.ScheduledExecutorConfig) DurableExecutorConfig(com.hazelcast.config.DurableExecutorConfig)

Example 22 with ExecutorConfig

use of com.hazelcast.config.ExecutorConfig in project hazelcast by hazelcast.

the class YamlMemberDomConfigProcessor method handleExecutor.

@Override
protected void handleExecutor(Node node) throws Exception {
    for (Node executorNode : childElements(node)) {
        ExecutorConfig executorConfig = ConfigUtils.getByNameOrNew(config.getExecutorConfigs(), executorNode.getNodeName(), ExecutorConfig.class);
        handleViaReflection(executorNode, config, executorConfig);
    }
}
Also used : Node(org.w3c.dom.Node) YamlNode(com.hazelcast.internal.yaml.YamlNode) ExecutorConfig(com.hazelcast.config.ExecutorConfig) ScheduledExecutorConfig(com.hazelcast.config.ScheduledExecutorConfig) DurableExecutorConfig(com.hazelcast.config.DurableExecutorConfig)

Example 23 with ExecutorConfig

use of com.hazelcast.config.ExecutorConfig in project hazelcast by hazelcast.

the class ConfigSearchTest method testExecutorConfig_Dynamic.

@Test
public void testExecutorConfig_Dynamic() {
    TestCase<ExecutorConfig> testCase = new TestCase<ExecutorConfig>(new ExecutorConfig(STATIC_NAME), new ExecutorConfig(DYNAMIC_NAME), true) {

        @Override
        void addStaticConfig(Config config) {
            config.addExecutorConfig(this.staticConfig);
        }

        @Override
        void addDynamicConfig(HazelcastInstance hazelcastInstance) {
            hazelcastInstance.getConfig().addExecutorConfig(this.dynamicConfig);
        }

        @Override
        void asserts() {
            ExecutorConfig dataConfig = hazelcastInstance.getConfig().findExecutorConfig(DYNAMIC_NAME);
            assertThat(dataConfig.getName(), equalTo(DYNAMIC_NAME));
        }
    };
    testTemplate(testCase);
}
Also used : HazelcastInstance(com.hazelcast.core.HazelcastInstance) ListConfig(com.hazelcast.config.ListConfig) SetConfig(com.hazelcast.config.SetConfig) PNCounterConfig(com.hazelcast.config.PNCounterConfig) QueueConfig(com.hazelcast.config.QueueConfig) ReliableTopicConfig(com.hazelcast.config.ReliableTopicConfig) CacheSimpleConfig(com.hazelcast.config.CacheSimpleConfig) MapConfig(com.hazelcast.config.MapConfig) CardinalityEstimatorConfig(com.hazelcast.config.CardinalityEstimatorConfig) MultiMapConfig(com.hazelcast.config.MultiMapConfig) RingbufferConfig(com.hazelcast.config.RingbufferConfig) ExecutorConfig(com.hazelcast.config.ExecutorConfig) ScheduledExecutorConfig(com.hazelcast.config.ScheduledExecutorConfig) TopicConfig(com.hazelcast.config.TopicConfig) Config(com.hazelcast.config.Config) DurableExecutorConfig(com.hazelcast.config.DurableExecutorConfig) FlakeIdGeneratorConfig(com.hazelcast.config.FlakeIdGeneratorConfig) ReplicatedMapConfig(com.hazelcast.config.ReplicatedMapConfig) ExecutorConfig(com.hazelcast.config.ExecutorConfig) ScheduledExecutorConfig(com.hazelcast.config.ScheduledExecutorConfig) DurableExecutorConfig(com.hazelcast.config.DurableExecutorConfig) ParallelJVMTest(com.hazelcast.test.annotation.ParallelJVMTest) QuickTest(com.hazelcast.test.annotation.QuickTest) Test(org.junit.Test)

Example 24 with ExecutorConfig

use of com.hazelcast.config.ExecutorConfig in project hazelcast by hazelcast.

the class ConfigSearchTest method testExecutorConfig_Static.

@Test
public void testExecutorConfig_Static() {
    TestCase<ExecutorConfig> testCase = new TestCase<ExecutorConfig>(new ExecutorConfig(STATIC_NAME), new ExecutorConfig(DYNAMIC_NAME), false) {

        @Override
        void addStaticConfig(Config config) {
            config.addExecutorConfig(this.staticConfig);
        }

        @Override
        void addDynamicConfig(HazelcastInstance hazelcastInstance) {
            hazelcastInstance.getConfig().addExecutorConfig(this.dynamicConfig);
        }

        @Override
        void asserts() {
            ExecutorConfig dataConfig = hazelcastInstance.getConfig().findExecutorConfig(DYNAMIC_NAME);
            assertThat(dataConfig.getName(), equalTo(STATIC_NAME));
        }
    };
    testTemplate(testCase);
}
Also used : HazelcastInstance(com.hazelcast.core.HazelcastInstance) ListConfig(com.hazelcast.config.ListConfig) SetConfig(com.hazelcast.config.SetConfig) PNCounterConfig(com.hazelcast.config.PNCounterConfig) QueueConfig(com.hazelcast.config.QueueConfig) ReliableTopicConfig(com.hazelcast.config.ReliableTopicConfig) CacheSimpleConfig(com.hazelcast.config.CacheSimpleConfig) MapConfig(com.hazelcast.config.MapConfig) CardinalityEstimatorConfig(com.hazelcast.config.CardinalityEstimatorConfig) MultiMapConfig(com.hazelcast.config.MultiMapConfig) RingbufferConfig(com.hazelcast.config.RingbufferConfig) ExecutorConfig(com.hazelcast.config.ExecutorConfig) ScheduledExecutorConfig(com.hazelcast.config.ScheduledExecutorConfig) TopicConfig(com.hazelcast.config.TopicConfig) Config(com.hazelcast.config.Config) DurableExecutorConfig(com.hazelcast.config.DurableExecutorConfig) FlakeIdGeneratorConfig(com.hazelcast.config.FlakeIdGeneratorConfig) ReplicatedMapConfig(com.hazelcast.config.ReplicatedMapConfig) ExecutorConfig(com.hazelcast.config.ExecutorConfig) ScheduledExecutorConfig(com.hazelcast.config.ScheduledExecutorConfig) DurableExecutorConfig(com.hazelcast.config.DurableExecutorConfig) ParallelJVMTest(com.hazelcast.test.annotation.ParallelJVMTest) QuickTest(com.hazelcast.test.annotation.QuickTest) Test(org.junit.Test)

Example 25 with ExecutorConfig

use of com.hazelcast.config.ExecutorConfig in project hazelcast by hazelcast.

the class ExecutorServiceTest method hazelcastInstanceAwareAndLocal.

@Test
public void hazelcastInstanceAwareAndLocal() throws Exception {
    Config config = smallInstanceConfig();
    config.addExecutorConfig(new ExecutorConfig("test", 1));
    HazelcastInstance instance = createHazelcastInstance(config);
    IExecutorService executor = instance.getExecutorService("test");
    HazelcastInstanceAwareRunnable task = new HazelcastInstanceAwareRunnable();
    // if 'setHazelcastInstance' not called we expect a RuntimeException
    executor.submit(task).get();
}
Also used : HazelcastInstance(com.hazelcast.core.HazelcastInstance) ExecutorConfig(com.hazelcast.config.ExecutorConfig) Config(com.hazelcast.config.Config) IExecutorService(com.hazelcast.core.IExecutorService) ExecutorConfig(com.hazelcast.config.ExecutorConfig) ParallelJVMTest(com.hazelcast.test.annotation.ParallelJVMTest) QuickTest(com.hazelcast.test.annotation.QuickTest) Test(org.junit.Test)

Aggregations

ExecutorConfig (com.hazelcast.config.ExecutorConfig)30 DurableExecutorConfig (com.hazelcast.config.DurableExecutorConfig)15 ScheduledExecutorConfig (com.hazelcast.config.ScheduledExecutorConfig)15 Config (com.hazelcast.config.Config)12 Test (org.junit.Test)11 QuickTest (com.hazelcast.test.annotation.QuickTest)10 HazelcastInstance (com.hazelcast.core.HazelcastInstance)9 ParallelJVMTest (com.hazelcast.test.annotation.ParallelJVMTest)9 IExecutorService (com.hazelcast.core.IExecutorService)6 CacheSimpleConfig (com.hazelcast.config.CacheSimpleConfig)5 CardinalityEstimatorConfig (com.hazelcast.config.CardinalityEstimatorConfig)5 FlakeIdGeneratorConfig (com.hazelcast.config.FlakeIdGeneratorConfig)5 ListConfig (com.hazelcast.config.ListConfig)5 MapConfig (com.hazelcast.config.MapConfig)5 MultiMapConfig (com.hazelcast.config.MultiMapConfig)5 PNCounterConfig (com.hazelcast.config.PNCounterConfig)5 QueueConfig (com.hazelcast.config.QueueConfig)5 ReliableTopicConfig (com.hazelcast.config.ReliableTopicConfig)5 ReplicatedMapConfig (com.hazelcast.config.ReplicatedMapConfig)5 RingbufferConfig (com.hazelcast.config.RingbufferConfig)5