Race condition in rules

Hello. I have got two switches (named ARollerUp and ARollerDown) as items and they must never be in the same state, so possible is only ARollerUp = ON && ARollerDown = OFF and vice versa. I tried the following 2 rules for realising that:

rule "ARollerUp"
	when
		Item ARollerUp received command
	then
		lock.lock()
		try{
			if(receivedCommand==OFF){
				sendCommand(ARollerDown, ON)
			}
			if(receivedCommand==ON){
				sendCommand(ARollerDown, OFF)
			}
		}
		finally{ lock.unlock()}
end

rule "ARollerDown"
	when
		Item ARollerDown received command
	then
		lock.lock()
		try{
			if(receivedCommand==OFF){
				sendCommand(ARollerUp, ON)
			}
			if(receivedCommand==ON){
				sendCommand(ARollerUp, OFF)
			}
		}
		finally{ lock.unlock()}
end

The problem ist: when I change one state, both states start toggling infinitively. They start switching from one state to the other without any end. I think the action of one rule always triggers the other rule. How can I avoid that? E.g. when I switch ARollerUp to OFF, I only want ARollerDown to switch to ON and so on.

It’s not a race,its a simple cause-effect chain forming a loop.

Presumably these Items are linked to some device, so that you do need to send commands so that they control relays or whatever?
One approach is to have a third Item that controls the originals. When that is made say “up”, a rule sets the two originals as needed, when made “down” another rule … blah blah. You could also have something else happen when it was neither up nor down, if you wanted.