I am receiving this error below:
java.util.ConcurrentModificationException: KafkaConsumer is not safe for multi-threaded access
when I include this in my code:
CuratorFrameworkFactory.newClient()
I don't understand what's causing the error. Any help?
Thanks.
Kafka Javdocs clearly mentions that :
The Kafka consumer is NOT thread-safe. All network I/O happens in the thread of the application making the call. It is the responsibility of the user to ensure that multi-threaded access is properly synchronized. Un-synchronized access will result in ConcurrentModificationException.
More details present at http://kafka.apache.org/21/javadoc/org/apache/kafka/clients/consumer/KafkaConsumer.html#multithreaded