TagProvider.writeAsync completion condition

We are calling TagProvider.writeAsync to reset a boolean trigger tag using the following line:

results = provider.writeAsync(paths, values, SecurityContext.emptyContext()).get(timeout, TimeUnit.MILLISECONDS);

I am not sure how writeAsync determines completion since the javadoc does not list any comments for it, ie. immediately after it completes without exception is the tag guaranteed to read as the updated value. (We have a loop that checks the trigger and want to avoid double operations)

Or would it be necessary to add code that reads the tag and stops progression until it reads as the new value.

When the CompletableFuture completes successfully then you can assume a subsequent read will read that value (or possibly another, if you were competing with a concurrent write).

edit: assuming the corresponding QualityCode result was good, of course.

1 Like