I got the following exception:
java.lang.NullPointerException
at
org.eclipse.emf.ecore.util.BasicExtendedMetaData.getAllElements(BasicExtendedMetaData.java:845)
at
org.eclipse.emf.ecore.util.BasicExtendedMetaData.getLocalElement(BasicExtendedMetaData.java:745)
at
org.eclipse.emf.ecore.util.BasicExtendedMetaData.demandFeature(BasicExtendedMetaData.java:1938)
at
org.eclipse.emf.ecore.util.BasicExtendedMetaData.demandFeature(BasicExtendedMetaData.java:1929)
at
org.apache.tuscany.sdo.helper.XMLDocumentImpl.<init>(XMLDocumentImpl.java:149)
at
org.apache.tuscany.sdo.helper.XMLHelperImpl.createDocument(XMLHelperImpl.java:185)
...
I suppose it is a multi-threading issue related to emf ecore metadata.
Some background information about how I currently use SDO:
I use static SDO with several factories, while some factories reference other
factories. (E.g. FactoryA and FactoryB both reference FactoryC.)
I use the same scope, HelperProvider.getDefaultContext(), for all factory
register method calls.
The register methods of FactoryA and FactoryB are called at different moments
(lazy).
The metadata does NOT change at runtime.
I currently do not avoid that the the register method is invoked more than once
per factory and scope.
I understand that "emf ecore metadata is intended to be thread-safe for
read-only access".
What does this mean regarding factory initialization?
What kind of factory initialization strategy or synchronization is needed in
own application code? E.g.:
- Assure that access to register method of one specific factory is synchronized.
- Assure that register method is called at most once per factory and scope.
- Assure that all factories are initialized before any metadata read-access per
scope?
Regards, Daniel.
---------------------------------
Beginnen Sie den Tag mit den neuesten Nachrichten. Machen Sie Yahoo! zu Ihrer
Startseite!