egor-ryashin commented on a change in pull request #6041: Synchronize scheduled
poll() calls in SQLMetadataSegmentManager
URL: https://github.com/apache/incubator-druid/pull/6041#discussion_r296711525
##########
File path:
server/src/main/java/io/druid/metadata/SQLMetadataSegmentManager.java
##########
@@ -85,20 +85,38 @@
private static final Interner<DataSegment> DATA_SEGMENT_INTERNER =
Interners.newWeakInterner();
private static final EmittingLogger log = new
EmittingLogger(SQLMetadataSegmentManager.class);
- // Use to synchronize start() and stop(). These methods should be
synchronized to prevent from being called at the
- // same time if two different threads are calling them. This might be
possible if a druid coordinator gets and drops
- // leadership repeatedly in quick succession.
- private final Object lock = new Object();
+ /**
+ * Use to synchronize {@link #start()}, {@link #stop()}, {@link #poll()},
and {@link #isStarted()}. These methods
+ * should be synchronized to prevent from being called at the same time if
two different threads are calling them.
+ * This might be possible if a druid coordinator gets and drops leadership
repeatedly in quick succession.
+ */
+ private final ReentrantReadWriteLock readWriteLock = new
ReentrantReadWriteLock();
Review comment:
I wonder if this should be the responsibility of the Lifecycle to
synchronize start/stop of objects ?
----------------------------------------------------------------
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.
For queries about this service, please contact Infrastructure at:
[email protected]
With regards,
Apache Git Services
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]