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

Auto creation of a snapshot after every Deliver gives Error: Stale data

Hello All,
I am writing server side extension using operation(com.ibm.team.scm.server.deliver). Auto creation of snapshot for every delivery operation on stream.
Code running without any error in my  operation participant but an error occurs in Eclipse side :stale data ,mention in image

my code:

IScmService service = getService(IScmService.class);
 
Date date = new Date(System.currentTimeMillis());
 WorkspaceItemListResult createBaselineSet2 = service.createBaselineSet2(destWorkspace, new IComponentHandle[0],
            date.toString() + "Snapshot", date.toString(), BaselineSetFlags.CREATE_NEW_BASELINES, null, null, null);

   
if (!createBaselineSet2.getItems().isEmpty()) {
          IBaselineSet baselineSet = (IBaselineSet) createBaselineSet2.getItems().get(0);
          System.out.println("BaselineSet: " + baselineSet);
        }

 

Need some simple piece of code how to fix above problem.

0 votes

Comments

Just as a reminder, I strongly recommend not implementing this kind of post-condition, because it will flood the system with baselines.  Although baselines are relatively inexpensive, they are not free, and one can in current releases of RTC easily obtain  any historical configuration of a workspace or stream, without requiring a baseline/snapshot having been created.  

1 vote



One answer

Permanent link
You will not be able to do this. You cannot perform 'write' operations like this during an advisor because the advisor itself will not complete it's 'write' operations until the end of it's transaction. For example, a delivery of open change sets may have occurred, at which point advisors are run to 'check' (read) various states to determine if everything is acceptable to continue. Once all the advisor checks 'pass', then the deliver operation/transaction completes, which would 'write' to the database the new states of the change sets (which were closed on delivery) and it would also record the actual delivery in the target stream. Given all this, it makes sense that a StaleDataException would be thrown somewhere...


Also as a side comment, I would consider Geoffrey's response as well. I.e. you may want to consider NOT creating a snapshot, and thus a baseline on every component, for every single deliver operation. Perhaps if the use case/ need to do this is flushed out, there might be more practical workarounds available.

0 votes

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,952
× 27

Question asked: Jul 19 '18, 12:50 a.m.

Question was seen: 2,825 times

Last updated: Aug 20 '18, 2:45 p.m.

Confirmation Cancel Confirm