jerryshao commented on code in PR #5110:
URL: https://github.com/apache/gravitino/pull/5110#discussion_r1800411737


##########
core/src/main/java/org/apache/gravitino/listener/EventBus.java:
##########
@@ -64,7 +73,15 @@ public void dispatchEvent(Event event) {
    *     EventBus.
    */
   @VisibleForTesting
-  List<EventListenerPlugin> getPostEventListeners() {
-    return postEventListeners;
+  List<EventListenerPlugin> getEventListeners() {
+    return eventListeners;
+  }
+
+  private void dispatchPostEvent(Event postEvent) {
+    eventListeners.forEach(postEventListener -> 
postEventListener.onPostEvent(postEvent));
+  }
+
+  private void dispatchPreEvent(PreEvent preEvent) throws ForbiddenException {
+    eventListeners.forEach(preEventListener -> 
preEventListener.onPreEvent(preEvent));

Review Comment:
   Actually, we don't differentiate pre or post event listeners, the code here 
is a little confusing. We can change to:
   
   ```java
     private void dispatchPostEvent(Event postEvent) {
       eventListeners.forEach(listener -> listener.onPostEvent(postEvent));
     }
   ```



-- 
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]

Reply via email to