GH-646: Avoid sync when no transaction

This commit is contained in:
Gary Russell
2018-04-13 16:22:28 -04:00
committed by Artem Bilan
parent 42e2d01026
commit f715bbef8b

View File

@@ -302,9 +302,13 @@ public class DefaultKafkaProducerFactory<K, V> implements ProducerFactory<K, V>,
}
@Override
public synchronized void close() {
if (this.cache != null && !this.cache.contains(this)) {
this.cache.offer(this);
public void close() {
if (this.cache != null) {
synchronized (this) {
if (!this.cache.contains(this)) {
this.cache.offer(this);
}
}
}
}