apache/pulsar · error · UnsupportedOperationException

Not implemented

Error message

Not implemented

What it means

WindowLifecycleListener.onActivation is a default interface method that throws UnsupportedOperationException to force implementers to override the activation callback. It fires when the WindowManager activates a window (new events arrived or a window fired) and the listener implementation has not overridden this method.

Source

Thrown at pulsar-functions/instance/src/main/java/org/apache/pulsar/functions/windowing/WindowLifecycleListener.java:46

public interface WindowLifecycleListener<T> {
    /**
     * Called on expiry of events from the window due to {@link EvictionPolicy}.
     *
     * @param events the expired events
     */
    void onExpiry(List<T> events);

    /**
     * Called on activation of the window due to the {@link TriggerPolicy}.
     *
     * @param events the list of current events in the window.
     * @param newEvents the newly added events since last activation.
     * @param expired the expired events since last activation.
     * @param referenceTime the reference (event or processing) time that resulted in activation
     */
    default void onActivation(List<T> events, List<T> newEvents, List<T> expired, Long
            referenceTime) {
        throw new UnsupportedOperationException("Not implemented");
    }
}

View on GitHub (pinned to 820761864e)

Solutions

  1. Override onActivation in your WindowLifecycleListener implementation with real (or no-op) logic.
  2. If no activation behavior is needed, override it with an empty method body.
  3. Update custom listener implementations that were written against an older interface version.

Example fix

// before
WindowLifecycleListener<WindowedValue<String>> l = new WindowLifecycleListener<>() {
    public void onEvents(List<WindowedValue<String>> events) { ... }
};
// after
WindowLifecycleListener<WindowedValue<String>> l = new WindowLifecycleListener<>() {
    public void onEvents(List<WindowedValue<String>> events) { ... }
    @Override
    public void onActivation(List<WindowedValue<String>> events, List<WindowedValue<String>> newEvents,
                             List<WindowedValue<String>> expired, Long referenceTime) { /* handle or no-op */ }
};
Defensive patterns

Strategy: validation

Validate before calling

// pre-deploy check
class MyListener extends WindowLifecycleListener<String> {
    @Override public void onActivation(List<String> e, List<String> n, List<String> x, Long t) { /* impl */ }
}

Type guard

static boolean overridesActivation(WindowLifecycleListener<?> l) {
    try {
        return !WindowLifecycleListener.class.getMethod("onActivation", List.class, List.class, List.class, Long.class)
            .getDeclaringClass().equals(WindowLifecycleListener.class);
    } catch (NoSuchMethodException ex) { return false; }
}

Try / catch

try { windowManager.process(...) } catch (UnsupportedOperationException e) {
    log.error("Listener missing onActivation override", e);
}

Prevention

When it happens

Trigger: Passing a WindowLifecycleListener (often an anonymous class) that overrides only onEvents/onExpiry but not onActivation, when the window manager calls onActivation during window processing in tests such as testWindowFunctionWithAtleastOnce.

Common situations: Implementing the interface before the onActivation default was added (older custom code) and relying on the default; writing a minimal test stub listener and forgetting the activation callback.

Understand the failure class

Background: UnsupportedOperationException and "is not supported" errors: when a library deliberately refuses a call — this error's family across 30 libraries.

Related errors


AI-assisted analysis of apache/pulsar@820761864e (2026-09-06). Data as JSON: /api/errors/db25538e2cf0bd09. Report an issue: GitHub.