So the problem was when two or more nurses have administered the same vaccine to different patients same time then what we are doing here is retrieving the vaccine stock entity record which contains the current vaccine stock count field and reducing the value of current vaccine stock count field of retrieved the vaccine stock entity record by one (1) using plugin but because when two or more plugin instances run concurrently/simultaneously so each plugin execution retrieves the same value let’s say 100 for current vaccine stock count field of retrieved vaccine stock entity and then reduce the value of current vaccine stock count field of vaccine stock entity record by one (1) so the new value is 99 which is wrong as the same vaccine was administered to more than one patients and correct value should have been decremented by number of patients to whom the vaccine was administered.
Below are the steps to illustrate this:
1. First we are retrieving the vaccine stock entity record which contains the current vaccine stock count field
2. Then we are reading the current vaccine stock count field of retrieved vaccine stock entity record from step-1.
3. Then we are reducing the value of current vaccine stock count field of retrieved the vaccine stock entity record by one (1).
4. Finally, we are updating the current vaccine stock count field of retrieved vaccine stock entity.


Report
All responses (
Answers (