• 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: Invalidating objects asynchronously
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Invalidating objects asynchronously


  • Subject: Re: Invalidating objects asynchronously
  • From: Peter Vandoros <email@hidden>
  • Date: Tue, 9 Sep 2008 10:59:49 +1000

Yes, but he could link to WOnder or copy that delegate :-)

On 09/09/2008, at 10:56 AM, Chuck Hill wrote:

Yes.  But he is not using Wonder.  :-)


On Sep 8, 2008, at 5:44 PM, Peter Vandoros wrote:

I think there is a EODatabaseContext Delegate in WOnder (i think ERXDatabaseContextDelegate) that will return null (or throw an exception, i can't remember) in such cases instead of a dummy fault.

Regards

Peter

On 09/09/2008, at 10:32 AM, Chuck Hill wrote:


On Sep 8, 2008, at 5:26 PM, Mike Schrag wrote:

Do you mean that attributes of the EO are suddenly null? I don't see how this is possible _unless_ you are looking at objects that are in an EOEditingContext that is not locked. That won't ever work reliably.
I'm assuming the root problem here is the old JMS stuff would invalidate objects, which means you end up in a very unreliable state. But I wasn't digging too much into it.


Hmmm, maybe if that happened before willRead() was called, this might still happen. But after the fault is fired, the attribute values should be stable if the EC is locked as it queues the notifications rather than responding to them. So, to be sure you had a real, live object, you could:

eo.willRead();
if ( ! eo.isDummyFaultEO(eo) ) {
	// process
}



/**
* Detecting WO 5 dummy fault EOs. The code below is a translation of code posted here:
* From http://wodeveloper.com/omniLists/eof/2001/November/msg00023.html
*
* As of WO4.5, EOF resolves faults for objects that don't exist in the database to a dummy object with mostly empty attributes (except those
that are set in -init), whereas earlier versions of EOF threw a _fireFault exception. This method detects whether the receiver is such a dummy object.
*
* A distinguishing feature of these dummy EOs is that they don't have a corresponding database context snapshot, so we use this to detect its dummy-ness. This seems more robust than checking if all or most attributes are empty, since these can be changed by client code.
*
* Dummy fault EOs should be removed from the editingContext (using forgetObject) before it is invalidated (invalidateAllObjects or invalidateObjectWithGlobalID), otherwise an unrecoverable "decrementSnapshotCountForGlobalID - unable to decrement snapshot count for object with global ID" exception is thrown by EOF.<br><br>
*
* See also: http://www.omnigroup.com/mailman/archive/eof/2001-May/001988.html andfollowing.
*/
public static boolean isDummyFaultEO(EOEnterpriseObject anObject)
{
/** require [valid_param] anObject != null; **/
JassAdditions.pre("EOObject", "isDummyFaultEO [object_in_ec]", anObject.editingContext() != null);
JassAdditions.pre("EOObject", "isDummyFaultEO [object_has_global_id]", anObject.editingContext().globalIDForObject(anObject) != null);


     boolean isDummyFaultEO = false;

// This method will fail if the object is still a fault. We fire the fault so that the correct result is returned.
if (anObject.isFault())
{
anObject.willRead();
}


     EOEditingContext ec = anObject.editingContext();
     EOGlobalID globalID = ec.globalIDForObject(anObject);

// NB. objects with temporary globalIDs legitimately have no DB snapshots, since these are by definition not yet saved to the database.
if (! globalID.isTemporary())
{
// Find the EODatabaseContext instance associated with anObject, or null if no databaseContext association can be found.
EOObjectStoreCoordinator rootStore = (EOObjectStoreCoordinator)ec.rootObjectStore();
rootStore.lock();
try
{
EODatabaseContext dbContext = (EODatabaseContext)rootStore.objectStoreForObject(anObject);
if (dbContext == null)
{
throw new RuntimeException("Could not locate EODatabaseContext for object '" +
anObject + "' in editingContext: " + ec);
}


isDummyFaultEO = (dbContext.snapshotForGlobalID(globalID) == null);
}
finally
{
rootStore.unlock();
}
}


     return isDummyFaultEO;
 }



Chuck

--
Chuck Hill             Senior Consultant / VP Development

Practical WebObjects - for developers who want to increase their overall knowledge of WebObjects or who are trying to solve specific problems.
http://www.global-village.net/products/practical_webobjects







_______________________________________________ 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

--
This message has been scanned for viruses and
dangerous content by MailScanner, and is
believed to be clean.



Peter Vandoros
Software Engineer
Etech Group Pty Ltd
Level 3/21 Victoria St
Melbourne VIC 3000
Australia

Ph: +61 3 9639 9677
Fax: +61 3 9639 9577
----------------------------------
IMPORTANT: This e-mail message and any attachments are confidential and may be privileged. If received in error, please reply to this message and destroy all copies and any attachments. You should check this message and any attachments for viruses or defects. Our liability is limited to resupplying any affected message or attachments. For more information about Etech Group, please visit us at http://www.etechgroup.com.au.







-- Chuck Hill Senior Consultant / VP Development

Practical WebObjects - for developers who want to increase their overall knowledge of WebObjects or who are trying to solve specific problems.
http://www.global-village.net/products/practical_webobjects








--
This message has been scanned for viruses and
dangerous content by MailScanner, and is
believed to be clean.



Peter Vandoros
Software Engineer
Etech Group Pty Ltd
Level 3/21 Victoria St
Melbourne VIC 3000
Australia

Ph: +61 3 9639 9677
Fax: +61 3 9639 9577
----------------------------------
IMPORTANT: This e-mail message and any attachments are confidential and may be privileged. If received in error, please reply to this message and destroy all copies and any attachments. You should check this message and any attachments for viruses or defects. Our liability is limited to resupplying any affected message or attachments. For more information about Etech Group, please visit us at http://www.etechgroup.com.au .





_______________________________________________ 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: 
 >Invalidating objects asynchronously (From: Dan Grec <email@hidden>)
 >Re: Invalidating objects asynchronously (From: Mike Schrag <email@hidden>)
 >Re: Invalidating objects asynchronously (From: Dan Grec <email@hidden>)
 >Re: Invalidating objects asynchronously (From: Chuck Hill <email@hidden>)
 >Re: Invalidating objects asynchronously (From: Mike Schrag <email@hidden>)
 >Re: Invalidating objects asynchronously (From: Chuck Hill <email@hidden>)
 >Re: Invalidating objects asynchronously (From: Peter Vandoros <email@hidden>)
 >Re: Invalidating objects asynchronously (From: Chuck Hill <email@hidden>)

  • Prev by Date: Re: Invalidating objects asynchronously
  • Next by Date: Re: IllegalArgumentException in D2W queryAll page?
  • Previous by thread: Re: Invalidating objects asynchronously
  • Next by thread: Re: Fetching data in WOLongResponsePage
  • Index(es):
    • Date
    • Thread