• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Deadlock using EOObjectStore.invalidateObjectsWithGlobalIDs(NSArray)
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Deadlock using EOObjectStore.invalidateObjectsWithGlobalIDs(NSArray)


  • Subject: Re: Deadlock using EOObjectStore.invalidateObjectsWithGlobalIDs(NSArray)
  • From: Gary Teter <email@hidden>
  • Date: Wed, 20 Sep 2006 10:06:07 -0700

My superstition: Lock the root object store instead of just the database context.

try {
	WHEnterpriseObject.lockRootObjectStore(editingContext);
	// do stuff
} finally {
	WHEnterpriseObject.unlockRootObjectStore(editingContext);
}


public static void lockRootObjectStore(EOObjectStore objectStore) {
EOObjectStoreCoordinator osc = _objectStoreCoordinator (objectStore);
osc.lock();
}


public static void unlockRootObjectStore(EOObjectStore objectStore) {
EOObjectStoreCoordinator osc = _objectStoreCoordinator (objectStore);
osc.unlock();
}


private static EOObjectStoreCoordinator _objectStoreCoordinator (Object objectStore) {
if (objectStore == null) {
return EOObjectStoreCoordinator.defaultCoordinator();
} else if (objectStore instanceof EOObjectStoreCoordinator) {
return (EOObjectStoreCoordinator)objectStore;
} else if (objectStore instanceof EOEditingContext) {
return (EOObjectStoreCoordinator)((EOEditingContext) objectStore).rootObjectStore();
} else if (objectStore instanceof EOCooperatingObjectStore) {
return (EOObjectStoreCoordinator) ((EOCooperatingObjectStore)objectStore).coordinator();
} else if (objectStore instanceof EODatabase) {
NSArray dbContexts = ((EODatabase) objectStore).registeredContexts();
if (dbContexts.count() > 0) {
EODatabaseContext dbContext = (EODatabaseContext) dbContexts.objectAtIndex(0);
return dbContext.coordinator();
} else {
return EOObjectStoreCoordinator.defaultCoordinator();
}
} else {
throw new IllegalArgumentException("Unable to determine EOObjectStoreCoordinator for objects of type " + objectStore.getClass ().getName());
}
}




On Sep 20, 2006, at 9:50 AM, Chuck Hill wrote:

editingContext.lockObjectStore();

Probably just superstition, but I always get the EODatabaseContext directly and lock it.

-- WireHose: Smart metadata and personalization for WebObjects. http://www.wirehose.com/

_______________________________________________
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden


References: 
 >Deadlock using EOObjectStore.invalidateObjectsWithGlobalIDs(NSArray) (From: Francis Labrie <email@hidden>)
 >Re: Deadlock using EOObjectStore.invalidateObjectsWithGlobalIDs(NSArray) (From: Chuck Hill <email@hidden>)

  • Prev by Date: Re: constructing a url...
  • Next by Date: Re: Session timeout and memory
  • Previous by thread: Re: Deadlock using EOObjectStore.invalidateObjectsWithGlobalIDs(NSArray)
  • Next by thread: Re: Deadlock using EOObjectStore.invalidateObjectsWithGlobalIDs(NSArray)
  • Index(es):
    • Date
    • Thread