[omniORB] [add-in] nameclt - extension to check if object is still
alive
Tomasz Bech
tbech at polbox.com
Tue Sep 9 13:42:17 BST 2003
Hi all,
Below there is a small extension to nameclt, which checks if bound objects are still alive.
It often happens in development that procesess crashes and the binding still exists in omniNames, and there
is no nice way to detect such situation.
Usage: nameclt -advanced list ...
(-advanced switches on this feature)
and the result could be as follows:
myserverobject1 ALIVE
myserverobject2 ALIVE
myserverobject3 DEAD
Hopes it helps someone,
Tomasz Bech
RCS file: /users/cvs/Isztar2/Server/omniORBdistr/src/appl/utils/nameclt/nameclt.cc,v
@@ -220,7 +220,29 @@ main(int argc, char **argv)
CORBA::String_var sname = omniURI::nameToString(b->binding_name);
cout << (const char*)sname;
-
+//tbech: start extension to check if object is alive
+ if (advanced)
+ {
+ const char* dead = " DEAD";
+ try
+ {
+ CosNaming::Name_var name = omniURI::stringToName(sname);
+ CORBA::Object_var obj = rootContext->resolve(name);
+ if (!CORBA::is_nil(obj) && !obj->_non_existent())
+ {
+ cout << " ALIVE";
+ }
+ else
+ {
+ cout << dead;
+ }
+ }
+ catch (...)
+ {
+ cout << dead;
+ }
+//tbech: end
+ }
if (b->binding_type == CosNaming::ncontext)
cout << "/";
More information about the omniORB-list
mailing list