Looking for a method to evict the cache while modify enumerations
Feng Hong (24●1●8●14)
| asked Oct 02 '15, 2:08 a.m.
edited Oct 02 '15, 2:36 a.m. by Ralph Schoon (63.1k●3●36●46)
My client attempted to use Java API to modify enumerations, while modify and save a com.ibm.team.process.common.IProjectArea; multiple times with different connections to RTC, they got com.ibm.team.repository.common.StaleDataException
https://jazz.net/forum/questions/206968/unable-to-save-the-same-projectareaworkingcopy-twice-in-a-row-stale-exception It looks like RTC has 2 instances of the data one in the DB and another one that's cached. Is there a method to evict the cache, or synchronize these two copies? Also, is there a way to modify enumerations without encountering the StaleDataException(generated by the code below)? boolean saveProcessArea = false; final IProcessArea mutableProcessArea = (IProcessArea) fCachedService.getMutableCopy(fProcessAreaState); if (!fProcessAreaState.getStateId().equals (((Auditable)mutableProcessArea).getWorkingCopyPredecessor())) { // If the underlying item was changed in other places, // we need to indicate the editor is stale. throw new StaleDataException(mutableProcessArea, fProcessAreaState); } Any help on answering there will be much appreciated. |
One answer
Ralph Schoon (63.1k●3●36●46)
| answered Oct 02 '15, 2:38 a.m.
FORUM ADMINISTRATOR / FORUM MODERATOR / JAZZ DEVELOPER edited Oct 02 '15, 2:41 a.m.
Consider fetching the object before or after again after modification with a
IItemManager.REFRESH(not default) . Disconnect and get a new workingcopy manager after saving. See Understanding and Using the RTC Java Client API for some hints. Also see https://rsjazz.wordpress.com/2013/09/18/deploying-templates-and-creating-projects-using-the-plain-java-clients-library/ for some working code. Comments
Feng Hong
commented Oct 06 '15, 9:01 p.m.
Thank you very much for your response, Ralph. Much appreciated. |
Your answer
Dashboards and work items are no longer publicly available, so some links may be invalid. We now provide similar information through other means. Learn more here.