Skip to content

Commit

Permalink
#203: Update BeanConverterStore
Browse files Browse the repository at this point in the history
- Made #get and #add synchronized.
  • Loading branch information
marcus-talbot42 committed Apr 11, 2024
1 parent 9fdf2d4 commit 8ec03b1
Showing 1 changed file with 2 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ public BeanConverterStore(Map<Class<?>, Map<Class<?>, BeanConverter>> beanConver
beanConverterMap.forEach((key, value) -> this.beanConverterMap.put(key, new HashMap<>(value)));
}

public BeanConverter get(Class<?> source, Class<?> target) {
public synchronized BeanConverter get(Class<?> source, Class<?> target) {
var cachedConverters = beanConverterMap.get(source);

if (cachedConverters == null) {
Expand All @@ -32,7 +32,7 @@ public BeanConverter get(Class<?> source, Class<?> target) {
return cachedConverters.get(target);
}

public void add(Class<?> source, Class<?> target, BeanConverter beanConverter) {
public synchronized void add(Class<?> source, Class<?> target, BeanConverter beanConverter) {
var cachedConverters = beanConverterMap.get(source);

if (cachedConverters == null) {
Expand Down

0 comments on commit 8ec03b1

Please sign in to comment.