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);
}
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);
}
}
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);
}
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);
}
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();
}
Aggregations