question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Thread contention on Converters.PROPERTY_EDITOR

See original GitHub issue

Hi!

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:closed
  • Created 4 years ago
  • Comments:8 (3 by maintainers)

github_iconTop GitHub Comments

2reactions
lviggianocommented, Sep 2, 2019

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.

0reactions
lviggianocommented, Sep 2, 2019

solved by #255

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found