[omniORB] Does _non_existent() work?

James Dempsey jdempsey@sctcorp.com
Thu, 30 Sep 1999 10:37:18 -0400



Hi,

I'm trying to test whether a CORBA server object that I have
a reference to is still alive.  Here is some sample code:

#include <iostream.h>
#include <omniORB2/CORBA.h>

int main( int argc, char ** argv ) {

    CORBA::ORB_ptr orb = CORBA::ORB_init( argc, argv, "omniORB2"
);
    CORBA::Object_ptr object = orb->string_to_object( argv[1] );

    try {
        if (object->_non_existent()) {
            cout << "Object is non existent" << endl;
        } else {
            cout << "Object is there" << endl;
        }
    } catch (CORBA::Exception) {
        cout << "_non_existent() threw exception" << endl;
    }
     return 0;

}

I pass in the IOR of a CORBA server object and the program
converts it
to an object reference and then calls _non_existent( ) on it.
Unfortunately,
the call to _non_existent( ) throws an exception, whether the
object is
there or not.  This happens with both OmniORB 2.6.1 and 2.8.0.

An equivalent Java program using JavaIDL works correctly.

Is this a known bug or is this method not supported?

The reason I need to know whether the object is alive or not
is that a call to an object reference which has gone away hangs
the program, rather than throwing a CORBA comm exception or
something similar.

Thanks,
Jim Dempsey
jdempsey@sctcorp.com