-
-
Notifications
You must be signed in to change notification settings - Fork 211
Closed
Description
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);
}
}
Metadata
Metadata
Assignees
Labels
No labels