Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow setting transaction timeout from a config property #15832

Closed
wants to merge 1 commit into from

Conversation

geoand
Copy link
Contributor

@geoand geoand commented Mar 18, 2021

Resolves: #15752

@geoand geoand requested review from gsmet and loicmathieu March 18, 2021 07:46
@quarkus-bot quarkus-bot bot added area/hibernate-orm Hibernate ORM area/narayana Transactions / Narayana area/persistence OBSOLETE, DO NOT USE labels Mar 18, 2021
@geoand geoand removed area/hibernate-orm Hibernate ORM area/persistence OBSOLETE, DO NOT USE labels Mar 18, 2021
Comment on lines +116 to +117
Optional<Integer> configTimeout = ConfigProvider.getConfig()
.getOptionalValue(configAnnotation.timeoutFromConfigProperty(), Integer.class);
Copy link
Contributor

Choose a reason for hiding this comment

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

This needs to be set in a cache somewhere as acessing the config programmatively is very costly so you don't want to do it on each interceptor call.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Hm... I am not sure we want to go there TBH because you would need a map from TransactionConfiguration to the config value.
That map would need to be a ConcurrentHashmap (which is fast, but the same as using a regular HashMap) and also we would need to make sure we expire entries to avoid having the map grow indefinitely.

I doubt that complexity is warranted. @gsmet WDYT?

Copy link
Contributor

Choose a reason for hiding this comment

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

We already discussed with Stuart the need to have a cache to avoid getting the annotation via reflection on each call.

My experience is that retrieving a configuration item via ConfigProvider.getConfig() is really costly, not everything is in cache inside the configuration provider. I don't remember the detail but I know I already chased some of them because it shows up in some profile.

I would not be concerned about a possible risk of indefinitly growing map as I expect having a finite number of classes/method and very low number of annotation usage. What can be done is to compute it at build time and fallback to reflection if the cache is not populated, this is what I did for property mapping for MongoDB with Panache for ex to avoid too many reflection at runtime.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Well, I'll be honest. I am certainly not going to do that now :). If someone else wants to take up the PR from here, cool :)

@quarkus-bot quarkus-bot bot added area/hibernate-orm Hibernate ORM area/persistence OBSOLETE, DO NOT USE labels Mar 18, 2021
@geoand
Copy link
Contributor Author

geoand commented May 19, 2021

Closing in favor of #17357

@geoand geoand closed this May 19, 2021
@quarkus-bot quarkus-bot bot added the triage/invalid This doesn't seem right label May 19, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/hibernate-orm Hibernate ORM area/narayana Transactions / Narayana area/persistence OBSOLETE, DO NOT USE triage/invalid This doesn't seem right
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Make timeout in @TransactionConfiguration configurable
2 participants