How to serialize the programmatically comment insertion?
We have a Plain Java Client to programmatically add comments to existing work-items.
The snippet of code we use is:
ITeamRepository repo = ...String msg = ...WorkItemWorkingCopy workingCopy = ...IWorkItem wiFreshCopy = workingCopy.getWorkItem();IComments comments = wiFreshCopy.getComments();IComment comment = comments.createComment(repo.loggedInContributor(), XMLString.createFromPlainText(msg));comments.append(comment);workingCopy.save(null);
When two (or more) processes try to add a new comment to the same work-item at the same time, only the last comment will be included.
How can we serialize the comment insertion? Why using a working copy is not enough?
Thanks in advance.
Cheers.