blambov commented on code in PR #2064:
URL: https://github.com/apache/cassandra/pull/2064#discussion_r1072270442
##########
src/java/org/apache/cassandra/io/sstable/format/SSTableReader.java:
##########
@@ -808,32 +809,12 @@ public void runOnClose(final Runnable runOnClose)
synchronized (tidy.global)
{
final Runnable existing = tidy.runOnClose;
- tidy.runOnClose = AndThen.get(existing, runOnClose);
- }
- }
-
- private static class AndThen implements Runnable
- {
- final Runnable runFirst;
- final Runnable runSecond;
-
- private AndThen(Runnable runFirst, Runnable runSecond)
- {
- this.runFirst = runFirst;
- this.runSecond = runSecond;
- }
-
- public void run()
- {
- runFirst.run();
- runSecond.run();
- }
-
- static Runnable get(Runnable runFirst, Runnable runSecond)
- {
- if (runFirst == null)
- return runSecond;
- return new AndThen(runFirst, runSecond);
+ tidy.runOnClose = () -> {
Review Comment:
[This](https://issues.apache.org/jira/browse/CASSANDRA-9423?focusedCommentId=14602771&page=com.atlassian.jira.plugin.system.issuetabpanels%3Acomment-tabpanel#comment-14602771)
is the original problem stemming from this. AFAIR Stefania later fought the
same problem with lambdas (where `this` was included in the closure even when
it was not required), but I may be wrong, or things may have changed.
If you have verified that leak detection works correctly for all supported
JDK versions, I'll be very happy to accept that this is one less problem we
have to worry about.
--
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]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]