Skip to content

Add andThen method to ConnectionPoolListener - #6207

Merged
jrhee17 merged 2 commits into
line:mainfrom
Ivan-Montes:feature/implement-dothen-method-in-connectionpoollistener
May 12, 2025
Merged

Add andThen method to ConnectionPoolListener#6207
jrhee17 merged 2 commits into
line:mainfrom
Ivan-Montes:feature/implement-dothen-method-in-connectionpoollistener

Conversation

@Ivan-Montes

Copy link
Copy Markdown
Contributor

Related: #5159

Motivation:

Add andThen method to ConnectionPoolListener to chain more than one listener

Modifications:

  • In ConnectionPoolListener, add andThen method.
  • In ConnectionPoolListenerTest, add test

Result:

Comment thread core/src/test/java/com/linecorp/armeria/client/ConnectionPoolListenerTest.java Outdated
@minwoox minwoox added this to the 1.33.0 milestone Apr 17, 2025
} finally {
nextConnectionPoolListener.connectionClosed(protocol, remoteAddr,localAddr,attrs);
}
}

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.

Question) What do you think of also calling close as well?

e.g.

@Override
public void close() {
    try {
        ConnectionPoolListener.super.close();
    } finally {
        nextConnectionPoolListener.close();
    }
}

On side note, I think we're missing a call to ConnectionPoolMetrics#close from MetricCollectingConnectionPoolListener; I think we'll fix that separately

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Thanks for the suggestion! I'll implement that.

@ikhoon ikhoon left a comment

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.

Thanks, @Ivan-Montes!

---

Related: line#5159

**Motivation:**

Add `andThen` method to `ConnectionPoolListener` to chain more than one listener

**Modifications:**

- In `ConnectionPoolListener`, add `andThen` method.
- In `ConnectionPoolListenerTest`, add test

**Result:**

- Closes line#5159
- Supersedes line#5166 This PR replaces the changes proposed in line#5166, which is now outdated.
- Now, we could chain more than one listener
@Ivan-Montes
Ivan-Montes force-pushed the feature/implement-dothen-method-in-connectionpoollistener branch from f23733e to dec0883 Compare April 17, 2025 06:43
@codecov

codecov Bot commented Apr 17, 2025

Copy link
Copy Markdown

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 74.60%. Comparing base (8150425) to head (896c7a9).
Report is 74 commits behind head on main.

Additional details and impacted files
@@             Coverage Diff              @@
##               main    #6207      +/-   ##
============================================
+ Coverage     74.46%   74.60%   +0.14%     
- Complexity    22234    22466     +232     
============================================
  Files          1963     1972       +9     
  Lines         82437    83003     +566     
  Branches      10764    10798      +34     
============================================
+ Hits          61385    61923     +538     
- Misses        15918    15936      +18     
- Partials       5134     5144      +10     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

**Modifications:**

- In `ConnectionPoolListener`, implement `close` method within the `andThen` method.
- In `ConnectionPoolListener`, annotate the `andThen` method with `@UnstableApi`.
- In `ConnectionPoolListenerTest`, add `throws Exception` to the method signature
@Ivan-Montes
Ivan-Montes force-pushed the feature/implement-dothen-method-in-connectionpoollistener branch from dec0883 to 896c7a9 Compare April 17, 2025 13:09
@Ivan-Montes

Copy link
Copy Markdown
Contributor Author

Thanks for the feedback! I've implemented the suggested changes. Please let me know if there's anything else that needs to be updated.

@jrhee17

jrhee17 commented May 12, 2025

Copy link
Copy Markdown
Contributor

ping @minwoox

@minwoox minwoox left a comment

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.

Thanks, @Ivan-Montes 👍

@jrhee17
jrhee17 merged commit 47e4485 into line:main May 12, 2025
@Ivan-Montes

Copy link
Copy Markdown
Contributor Author

Thanks, @Ivan-Montes 👍

Thank you team!!

@Ivan-Montes
Ivan-Montes deleted the feature/implement-dothen-method-in-connectionpoollistener branch May 12, 2025 11:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add ConnectionPoolListener.andThen(ConnectionPoolListener)

4 participants