You are viewing a plain text version of this content. The canonical link for it is here.
Posted to reviews@iotdb.apache.org by "SteveYurongSu (via GitHub)" <gi...@apache.org> on 2024/10/23 11:49:11 UTC
Re: [PR] Pipe: add seperated thread pool for phantom reference clean job [iotdb]
SteveYurongSu commented on code in PR #13813:
URL: https://github.com/apache/iotdb/pull/13813#discussion_r1812567216
##########
iotdb-core/node-commons/src/main/java/org/apache/iotdb/commons/pipe/resource/ref/PipePhantomReferenceManager.java:
##########
@@ -55,19 +55,35 @@ protected void gcHook() {
return;
}
+ final long startTime = System.currentTimeMillis();
+
+ // limit control to avoid infinite execution
+ final int maxCount = getPhantomReferenceCount();
+ int count = 0;
+
Reference<? extends EnrichedEvent> reference;
try {
- while ((reference = REFERENCE_QUEUE.remove(500)) != null) {
+ while (count < maxCount && ((reference = REFERENCE_QUEUE.remove(500)) != null)) {
finalizeResource((PipeEventPhantomReference) reference);
+ count++;
}
} catch (final InterruptedException e) {
// Finalize remaining references.
- while ((reference = REFERENCE_QUEUE.poll()) != null) {
+ while (count < maxCount && ((reference = REFERENCE_QUEUE.poll()) != null)) {
finalizeResource((PipeEventPhantomReference) reference);
+ count++;
}
} catch (final Exception e) {
// Nowhere to really log this.
}
+
+ if (maxCount != 0 || getPhantomReferenceCount() != 0) {
+ LOGGER.info(
Review Comment:
Too frequent!
--
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: reviews-unsubscribe@iotdb.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org