• 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: refreshing the defaultEditingContext
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: refreshing the defaultEditingContext


  • Subject: Re: refreshing the defaultEditingContext
  • From: Kieran Kelleher <email@hidden>
  • Date: Mon, 15 May 2006 23:49:30 -0400

I am sure there are many ways achieve freshness, however looking at the advanced WWDC sessions of recent years it seems these EOEditingContext methods are all you need to use to ensure freshness:


static setDefaultFetchTimestampLag(long lag) and creating new ec's regularly for EOF based transaction tasks


or


setFetchTimestamp(long timestamp) on an existing ec to now (new NSTimestamp() ) to ensure that any cached snapshots older than now are updated from the database.


In my experience, these methods alone are all you need to ensure fresh data.... but beware because fresh data means more SQL traffic to the database, and less use of EOF snapshot caches. I set an application wide setDefaultFetchTimestampLag to 120 seconds (the default is one hour) and setFetchTimestamp to now as desired in EC's where I need the latest instant data from the db. Also the setFetchTimestamp for the defaultEditingContext can be set to now or 30 seconds ago in the sleep method of Session.

HTH,

Kieran




On May 15, 2006, at 4:27 PM, Robert Walker wrote:

I wanna make sure I understand this correctly. You were originally using the session().defaultEditingContext() to fetch data for your RSS feed. I am assuming you are accessing the RSS feed from a direct action, so when accessing session() you are getting an unneeded session for each request.

You then decided to use the defaultSharedEditingContext in place of the session().defaultEditingContext() to prevent the creation of a new session.

If this is accurate them my first question would be: Why did you not create a new instance of EOEditingContext and use that instead of session().defaultEditingContext()? This will prevent creating a new session for each request and will not have the issues related to the shared editing context.

You should also examine the documentation on "Fetching Data > Ensuring Fresh Data" in this document:

http://developer.apple.com/documentation/WebObjects/ Enterprise_Objects/index.html

Example:

	public WOActionResults myRSSFeedAction() {
		EOEditingContext ec = new EOEditingContext();

		ec.lock();

		/* Fetch your data and generate RSS feed here */

		ec.unlock();
	}


On May 15, 2006, at 2:57 PM, Dev WO wrote:

Hi guys,
I've been trying to optimize my application a little as I had some RSS feed which was actually creating a session and finally as RSS readers update themselves every x minutes, I just couldn't softly restart the instance.
So I moved the RSS component using the defaultSharedEditingContext, making sure no session was created. So this part was ok so far.
But trying it I saw that the data from the defaultSharedEditingContext didn't update...
I can afford some delay for the update like minutes, but it's been 5 hours now:(


How should I make the sharedEC to update itself? The data are being edited/added using another WOApplication, so maybe the other application could "call" the sharedEC to make it refresh...

Or do:
setRefreshesRefetchedObjects(true);
on the fetch specification should work?

Thanks a lot for any tip:)

Xavier

_______________________________________________ WebObjects-dev mailing list email@hidden http://www.omnigroup.com/mailman/listinfo/webobjects-dev

_______________________________________________ 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
  • Follow-Ups:
    • Re: refreshing the defaultEditingContext
      • From: Dev WO <email@hidden>
References: 
 >refreshing the defaultEditingContext (From: Dev WO <email@hidden>)
 >Re: refreshing the defaultEditingContext (From: Robert Walker <email@hidden>)

  • Prev by Date: Connecting to LDAP Directory with EOModeler
  • Next by Date: Best Way to communicate with Tomcat
  • Previous by thread: Re: refreshing the defaultEditingContext
  • Next by thread: Re: refreshing the defaultEditingContext
  • Index(es):
    • Date
    • Thread