... this. It looks like the dispose might happen at the same moment the ERXObjectStoreCoordinatorSynchronizer$ProcessChangesQueue.run is performed in another thread, and this did cause the exceptions.
Is this the proper approach? From the moment we started using the code above, the NPE never occurred; on the other hand, we got once (and only once so far, all attempts to repeat it failed) a very strange exception — the OSCSynchronizer could not fetch an object:
16:16:21.939 ERROR er.extensions.eof.ERXDatabaseContextDelegate$ObjectNotAvailableException: No cz.ocs.model.DBDFPrototype found with globalID: <DBDFPrototype: [uid: '1000028'] > //log:er.extensions.eof.ERXObjectStoreCoordinatorSynchronizer [ERXOSCProcessChanges]
ObjectNotAvailableException: No cz.ocs.model.DBDFPrototype found with globalID: <DBDFPrototype: [uid: '1000028'] >
at er.extensions.eof.ERXDatabaseContextDelegate.databaseContextFailedToFetchObject(ERXDatabaseContextDelegate.java:346)
... skipped 5 stack elements
at com.webobjects.foundation._NSDelegate._perform(_NSDelegate.java:223)
at com.webobjects.foundation._NSDelegate.perform(_NSDelegate.java:167)
... skipped 1 stack elements
at com.webobjects.eoaccess.EOAccessFaultHandler.completeInitializationOfObject(EOAccessFaultHandler.java:89)
at com.webobjects.eocontrol.EOCustomObject.willRead(EOCustomObject.java:1172)
at com.webobjects.eocontrol.EOCustomObject.willChange(EOCustomObject.java:332)
at com.webobjects.eocontrol._EOMutableKnownKeyDictionary$Initializer$_GenericRecordBinding.setValueInObject(_EOMutableKnownKeyDictionary.java:579)
at com.webobjects.eocontrol.EOCustomObject.takeStoredValueForKey(EOCustomObject.java:1663)
at er.extensions.eof.ERXGenericRecord.takeStoredValueForKey(ERXGenericRecord.java:1261)
at com.webobjects.eocontrol.EOEditingContext._mergeValueForKey(EOEditingContext.java:663)
at com.webobjects.eocontrol.EOEditingContext._mergeObjectWithChanges(EOEditingContext.java:3457)
at com.webobjects.eocontrol.EOEditingContext._processObjectStoreChanges(EOEditingContext.java:3546)
at er.extensions.eof.ERXEC._processObjectStoreChanges(ERXEC.java:1569)
... skipped 5 stack elements
at com.webobjects.eocontrol.EOEditingContext._sendOrEnqueueNotification(EOEditingContext.java:4715)
at com.webobjects.eocontrol.EOEditingContext._objectsChangedInStore(EOEditingContext.java:3562)
at er.extensions.eof.ERXEC._objectsChangedInStore(ERXEC.java:1509)
... skipped 7 stack elements
at com.webobjects.eocontrol.EOObjectStoreCoordinator._objectsChangedInSubStore(EOObjectStoreCoordinator.java:693)
... skipped 7 stack elements
at er.extensions.eof.ERXObjectStoreCoordinatorSynchronizer$ProcessChangesQueue$UpdateSnapshotProcessor.processSnapshots(ERXObjectStoreCoordinatorSynchronizer.java:295)
at er.extensions.eof.ERXObjectStoreCoordinatorSynchronizer$ProcessChangesQueue._process(ERXObjectStoreCoordinatorSynchronizer.java:522)
at er.extensions.eof.ERXObjectStoreCoordinatorSynchronizer$ProcessChangesQueue.process(ERXObjectStoreCoordinatorSynchronizer.java:540)
at er.extensions.eof.ERXObjectStoreCoordinatorSynchronizer$ProcessChangesQueue.run(ERXObjectStoreCoordinatorSynchronizer.java:617)
... skipped 1 stack elements
Probably as a consequence, again the [TERMINATE] problem detailed below happened — it sort of looks like any exception in OSCSynchronizer causes it eventually.