It's all about the answers!

Ask a question

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


Raj Kumar (213) | asked Jul 19 '18, 12:50 a.m.
edited Aug 16 '18, 1:53 p.m. by David Lafreniere (4.5k7)

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.


Comments
1
Geoffrey Clemm commented Jul 20 '18, 4:21 p.m.
FORUM ADMINISTRATOR / FORUM MODERATOR / JAZZ DEVELOPER

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.  

One answer



permanent link
David Lafreniere (4.5k7) | answered Aug 16 '18, 1:52 p.m.
FORUM MODERATOR / JAZZ DEVELOPER
edited Aug 20 '18, 2:45 p.m.
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.

Your answer


Register or to post your answer.