Question

I'm looking into using the hazelcast distributed Executor functionality, however het HazelcastClient.getExecutor(String name) confuses me.

if i run one 'server' instance like so:

Config config = new 
ExecutorConfig executorConfig = new ExecutorConfig("name");
config.addExecutorConfig(executorConfig);
HazelcastInstance instance = Hazelcast.newHazelcastInstance(config);

This create a hazelcast node with executorConfig named 'name' Considering this is the only ExecutorConfig for this instance i would expect to be able to submit Callables on this node on the executorService named 'name'

However if run the following (in a different process or machine)

HazelcastInstance client = HazelcastClient.newHazelcastClient(config);
CallableTest test = new CallableTest(); //callable that does sleep and sysout
IExecutorService executorService = client.getExecutorService("wrong_name");
executorService.submit(test);

the callable job gets submitted to the 'server' process and gets excecuted. This seems weird to. i would expect to be able to manage the constraints of its executors. The fact that this job gets executed even though there is no executorService with the name 'wrong_name' seem strange.

This leaves me wondering what the executor name is used for and how i can properly configure these executors.

Was it helpful?

Solution

Hazelcast will automatically create an executor with the given name. There is no restriction on the name; you don't need to configure it.

I can imagine that it feels a bit strange.

In short, make sure that you configure the name(s) correctly.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top