You are viewing a plain text version of this content. The canonical link for it is here.
Posted to jira@kafka.apache.org by "mimaison (via GitHub)" <gi...@apache.org> on 2023/03/24 16:50:22 UTC
[GitHub] [kafka] mimaison commented on a diff in pull request #13325: KAFKA-14771: Include threads info in ConcurrentModificationException message
mimaison commented on code in PR #13325:
URL: https://github.com/apache/kafka/pull/13325#discussion_r1147836371
##########
clients/src/main/java/org/apache/kafka/clients/consumer/KafkaConsumer.java:
##########
@@ -2547,9 +2547,10 @@ private void acquireAndEnsureOpen() {
* @throws ConcurrentModificationException if another thread already has the lock
*/
private void acquire() {
- long threadId = Thread.currentThread().getId();
+ final Thread thread = Thread.currentThread();
+ final long threadId = thread.getId();
if (threadId != currentThread.get() && !currentThread.compareAndSet(NO_CURRENT_THREAD, threadId))
- throw new ConcurrentModificationException("KafkaConsumer is not safe for multi-threaded access");
+ throw new ConcurrentModificationException("KafkaConsumer is not safe for multi-threaded access. currentThread(name: " + thread.getName() + ", id: " + thread.getId() + ") otherThread(id: " + currentThread.get() + ")");
Review Comment:
This is a pretty long line. Can we split it up?
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: jira-unsubscribe@kafka.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org