• 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: Distributed Object validity
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Distributed Object validity


  • Subject: Re: Distributed Object validity
  • From: James Bucanek <email@hidden>
  • Date: Tue, 15 Jan 2008 08:34:55 -0700

Jacob Bandes-Storch <mailto:email@hidden> wrote (Tuesday, January 15, 2008 7:55 AM -0800):
I need a way (in both the pref pane and the application) to see if the
other one is still running. if (sharedobj) { ... seems not to work
correctly, it sometimes executes even if the app/prefpane is closed.

You have to define "invalid." If you send the object a synchronous message, DO will return successfully if the message was delivered and the executed. This doesn't tell you if your remote object is "valid" (you'll have to figure that out yourself), but it will tell you that the other process is running and that the remote object accepted the message.


I'm also seeing "connection went invalid while waiting for a reply" in
the Console, but I can't figure out exactly when it shows up.

The "connection went invalid" is an exception that's thrown if the DO communications fails. Just catch it and set a breakpoint in your app. This will let you determine what message failed, when, and where.


I my app, I have a deadman timer that periodically tickles my server by sending it a dummy "isListening" message. This is a synchronous method that (essentially) does nothing and returns YES. I wrap the call in a try/catch and examine any exceptions thrown by DO. This allows me to invalidate the connection and attempt to restart or reconnect to the server if there's an error. (As a general rule, I wrap all remote method calls in try/catch handlers for this very reason.)

--
James Bucanek

_______________________________________________

Cocoa-dev mailing list (email@hidden)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden


References: 
 >Distributed Object validity (From: Jacob Bandes-Storch <email@hidden>)

  • Prev by Date: Re: Core Data performance advice... creating relationships.
  • Next by Date: More CoreData questions...
  • Previous by thread: Distributed Object validity
  • Next by thread: NSTrackingArea, Pie charts and not rectangular areas
  • Index(es):
    • Date
    • Thread