GH-646: Avoid sync when no transaction

This commit is contained in:
Gary Russell
2018-04-13 16:22:28 -04:00
parent 1b53c4b7a9
commit 82eb21f511

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);
}
}
}
}