executableTag.updateCurrentValue() sometimes doesn't work

Hi,

I’m trying to update Tag values from within my module. The code is more or less this:

TagProvider provider = context.getTagManager().getTagProvider("default"); Tag tag = provider.getTag(path); if (tag instanceof ExecutableTag) { ((ExecutableTag)tag).updateCurrentValue(new BasicTagValue(1, DataQuality.GOOD_DATA)); }

The problem I’m having is, this code works from certain threads but not from others.

Works well from: Web server threads, servicing incoming connections. TagChangeEvent calls.
Doesn’t work from: Tasks registered with the ExecutionManager. Other Threads I start manually. (I use this task to mark Tags as STALE if not updated after a certain amount of time).

I’m testing with the built-in realtime memory tags provider.

Any insight here would be greatly appreciated.

Cheers
Ivan

Some more information:

The issue seems to be related to using a quality other than “GOOD_DATA”. If I use GOOD_DATA then updates work from any context.

If I use “STALE”, then when debugging I notice within updateCurrentValue() there is a call to check if isGoodData(). The update aborts there.

What puzzles me is that I am able to update to “STALE” or “WRITE_PENDING” from other contexts.

Help here would be appreciated. My goal is to set Tag quality to “STALE” if not updated after a certain timeout.

I’m also updating quality to “WRITE_PENDING” by subscribing to TagChangeEvent (Property==Value) and that is working fine (from within tagChanged(TagChangeEvent evt)).

Cheers
Ivan

And a little more information…

I am now testing with a Database Driving Provider. Quality is successfully changed to Stale. But then if I write a new value with “GOOD_DATA” the quality remains STALE.

Maybe there is something about STALE quality I don’t understand?