Repository navigation
Updated CSS3Parser pool implementation - #664
Merged
Merged
Conversation
…ent leaks and use the AutoCloseable interface instead of Closeable
Member
|
Thanks a lot, lets see what the ci thinks about this :-) |
basil
reviewed
Nov 21, 2023
| this.pool = pool; | ||
| } | ||
| else { | ||
| throw new IllegalStateException("This PooledParser was not returned to the pool properly"); |
Contributor
Author
|
Will take a look.
Basil Crow ***@***.***> schrieb am Di., 21. Nov. 2023, 21:35:
… ***@***.**** commented on this pull request.
------------------------------
In src/main/java/org/htmlunit/WebClient.java
<#664 (comment)>:
> + this.pool = pool;
+ }
+
+ /**
+ * Resets the parser's pool state so it can be safely returned again
+ *
+ * @PARAM pool the pool the parser should return to when it is closed
+ */
+ protected PooledCSS3Parser markInUse(final CSS3ParserPool pool) {
+ // ensure we detect programming mistakes, Java will optimize this
+ // null check away when it never happens
+ if (this.pool == null) {
+ this.pool = pool;
+ }
+ else {
+ throw new IllegalStateException("This PooledParser was not returned to the pool properly");
#669 <#669>
—
Reply to this email directly, view it on GitHub
<#664 (review)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AANV6QAMTSRC4FROQZEFBQLYFUF7VAVCNFSM6AAAAAA7MSA4Q2VHI2DSMVQWIX3LMV43YUDVNRWFEZLROVSXG5CSMV3GSZLXHMYTONBTGAZTEMBTGE>
.
You are receiving this because you authored the thread.Message ID:
***@***.***>
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Updated pool with a different concept to allow more pooling, lighter synchronization, and avoid leaks when not auto-closed. It also uses AutoCloseable instead of Closeable (this is for IO, not for try-with-resource in general).
I could only run my test cases, the rest comes up with many errors related to JS, so I hope that is not this updated.