I have the situation that I have a database call which gives me a list of elements. Some activities later I write down the modified elements to the db. This is working fine als long as I don't have parallelism. The problem is that the second db operation potentially affects the first db operation. If now two tasks arrive at the first element and read from the database before one task has written the result to the db I get a wrong result. The solution would be to prevent the second task entering the first database read until the first task has written down the result.

Do we have some kind of support for such cases?

asked 14.11.2016 at 20:58

ruffzy's gravatar image

ruffzy
61448
accept rate: 100%


You could encapsulate the relevant DB steps in a SubProcess. Instead of calling the SubProcess directly you could delegate that to a Java method with 'synchronized' modifier.

To call a SubProcess from Java just use the SubProcessCall API: http://developer.axonivy.com/doc/latest/publicApi/ch/ivyteam/ivy/process/call/SubProcessCall.html Or if you not on the leading edge train: use the elder SubProcessRunner API: http://developer.axonivy.com/doc/latest/publicApi/ch/ivyteam/ivy/process/call/SubProcessRunner.html

link

answered 16.11.2016 at 13:03

Reguel%20Wermelinger's gravatar image

Reguel Werme... ♦♦
8.5k21851
accept rate: 69%

Thank you very much for your approach - as long as there is no task switch in the called SubProcess it's working fine.

(07.12.2016 at 13:56) ruffzy ruffzy's gravatar image
Your answer
toggle preview

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

Markdown Basics

  • *italic* or _italic_
  • **bold** or __bold__
  • link:[text](http://url.com/ "Title")
  • image?![alt text](/path/img.jpg "Title")
  • numbered list: 1. Foo 2. Bar
  • to add a line break simply add two spaces to where you would like the new line to be.
  • basic HTML tags are also supported

Tags:

×31
×5
×3

Asked: 14.11.2016 at 20:58

Seen: 728 times

Last updated: 07.12.2016 at 13:56