cuba
cuba copied to clipboard
LockManager lock should work atomically
Environment
General issue
Description of the bug
Method com.haulmont.cuba.core.app.LockManager#lock(java.lang.String, java.lang.String) has atomicity problem - between getting value from a map and putting them to it. I think is need to be used method "putIfAbsent" instead of "get" and "put" for example. In addition, if you look at the problem more deeply, then the question also arises of how to solve this in a clustered environment.
See: https://github.com/cuba-platform/cuba/blob/81ab57049fa5e95cdab132f790a93e8d85a37a20/modules/core/src/com/haulmont/cuba/core/app/LockManager.java#L126
Sorry for my english!