Skip to content

Commit

Permalink
Use CHM for emitters field allowing removal of synchronized keyword a…
Browse files Browse the repository at this point in the history
…nd it's contention bottleneck.
  • Loading branch information
Jeremy Whiting committed Jun 29, 2023
1 parent ff57127 commit f9c5def
Showing 1 changed file with 3 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
import static io.smallrye.reactive.messaging.providers.i18n.ProviderMessages.msg;

import java.util.*;
import java.util.concurrent.ConcurrentHashMap;

import javax.enterprise.context.ApplicationScoped;

Expand All @@ -23,7 +24,7 @@ public class InternalChannelRegistry implements ChannelRegistry {
private final Map<String, Boolean> outgoing = new HashMap<>();
private final Map<String, Boolean> incoming = new HashMap<>();

private final Map<String, Emitter<?>> emitters = new HashMap<>();
private final Map<String, Emitter<?>> emitters = new ConcurrentHashMap<>();
private final Map<String, MutinyEmitter<?>> mutinyEmitters = new HashMap<>();

@Override
Expand Down Expand Up @@ -67,7 +68,7 @@ public synchronized List<Publisher<? extends Message<?>>> getPublishers(String n
}

@Override
public synchronized Emitter<?> getEmitter(String name) {
public Emitter<?> getEmitter(String name) {
Objects.requireNonNull(name, msg.nameMustBeSet());
return emitters.get(name);
}
Expand Down

0 comments on commit f9c5def

Please sign in to comment.