Skip to content

Commit 82e91cf

Browse files
yulian-gaponenkoUbuntu
authored andcommitted
Make EventData building based on IEvent synchronization independent from factory instance
Using factory instance for blocking is prone to sync issues. We don't document possibility to block on IEventDataFactory instance anyway. DEVSIX-5515
1 parent 427b4ef commit 82e91cf

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

kernel/src/main/java/com/itextpdf/kernel/counter/data/EventDataHandler.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,7 @@ This file is part of the iText (R) project.
7171
* @param <V> data type
7272
*/
7373
public abstract class EventDataHandler<T, V extends EventData<T>> {
74+
private final Object createLock = new Object();
7475
private final Object processLock = new Object();
7576

7677
private final IEventDataCache<T, V> cache;
@@ -97,8 +98,7 @@ public List<V> clear() {
9798

9899
public void register(IEvent event, IMetaInfo metaInfo) {
99100
V data;
100-
//Synchronization is left here mostly in consistency with cache and process, but factories are usually not thread safe anyway.
101-
synchronized (factory) {
101+
synchronized (createLock) {
102102
data = factory.create(event, metaInfo);
103103
}
104104
if (data != null) {

0 commit comments

Comments
 (0)