[omniORB] problem with _dispose()
Yvan Peter
Yvan.Peter@cnet.francetelecom.fr
Mon, 20 Apr 1998 14:00:44 +0200
This is a multi-part message in MIME format.
--------------2BC9163AAA668AD2F12496BD
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
Hi all,
Seems I need some help. I include a sample program which shows my
problem. My CORBA
object has a start function which exports its object reference to the
naming service.
When I try to dispose my object either localy or remotely (through a
IDL remove
method) the destructor is never called and any invocation after that
would raise an
exception on the client side.
I have found out that it is the code related to interface export which
causes
the problem (bind & rebind part of the code). If I remove it or put it
directly in
the main() the destructor is called normally.
I have tested this on Sparc solaris 2.5 with CC and intel linux with
gcc all with
omniORB2.5.0.
I am completly puzzled.
Has anyone got an idea ??
Yvan
--
Yvan PETER France Telecom/CNET
42, rue des Coutures - BP6243 F-14066 CAEN Cedex
phone (+33) 2.31.75.91.39 / fax (+33) 2.31.73.56.26
email: Yvan.Peter@cnet.francetelecom.fr
--------------2BC9163AAA668AD2F12496BD
Content-Type: text/plain; charset=us-ascii; name="test.cc"
Content-Transfer-Encoding: 7bit
Content-Disposition: inline; filename="test.cc"
#include <unistd.h>
#include <stdio.h>
#include "Naming.hh"
#include "test.hh"
CORBA::ORB_ptr orb;
CORBA::BOA_ptr boa;
class testObj : public virtual _sk_test {
public:
testObj();
~testObj();
void start();
void foo();
};
testObj::testObj() {
cout << "ctor" << endl;
}
testObj::~testObj() {
cout << "dtor" << endl;
}
void testObj::start() {
cout << "start" << endl;
CosNaming::Name CName;
CName.length(2);
CName[0].id = (const char*) "mobilite";
CName[0].kind = (const char*) "context";
CName[1].id = (const char*) "server";
CName[1].kind = (const char*) "object";
CosNaming::NamingContext_ptr ns;
FILE* f = fopen("/etc/omniORB.cfg", "r");
char name[48], iorst[4096];
fscanf(f, "%s %s", name, iorst);
fclose(f);
CORBA::Object_ptr o = orb->string_to_object(iorst);
ns = CosNaming::NamingContext::_narrow(o);
if (CORBA::is_nil(ns)) {
cout << "Impossible to get the naming service" << endl;
_exit(1);
}
CORBA::release(o);
try {
ns->bind(CName, _this());
}
catch ( CosNaming::NamingContext::AlreadyBound& ex ) {
cout << "replace in naming service" << endl;
ns->rebind(CName, _this());
}
catch ( CORBA::COMM_FAILURE& ex ) {
cout << "Unable to contact the naming service." << endl;
_exit(1);
}
catch (...) {
cout << "System exception while using the naming service." << endl;
_exit(1);
}
}
void testObj::foo() {
cout << "foo" << endl;
}
int main(int argc, char* argv[]) {
try {
orb = CORBA::ORB_init(argc, argv, "omniORB2");
boa = orb->BOA_init(argc, argv, "omniORB2_BOA");
}
catch (...) {
cout << "Cannot initialize ORB or BOA" << endl;
}
testObj *t = new testObj();
t->_obj_is_ready(boa);
t->start();
t->_dispose();
boa->impl_is_ready();
return 0;
}
--------------2BC9163AAA668AD2F12496BD--