ExecutionEngine question

I would like to know what is the difference between using the ExequtionManager you can get from the context and the implementation BasicExecutionEngine. And is there is some documentation from the later apart from the docs. We have the problem that when restarting a module, using the BasicExectuitonEngine, the threads from it are not closing and remain there untili you restart Ignition.

Do you really need your own BasicExecutionEngine or can you use the shared one? Are you shutting down your BasicExecutionEngine? Are you using daemon threads?

I don’t need to use my own engine. Is better to use the shared one. We are not closing the engine at the end. I see the daemon thread at the docs but I don’t know what behaviour it has.

Well, use the shared one if you can, and if you decide to use your own you need to shut it down when your module’s shutdown hook runs.

Now I’m using the method BasicExecutionEngine.shutdown() during the shutdown of the module and seems to work fine. Is this correct? Would love to know if there is some info that explains the diferences between using the ExecutionEngine of the context and one of your own. Thanks!

If you use your own, shut it down during your module shutdown, but don’t shut down the shared one from the context.

The only real difference is that when you create your own it adds (yet another) thread pool to the system. If you’re module is going to be using that thread pool very heavily it might be appropriate to create your own. Otherwise using the shared one is fine.

Ok. Thank you. I was using the shared one in one module and of course didn’t close it (because is a resource of the system and other threads are running). But other developer, using my code as starting point, started a new module creating its on executionEngine. Of course, he didn’t close it in the shutdown because I dindn’t close the shared in my code, so there started the problem with the threads. And we had this discussion about using the shared or using the other, but we couldn’t settle the matter because the lack of info. Can you tell us how much threads is considered heavily used? We have almost 20 listeners that start an executeOnce task, and in a minute each listener can be called between 2-4 times.

I think it’s probably fine for you to create your own. You can also use the standard Java ExecutorService/ScheduledExecutorService instead of the BasicExecutionEngine, which is just wrapping one of those anyway.

Thank you. I will take a look to the java docs to decide what solution is the best.