Skip to content

Add shutdown to EventListener#19957

Merged
wendigo merged 1 commit intotrinodb:masterfrom
dominikzalewski:plugin_lifecycle_manager
Nov 30, 2023
Merged

Add shutdown to EventListener#19957
wendigo merged 1 commit intotrinodb:masterfrom
dominikzalewski:plugin_lifecycle_manager

Conversation

@dominikzalewski
Copy link
Copy Markdown
Member

@dominikzalewski dominikzalewski commented Nov 29, 2023

Description

@PreDestroy and @PostCreate annotations are processed on EventListener methods.

Release notes

( X ) This is not user-visible or is docs only, and no release notes are required.
( ) Release notes are required. Please propose a release note for me.
( ) Release notes are required, with the following suggested text:

@cla-bot cla-bot bot added the cla-signed label Nov 29, 2023
@dominikzalewski dominikzalewski force-pushed the plugin_lifecycle_manager branch 3 times, most recently from 65a2213 to e2125a8 Compare November 29, 2023 17:01
@dominikzalewski dominikzalewski marked this pull request as ready for review November 29, 2023 17:11
Copy link
Copy Markdown
Member

@electrum electrum left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We should add an explicit shutdown method, like Connector

@dominikzalewski dominikzalewski force-pushed the plugin_lifecycle_manager branch 3 times, most recently from f7a5683 to 892a6f4 Compare November 30, 2023 08:17
@dominikzalewski
Copy link
Copy Markdown
Member Author

Changed as requested:

  • EventListener.shutdown() also calls close if it is AutoCloseable -> let me know whether that's OK with you. If not, I'll remove
  • Added unit tests to verify that the call is forwarded from manager to listener

@wendigo wendigo changed the title EventListener registered in LifeCycleManager Add shutdown to EventListener Nov 30, 2023
@wendigo
Copy link
Copy Markdown
Contributor

wendigo commented Nov 30, 2023

Overall LGTM. Please fix maven-checks

@wendigo
Copy link
Copy Markdown
Contributor

wendigo commented Nov 30, 2023

And this failure is related:

java.lang.AssertionError: io.trino.plugin.base.classloader.ClassLoaderSafeEventListener does not override [public default void io.trino.spi.eventlistener.EventListener.shutdown() throws java.lang.Exception]

@dominikzalewski dominikzalewski force-pushed the plugin_lifecycle_manager branch 4 times, most recently from 460c49c to 3504ba0 Compare November 30, 2023 10:01
@wendigo wendigo requested a review from electrum November 30, 2023 10:27
@dominikzalewski dominikzalewski force-pushed the plugin_lifecycle_manager branch from 3504ba0 to 5827c75 Compare November 30, 2023 13:57

eventListenerManager.addEventListener(listener);
eventListenerManager.loadEventListeners();
eventListenerManager.shutdown();
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: you could test here that second shutdown is a no-op for the event listener (no change requested)

@wendigo
Copy link
Copy Markdown
Contributor

wendigo commented Nov 30, 2023

LGTM @dominikzalewski. Thanks!

@wendigo wendigo merged commit 7c28ebb into trinodb:master Nov 30, 2023
@github-actions github-actions bot added this to the 435 milestone Nov 30, 2023
@dominikzalewski dominikzalewski deleted the plugin_lifecycle_manager branch December 8, 2023 15:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Development

Successfully merging this pull request may close these issues.

5 participants