# triggeringItem problem (concurrency?)

**URL:** <https://community.openhab.org/t/triggeringitem-problem-concurrency/77823>\
**Category:** Scripts & Rules\
**Created:** [July 11, 2019, 5:49am UTC](https://community.openhab.org/t/triggeringitem-problem-concurrency/77823 "2019-07-11T05:49:38Z")\
**Posts on this page:** 1\
**Showing post:** 3

<div class="post-metadata">

**Author:** ![rossko57](https://community.openhab.org/user_avatar/community.openhab.org/rossko57/32/70263_2.png) [@rossko57](https://community.openhab.org/u/rossko57)\
**Post date:** [July 11, 2019, 10:15am UTC](https://community.openhab.org/t/triggeringitem-problem-concurrency/77823/3 "2019-07-11T10:15:48Z")

</div>

Looking at the events log. two different timers execute practically simultaneously. Both announce themselves with logWarn “fired”.  
Then it looks like one gets to the next logWarn “New value”, but the other timer blows up with a `null` error before it gets to that point.

Of note, the map-array doesn’t get used in the timer code before “New value”.

I don’t think there is firm doctrine on this, but I believe concurrent access of Group members while updates are going on can give null results, so I’d point the finger at the `.members` action. Rich @rlkoshak may have a view here.

If it were me, I would put a queuing lock on the timer execution block.

But it might be worth trying the other direct registry method to retrieve members.

> [@Design Pattern: Associated Items](https://community.openhab.org/t/design-pattern-associated-items/15790):
>
> Edit: Updates for OH 4 Please see [Design Pattern: What is a Design Pattern and How Do I Use Them](https://community.openhab.org/t/design-pattern-what-is-a-design-pattern-and-how-do-i-use-them/40319) for how to read and use DPs. Problem Statement Often one will have a number of separate Items which are all related to each other in some way. For example, one might have a Contact on a door and a DateTime to represent when the last time the door was opened. This is easy enough to keep track of if there are only one or two such Items, but if one has a lot of similar Items or is using a lot of gener…

Be interested to know if that helps - my own code has `.members.findFirst` etc. with locks, be useful to know if direct registry read was more robust.

---

_[View the full topic](https://community.openhab.org/t/triggeringitem-problem-concurrency/77823)._
