Skip to content

Conversation

@fcofdez
Copy link
Contributor

@fcofdez fcofdez commented Feb 27, 2025

This commit introduces a new helper function, ActionListener.releaseBefore,
which ensures that a resource is released before the listener is notified.

This commit introduces a new helper function, ActionListener.releaseBefore, which ensures that a resource is released before the listener is notified.
@fcofdez fcofdez added >non-issue :Distributed Indexing/Distributed A catch all label for anything in the Distributed Indexing Area. Please avoid if you can. Team:Distributed Indexing Meta label for Distributed Indexing team v9.1.0 labels Feb 27, 2025
@fcofdez fcofdez requested a review from DaveCTurner February 27, 2025 10:53
@elasticsearchmachine
Copy link
Collaborator

Pinging @elastic/es-distributed-indexing (Team:Distributed Indexing)

@DaveCTurner
Copy link
Contributor

DaveCTurner commented Feb 27, 2025 via email

Copy link
Contributor

@DaveCTurner DaveCTurner left a comment

Choose a reason for hiding this comment

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

LGTM (one non-blocking comment)

* Wraps a given listener and returns a new listener which releases the provided {@code releaseBefore}
* resource before the listener is notified via either {@code #onResponse} or {@code #onFailure}.
*/
static <Response> ActionListener<Response> releaseBefore(ActionListener<Response> delegate, Releasable releaseBefore) {
Copy link
Contributor

Choose a reason for hiding this comment

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

It's always irked me that these params are in the opposite order from their executioin. I guess it's consistent with runBefore(). But do contemplate whether you'd prefer this to be more readable the other way round.

@fcofdez
Copy link
Contributor Author

fcofdez commented Feb 28, 2025

@elasticmachine update branch

@fcofdez fcofdez merged commit c0c0827 into elastic:main Feb 28, 2025
17 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

:Distributed Indexing/Distributed A catch all label for anything in the Distributed Indexing Area. Please avoid if you can. >non-issue Team:Distributed Indexing Meta label for Distributed Indexing team v9.1.0

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants