Thread contention on Converters.PROPERTY_EDITOR
See original GitHub issueHi!
There is a problem of thread contention on the PropertyEditorManager.findEditor. It loads classes from the ClassLoader switch is a thread blocking operation.
Is it possible to cache this method result so it wouldn’t be called again or it would break this functionality somehow?
It would go something like this:
@Override
Object tryConvert(Method targetMethod, Class<?> targetType, String text) {
if (!canUsePropertyEditors())
return SKIP;
PropertyEditor editor = PROPERTY_BY_CLASS.get(targetType);
if (editor == null) {
editor = PropertyEditorManager.findEditor(targetType);
if (editor != null)
PROPERTY_BY_CLASS.put(targetType, editor);
}
if (editor == null)
return SKIP;
try {
editor.setAsText(text);
return editor.getValue();
} catch (Exception e) {
throw unsupportedConversion(e, targetType, text);
}
}
Issue Analytics
- State:
- Created 4 years ago
- Comments:8 (3 by maintainers)
Top Results From Across the Web
What is thread contention? - Stack Overflow
Contention is simply when two threads try to access either the same resource or related resources in such a way that at least...
Read more >PropertyEditor - Concurrency Issues #266 - GitHub
It looks like the PropertyEditor implementation in Converters is not thread safe. I believe the problem is in this code, and I think...
Read more >Thread Contention - AppDynamics Documentation
Thread contention arises when two or more threads attempt to access the same resource at the same time. This page describes how AppDynamics...
Read more >News - OWNER • Java™ properties reinvented. - AEONBITS
I just released version 1.0.12, it contains all the bug fixes included in 1.0.11 plus a fix to a multi threading issue that...
Read more >Change History - XStream
Change History. Changes are split into following categories: Major changes: The major new features that all users should know about.
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found

Thanks for the report; the improvement looks impressive. I’ll try to roll out a new version asap.
It’s long time I’m not doing active development on this project, I need to cleanup two things, then I hope it won’t take much time to release a new version on maven repository.
Today afternoon I was fighting with maven+intellij since I was not using my laptop at home for development.
solved by #255