runInForeground | currentCommitConflicts | FaUserContextInformation withLoggedInUsername: self username do: [ self crTrace: 'Running user: ' , FaUserContextInformation current username. [ self runProcessBlock. "This must be a commit and not a commitTransaction because the latter does not throws an error on commit confilt but answers false...and I need an exception so that to abot and try again." [ System commit. ] on: TransactionError do: [ :ex | "If we are using RC collections, we may be getting a TransactionError but the commitResult could have been success. So in that case we ignore the error." ((System transactionConflicts at: #commitResult) = #success) ifTrue: [ ex resume ] ifFalse: [ "Two things. First, I must somehow store the #transactionConflicts BEFORE the abort of the next error handler, since #transactionConflicts are cleared after abort or release. Second, ideally I would directly store this in this background process instance. However, since this instance is persistent, the next abort will revert this instance to the last view in the repository and so I will loose my dirty added transactionConflicts. Therefore, store the conflicts in a temp variable. And then, AFTER the abort, in the error handler, and BEFORE the commit, I set the conflicts into the background process instance. " currentCommitConflicts := System transactionConflicts. ex pass ] ]. self crTrace: 'BackgroundProcess ' , self asOop printString , ' committed transaction successful'. ] on: Error, Halt do: [ :exc | self abortToNewTransaction; handleException: exc. currentCommitConflicts ifNotNil: [ self commitConflicts: currentCommitConflicts ]. self commitToNewTransaction. exc return ] ]