Display the number of running rule threads

Tags: #<Tag:0x00007fc9004dac30>


i’ m looking for a way to display the number of running rule threads.
Someone knows a simple way or is this binding the only solution?

Thanks for our help.

display where and how?

The best approach would be an item. So it would be possible to persist the threads and investigate later. But each idea is welcome.

I need this during the development from rules.
I have rules to control rollershutters. For each shutter exist a shadow shutter (hashmap) to store the current position. The shutter are controllable by UI in predefined steps, up/down/stop and with wall plugs.
To detect control with wall plugs is it nessesary to monitoring relay contacts. These contacts are in a group and the members are triggering a rule.
Then at the same time many shutter drive this rule is triggered frequently. But each trigger is nessesary to calculate the correct position.

Sometimes works everything well and sometimes the shadow modell is broken.

I mean the reason is the limited thread pool for running rules but the best is to see the count of threads and not to guess.

In that case i know if no other way. All the other ways involve running something from the command line or the karaf console.

Unless your have more than five of these rules routinely running at the same time and the rules take an extended amount of time to complete ( e.g. using Thread::sleep or use long running calls) this is unlikely to be your problem. If you do, then you need to focus on making your rules run as quickly as possible by using timers instead of sleeps and moving the calls to long running actions outside of the critical path of these rules.

Thanks rich for your answer.
Can you please explain the way outside the rule. It’s only for developing so this is completely OK.

I must check the idea with the rule threads. The error is really tricky.

I’m using the lcn binding and I guess that sometimes that a trigger in the query is lost. In the moment I have increased the maximum rule threads and it works fine. But I remember me you called it aspirin fix. :thinking:

If you log into the karaf console you can run threads and it will give you the current status of all the running threads in karaf. You will probably want to filter them down to just the Rules threads.

You can also see what threads are being used using top. See