Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » EMF » [CDO] CDOModelUtil lookup for coreTypes varies between server startup and client call
[CDO] CDOModelUtil lookup for coreTypes varies between server startup and client call [message #1841761] Fri, 28 May 2021 00:31 Go to next message
Warwick Burrows is currently offline Warwick BurrowsFriend
Messages: 132
Registered: July 2009
Location: Austin, TX
Senior Member
in CDOModelUtil there is a coreTypes array initialized in a static block at the top. What I'm seeing is that when the CDO server starts and initializes that array the EBoolean type is at position 22 in the array. But when a client call reaches the server and a model object contains an EBoolean then the CDODataOutput class does a lookup for the EBoolean type in the coreTypes but the index it uses is 3 less than where the EBoolean core type is in array - so null is returned. In both cases the position of EBoolean is determined by calling EClassifier.getClassifierId() which computes the classifier id by finding the index of the type in the ePackage.getEClassifiers() from contained within its instance. So there are 22 classifers in the EBoolean ePackage when the server starts but there's only 19 classifers in the epackage of the EBoolean instance that's being written by the server when I make a client call. Is there a reason that the list of classifiers could be different in the EPackage contained within two different instances of an EBoolean? How can there be more type classifiers at server startup than there is when a client call is received?

When I changed the index returned by getClassifierId in the debugger to 22 and it was then cached as the metaObjectId from that point on, then I no longer got the write failure for the EBoolean field of my model object. I'm burnt out now but tomorrow will debug the startup to see if I can figure out what the additional types are that get added to coreTypes at that point.

A final note. I didn't notice this for the 4.12 server until I updated my ecore model in eclipse and then replaced that model in the cdo_package_uitls table with the previous one. Note however that the EBoolean issue has started happening with the EBoolean field of an original model object. Not one of the new ones that were added to the newly updated and uploaded model.
Re: [CDO] CDOModelUtil lookup for coreTypes varies between server startup and client call [message #1841793 is a reply to message #1841761] Sun, 30 May 2021 07:24 Go to previous messageGo to next message
Eike Stepper is currently offline Eike StepperFriend
Messages: 6682
Registered: July 2009
Senior Member
I think EClassifier.getClassifierID() always returns the exact same value for the exact same EClassifier instance. Hence, if you observe two different values their EClassifier instances must be different. In your case that could perhaps happen because one time the generated EcorePackageImpl.eINSTANCE is being used and the second time, for some reason, the EPackageImpl instance from loading the dynamic Ecore.ecore resource is being used. I have no idea why that is, but perhaps it helps you debug the problem...

Re: [CDO] CDOModelUtil lookup for coreTypes varies between server startup and client call [message #1841806 is a reply to message #1841793] Sun, 30 May 2021 19:45 Go to previous messageGo to next message
Warwick Burrows is currently offline Warwick BurrowsFriend
Messages: 132
Registered: July 2009
Location: Austin, TX
Senior Member
You're right in both regards. I actually found this out on Friday afternoon through sheer luck. There is a static initializer block in CDOUtil that initializes an array called SYSTEM_ELEMENTS and one entry in that array gets set to the value of the ECorePackageImpl.INSTANCE created at start up. However that static initializer block isn't being called when I use SQL client queries and so SYSTEM_ELEMENTS is empty when checked in CDOModelUtil.isCorePackage() and so then, I guess, a different ECorePackageImpl gets used instead which causes getClassifierID() to be "off by 3". I only found this out when I tried making another client call that just happened to use an OCL query and then my debugger hit a breakpoint that I'd set in the CDOUtil static initializer that it had never hit before. As I stepped through getClassifierID() after that initializer ran I could see that getClassifierID() was now using the right ECorePackageImpl.INSTANCE and was in sync on the coreTypes array.

So now I'm trying to figure out how to fix the issue permanently and correctly as that static initializer block needs to be called prior to the getClassifierID() call chain so that SYSTEM_ELEMENTS is set correctly. What I do see is that the SYSTEM_ELEMENTS array that's initialized in CDOUtil isn't used anywhere else except CDOModelUtil. So strangely even though its initialized in CDOUtil its not referenced anywhere else in CDO but CDOModelUtil - its not even referenced by methods in CDOUtil. So really we could move the initialization of SYSTEM_ELEMENTS out of CDOUtil and into the static initializer block in CDOModelUtil instead. It seems every more suited given that the coreTypes array is also initialized in the CDOModelUtil static initializer and the two go hand in hand when it comes to type lookup by classifier ID.
Re: [CDO] CDOModelUtil lookup for coreTypes varies between server startup and client call [message #1841808 is a reply to message #1841806] Mon, 31 May 2021 05:37 Go to previous message
Eike Stepper is currently offline Eike StepperFriend
Messages: 6682
Registered: July 2009
Senior Member
The move you're proposing is not possible. The CDOPackageRegistryImpl.SYSTEM_ELEMENTS array is in the low-level cdo.common plugin and has the very general type EModelElement. But then it is initialized from the high-level cdo (client) plugin with instances that have concrete types which are not known to the cdo.common plugin. I fear you need to hunt for a different solution, probably around the topic of initialization timing...

Previous Topic:[SOLVED][CDO] - Migrating from 4.6 to 4.10 - IllegalStateException type mapping EFeatureMapEntry
Next Topic:[CDO] How do I force an update to my model package on the server?
Goto Forum:
  


Current Time: Fri Mar 29 09:35:59 GMT 2024

Powered by FUDForum. Page generated in 0.03475 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top