Re: how to know wheter an object is still "alive"



Marcus Lunzenauer wrote:

In my application I have have to determine, whether that an object is still "alive" (reachable? active?) but I only have that object's IOR.

I thought that the following code would do this for me, but it does not:


static CORBA_Object getGovernor(const char *governorIOR, CORBA_Environment * ev){

CORBA_Object cur_gov = CORBA_OBJECT_NIL;

 // CHECK: is the current governor still active?
 if (governorIOR){

  // translate IOR
  cur_gov = (CORBA_Object) CORBA_ORB_string_to_object(global_orb, governorIOR, ev);

  // that IOR is not translatable
  if (ev->_major != CORBA_NO_EXCEPTION){

    debug(DEFAULT_DEBUG_FLAGS, "Could not find registered governor.\n");
    CORBA_exception_free(ev);

    // FIXME: is this needed?
    cur_gov = CORBA_OBJECT_NIL;

  // DON'T DO ANYTHING; governor is still active
  } else {
    debug(DEFAULT_DEBUG_FLAGS, "Registered governor still active.\n");
  }
 }

return cur_gov;
}



please use CORBA_Object operation


CORBA_boolean non_existent = CORBA_Object_non_existent (obj, ev);

This is a very lightweight request that is handled by servers object
container, object/service implementation is not involved.

Following GUI  CORBA tool  is using this operation to test liveness of
object in servers object container:
http://casa.in-berlin.de/gnome-ior.html

Regards, Frank

--
GNOME http://www.gnome.org
Frank Rehberger <frehberg gnome-de org>



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]