DATACMNS-1735 - Polishing.

Use mutated object as guard for synchronization. Copy discovered callbacks to cached callbacks.

Reduce concurrency in unit test to reduce test load. Guard synchronization with timeouts.

Original pull request: #446.
This commit is contained in:
Mark Paluch
2020-05-27 09:31:03 +02:00
parent d9969cb7d4
commit fbe51ef1bb
2 changed files with 20 additions and 12 deletions

View File

@@ -384,10 +384,11 @@ class EntityCallbackDiscoverer {
if (this.entityCallbackBeans.isEmpty()) {
if (cachedEntityCallbacks.size() != entityCallbacks.size()) {
List<EntityCallback<?>> entityCallbacks = new ArrayList<>(this.entityCallbacks.size());
List<EntityCallback<?>> entityCallbacks = new ArrayList<>(this.entityCallbacks);
AnnotationAwareOrderComparator.sort(entityCallbacks);
synchronized(this) {
synchronized (cachedEntityCallbacks) {
cachedEntityCallbacks.clear();
cachedEntityCallbacks.addAll(entityCallbacks);
}