Hello Group,
Can somebody with good experience in dealing with EOEditingContext lock/ unlock
concept please advise me the following best practice in locking/ unlocking
EOEditingContext in various possible scenarios:
1) I have created an instance of EOEditingContext using
EREXC.newEditingContext() in my WOComponent constructor. All/ most of the
dynamic elements in the WOComponent have object binding i.e., Employee Name =
employee.name, Employee Dept Name = employee.dept.name
I have locked and unlocked ec in the action methods properly as advised in the
WO articles. Thanks for the documentation.
However, as the dynamic elements have object binding, EOF is throwing below
error while submitting the form and almost similar error while loading the form:
[2009-04-08 01:47:56 IST] <WorkerThread6> *** EOEditingContext: access with no
lock: objectWillChange()!
[2009-04-08 01:47:56 IST] <WorkerThread6> java.lang.Exception: This is not a
real exception, just a stack trace of the location of the missing lock:
at
com.webobjects.eocontrol.EOEditingContext._EOAssertSafeMultiThreadedAccess(EOEditingContext.java:5173)
at
com.webobjects.eocontrol.EOEditingContext.objectWillChange(EOEditingContext.java:2814)
at er.extensions.ERXEC.objectWillChange(ERXEC.java:733)
at
com.webobjects.eocontrol.EOObserverCenter.notifyObserversObjectWillChange(EOObserverCenter.java:433)
at
com.webobjects.eocontrol.EOCustomObject.willChange(EOCustomObject.java:271)
at
com.webobjects.eocontrol._EOMutableKnownKeyDictionary$Initializer$_GenericRecordBinding.setValueInObject(_EOMutableKnownKeyDictionary.java:527)
at
com.webobjects.eocontrol.EOCustomObject.takeStoredValueForKey(EOCustomObject.java:1778)
at com.org.model._Employee.setName(_MemoryBooksPrice.java:53)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:585)
at
com.webobjects.foundation.NSKeyValueCoding$ValueAccessor$1.setMethodValue(NSKeyValueCoding.java:688)
at
com.webobjects.foundation.NSKeyValueCoding$_MethodBinding.setValueInObject(NSKeyValueCoding.java:1175)
at
com.webobjects.eocontrol.EOCustomObject.takeValueForKey(EOCustomObject.java:1601)
at
com.webobjects.foundation.NSKeyValueCoding$Utility.takeValueForKey(NSKeyValueCoding.java:519)
at
com.webobjects.foundation.NSValidation$DefaultImplementation.validateTakeValueForKeyPath(NSValidation.java:733)
at
com.webobjects.eocontrol.EOCustomObject.validateTakeValueForKeyPath(EOCustomObject.java:1363)
at
com.webobjects.foundation.NSValidation$Utility.validateTakeValueForKeyPath(NSValidation.java:551)
at
com.webobjects.foundation.NSValidation$DefaultImplementation.validateTakeValueForKeyPath(NSValidation.java:741)
at
com.webobjects.appserver.WOComponent.validateTakeValueForKeyPath(WOComponent.java:1273)
at
com.webobjects.appserver._private.WOKeyValueAssociation.setValue(WOKeyValueAssociation.java:71)
at
com.webobjects.appserver._private.WOTextField.takeValuesFromRequest(WOTextField.java:81)
at
com.webobjects.appserver._private.WODynamicGroup.takeChildrenValuesFromRequest(WODynamicGroup.java:81)
at
com.webobjects.appserver._private.WODynamicGroup.takeValuesFromRequest(WODynamicGroup.java:89)
at
com.webobjects.appserver._private.WOForm.takeValuesFromRequest(WOForm.java:70)
at
com.webobjects.appserver._private.WODynamicGroup.takeChildrenValuesFromRequest(WODynamicGroup.java:81)
at
com.webobjects.appserver._private.WODynamicGroup.takeValuesFromRequest(WODynamicGroup.java:89)
at
com.webobjects.appserver.WOComponent.takeValuesFromRequest(WOComponent.java:914)
at
com.webobjects.appserver.WOSession.takeValuesFromRequest(WOSession.java:1139)
at
com.webobjects.appserver.WOApplication.takeValuesFromRequest(WOApplication.java:1350)
I have heard that we can lock/ unlock EOEditingContext in the WOComponent
awake() and sleep() methods. But I have also read that this is not completely
true, as sleep() method of a component may not be called sometimes i.e., when a
different component is returned in response or when there is an exception in
component lifecycle, it seems sleep() method is not invoked.
"Question: Given these caveats and any other, please advise me *BEST PRACTICE*
(that overcomes dangerous locking/ unlocking issues like: deadlock and ...) in
locking/ unlocking EOEditingContext object in various scenarios like, the ones
described above."
Thanks for the early response.
Thank You,
Shravan Kumar. M
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list ([email protected])
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/webobjects-dev/archive%40mail-archive.com
This email sent to [email protected]