Skip to content

SLING-12376 : Use per thread resource resolver for disposable callbacks#56

Open
cziegeler wants to merge 5 commits into
masterfrom
SLING-12376
Open

SLING-12376 : Use per thread resource resolver for disposable callbacks#56
cziegeler wants to merge 5 commits into
masterfrom
SLING-12376

Conversation

@cziegeler

@cziegeler cziegeler commented Jul 11, 2024

Copy link
Copy Markdown
Contributor

Instead of using different approaches (request attribute and phantom reference queue), we can use the thread resource resolver and store the disposables in the properties map of the resource resolver. When the resource resolver is closed, it closes all Closeable objects in the properties map
With that we can remove the different cases, queue handling, and scheduling.

In addition I removed the anti pattern of registering services during activate

@stefanseifert

Copy link
Copy Markdown
Member

what happens if sling models is used outside a request context, e.g. in a background job with a resource resolver created via getServiceResourceResolver?

@cziegeler

Copy link
Copy Markdown
Contributor Author

Then this code blows up with a NullPointerException...the same is true when using an administrative resource resolver

@stefanseifert

Copy link
Copy Markdown
Member

it's a valid use case, although probably rare, to use sling models outside a request...

@cziegeler

Copy link
Copy Markdown
Contributor Author

not disagreeing, lets see if we can come up with something that is better than the previous solution

@sonarqubecloud

Copy link
Copy Markdown

Quality Gate Failed Quality Gate failed

Failed conditions
78.1% Coverage on New Code (required ≥ 80%)

See analysis details on SonarCloud

1 similar comment
@sonarqubecloud

sonarqubecloud Bot commented Nov 4, 2024

Copy link
Copy Markdown

Quality Gate Failed Quality Gate failed

Failed conditions
78.1% Coverage on New Code (required ≥ 80%)

See analysis details on SonarCloud

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants