ChenSammi commented on code in PR #3783:
URL: https://github.com/apache/ozone/pull/3783#discussion_r983607935
##########
hadoop-hdds/framework/src/main/java/org/apache/hadoop/hdds/server/events/FixedThreadPoolWithAffinityExecutor.java:
##########
@@ -154,15 +175,77 @@ public long scheduledEvents() {
return scheduled.value();
}
+ @Override
+ public long droppedEvents() {
+ return dropped.value();
+ }
+
@Override
public void close() {
+ isRunning.set(false);
for (ThreadPoolExecutor executor : executors) {
executor.shutdown();
}
+ EXECUTOR_MAP.clear();
}
@Override
public String getName() {
return name;
}
+
+ /**
+ * Runnable class to perform execution of payload.
+ */
+ public static class ReportExecutor<P> implements Runnable {
+ private BlockingQueue<P> queue;
+ private AtomicBoolean isRunning;
+
+ public ReportExecutor(BlockingQueue<P> queue, AtomicBoolean isRunning) {
+ this.queue = queue;
+ this.isRunning = isRunning;
+ }
+
+ @Override
+ public void run() {
+ while (isRunning.get()) {
+ try {
+ Object report = queue.poll(1, TimeUnit.MILLISECONDS);
+ if (report == null) {
+ continue;
+ }
+
+ FixedThreadPoolWithAffinityExecutor executor = EXECUTOR_MAP.get(
+ report.getClass().getName());
+ if (null == executor) {
+ continue;
Review Comment:
Add a warning level log here if executor cannot be found.
--
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: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]