In my application, I have a part where I want to automatically request a Swarm review. To do that, I put a #review tag in changelist description and shelve the files (after that, the Swarm review number appears after the tag in the description). Everything works as it should, except that I need to double refresh the changelist after shelving to get an updated description and extract the review ID. If I use only one refresh, or don't refresh at all, the extracted description doesn't contain the review ID. What's more, it works well with a single refresh when debugging step-by-step, but not in real time.
client.shelveChangelist(changelist);
IChangelist cl = server.getChangelist(changelist.getId());
cl.refresh();
cl.refresh();
String description = cl.getDescription;
(In fact, the refresh is performed 3 times, as the getDescription() method is also invoked in the refresh() method). Do you have any idea why is it so? I tried digging deep into the methods, and looking for new threads, or synchronizing the code, but neither worked.