[
https://issues.apache.org/jira/browse/OLINGO-1063?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15764945#comment-15764945
]
Michael Bolz commented on OLINGO-1063:
--------------------------------------
Hello [~bodos],
AFAIK the {{Edm}} parts are not intended to be used parallel (and thus they are
not thread-safe).
However the {{getPropertyNames}} should be implemented like this:
{code}
@Override
public List<String> getPropertyNames() throws EdmException {
if (edmPropertyNames == null) {
final List<String> temp = new ArrayList<String>();
if (edmBaseType != null) {
temp.addAll(edmBaseType.getPropertyNames());
}
if (structuralType.getProperties() != null) {
for (final Property property : structuralType.getProperties()) {
temp.add(property.getName());
}
}
edmPropertyNames = temp;
}
return edmPropertyNames;
}
{code}
Then in the worst parallel case it is initialised more then once, but you will
never get a list which gets modified after you get it.
Would this solution be sufficient for you?
Best regards, Michael
> Thread safetiness in
> org.apache.olingo.odata2.core.edm.provider.EdmStructuralTypeImplProv
> -----------------------------------------------------------------------------------------
>
> Key: OLINGO-1063
> URL: https://issues.apache.org/jira/browse/OLINGO-1063
> Project: Olingo
> Issue Type: Bug
> Components: odata2-core
> Affects Versions: V2 2.0.7
> Reporter: Stefan Bodenstein
>
> The method getPropertyNames in EdmStructuralTypeImplProv is not thread safe.
> It potentially returns a non initialized list, which is modified while
> iterating over it. This is not only theoretically, but already appeared in
> our application.
> Please make the method synchronized or synchronize the initialization of the
> list unsing double checked locking.
> Best Regards
> Stefan
--
This message was sent by Atlassian JIRA
(v6.3.4#6332)