Skip to content

Conversation

@cziegeler
Copy link
Contributor

@cziegeler cziegeler commented Jul 11, 2024

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
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
Contributor Author

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

@stefanseifert
Copy link
Member

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

@cziegeler
Copy link
Contributor Author

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

@sonarqubecloud
Copy link

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
Copy link

sonarqubecloud bot commented Nov 4, 2024

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