• 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
ERXEC EOEditingContext in background thread
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

ERXEC EOEditingContext in background thread


  • Subject: ERXEC EOEditingContext in background thread
  • From: Jeff Schmitz <email@hidden>
  • Date: Sat, 07 Mar 2009 19:04:15 -0600

Hello,
   Below is my setup for executing a background thread with its own EOObjectStoreCoordinator and its own EOEdtingContext.  Note that I'm using ERXEC to create the EOEditingContext, and have the below properties set.  Also note that I don't do lock or unlock as I understand that ERXEC does this for you.  Is this correct?  Is it ok to use this in a thread?  The reason I ask is that I can kick off the thread and not touch my app in any other way, and more often than not the calculations will hang after about 15 minutes as if its deadlocked.  However I haven't been able to repeat the error with lock logging on yet.  Could it have something to do with the Session timing out during processing?  Or is there something else I don't have quite right?

er.extensions.ERXApplication.useEditingContextUnlocker=true
er.extensions.ERXEC.defaultAutomaticLockUnlock=true
er.extensions.ERXEC.useSharedEditingContext=false
er.extensions.ERXEC.defaultCoalesceAutoLocks=true
er.extensions.ERXEnterpriseObject.applyRestrictingQualifierOnInsert=true
er.extensions.ERXEnterpriseObject.updateInverseRelationships=true

public static void updateResults() {

   //Do lots of loops
   while (...) {
   resultsObjectStore = new EOObjectStoreCoordinator();
   resultsEC = ERXEC.newEditingContext(resultsObjectStore);

   //Do lots of processing.

   resultsEC.saveChanges();

   //Free up the memory, nothing will be reused in next loop anyway.
   resultsEC.dispose();
   resultsObjectStore.dispose();
   resultsObjectStore = new EOObjectStoreCoordinator();        
   resultsEC = ERXEC.newEditingContext(resultsObjectStore);

   }
}

public static void updateResultsThread() {
   t = new Thread("updateResults") {
      public void run() {
         updateResults();
      }
   };
   t.start();
}


Thanks!
Jeff
 _______________________________________________
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

  • Prev by Date: Re: Digging up a Session object from an EOGenericRecord
  • Next by Date: Re: ERXEC EOEditingContext in background thread
  • Previous by thread: Re: [OT] Generic search component UI
  • Next by thread: Re: ERXEC EOEditingContext in background thread
  • Index(es):
    • Date
    • Thread