Jazz Forum Welcome to the Jazz Community Forum Connect and collaborate with IBM Engineering experts and users

Looking for a method to evict the cache while modify enumerations

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.

0 votes



One answer

Permanent link
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.

0 votes

Comments

Thank you very much for your response, Ralph. Much appreciated.

Your answer

Register or log in to post 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.

Search context
Follow this question

By Email: 

Once you sign in you will be able to subscribe for any updates here.

By RSS:

Answers
Answers and Comments
Question details
× 10,941

Question asked: Oct 02 '15, 2:08 a.m.

Question was seen: 2,398 times

Last updated: Oct 06 '15, 9:01 p.m.

Confirmation Cancel Confirm