olsoloviov commented on code in PR #3442:
URL: https://github.com/apache/polaris/pull/3442#discussion_r2704479288
##########
runtime/service/src/main/java/org/apache/polaris/service/events/listeners/PolarisEventListener.java:
##########
@@ -18,14 +18,16 @@
*/
package org.apache.polaris.service.events.listeners;
+import java.util.function.Supplier;
import org.apache.polaris.service.events.PolarisEvent;
+import org.apache.polaris.service.events.PolarisEventType;
/**
- * Event listener that responds to notable moments during Polaris's execution.
Implementations can
- * filter events by checking {@link PolarisEvent#type()} or by querying
attributes with {@link
- * PolarisEvent#hasAttribute} and {@link PolarisEvent#attribute}.
+ * Event listener that responds to notable moments during Polaris's execution.
Implementations
+ * should check the event type and only call {@code eventSupplier.get()} for
types they handle,
+ * avoiding unnecessary object allocation.
*/
public interface PolarisEventListener {
- default void onEvent(PolarisEvent event) {}
+ default void onEvent(PolarisEventType type, Supplier<PolarisEvent>
eventSupplier) {}
Review Comment:
Ok, we can do that. But I supposed that we could change the SPI while the
feature is still in the experimental phase
--
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]