mirror of
https://github.com/danieldemus/openhab-core.git
synced 2025-01-11 13:41:53 +01:00
f881ef87f1
The singleton instance of "Diagnostician" is used without synchronization. The singleton "Diasnostician" instance is using the singleton "EValidator.Registry" instance (without synchronization). In very rare high load situations there has been CME detected. My first "solution" has been to synchronize the access of Diagnostician's instance method by using ```java synchronized (Diagnostician.INSTANCE) { ... ``` But after realize that EMF is using internally other singletons I tried to find any information about EMF and thread safety. I found this one: https://javahacks.net/2016/07/13/emf-thread-safety/ EMF models are not thread-safe by default and writing multithreaded applications is not that simple. The more complex our application became, the more often we got concurrent modification exceptions and had problems with filtering and sorting operations. So, I assume instead of adding synchronizations to our code that is using EMF (IIRC this has been already done on the ESH hosted code base long time ago) we should try to execute EMF code in a safe manner. This implementation adds a "SafeEMF" OSGi service that should be used to execute EMF code to ensure none code of EMF (or at least the ones that calls has been migrated to the SafeEMF usage) is accessed by separate threads at the same time. Related to: https://github.com/openhab/openhab-core/issues/772 Signed-off-by: Markus Rathgeb <maggu2810@gmail.com> |
||
---|---|---|
.. | ||
src/main/java/org/eclipse/smarthome/model/core | ||
.classpath | ||
.project | ||
bnd.bnd | ||
model.profile-marker | ||
NOTICE | ||
pom.xml |