According to the doc the sesion's save() method can throw InvalidItemStateException exception.
It means that some item that was modified in current session also was modified from other thread and already saved. The transient space of the session cannot be saved
The quesion is what is a best practice in such case? Some code would be really appriciated. I cannot find any examples
Solved! Go to Solution.
Views
Replies
Total Likes
Hi,
Whenever you are performing some critical task, lets say scheduler will update few things, same time there can be some common java methods running, I would suggest you can implement design patterns example Singleton design pattern can give good results with session as it will never allow multiple objects to execute and modify.
Somewhat it also depends upon what exactly is the requirement. When ever you makes some changes you can use session.save() in case when you know that another thread is roaming around.
Views
Replies
Total Likes
Hi,
my advice would be to find out why two threads are trying to modify the same resource. There may be an issue with the way your code base has been written, only then should you decide how to implement a solution in code.
Is this for AEM5.x?
Regards,
Opkar
Hi,
Whenever you are performing some critical task, lets say scheduler will update few things, same time there can be some common java methods running, I would suggest you can implement design patterns example Singleton design pattern can give good results with session as it will never allow multiple objects to execute and modify.
Somewhat it also depends upon what exactly is the requirement. When ever you makes some changes you can use session.save() in case when you know that another thread is roaming around.
Views
Replies
Total Likes
Hi,
if you get that exception, you can handle it programatically like this:
kind regards,
Jörg
Views
Likes
Replies