[omniORB] CORBA::release()

Brecht Vermeulen brecht.vermeulen@rug.ac.be
Fri Sep 13 11:30:02 2002


Hi Andrew,

this is a basic CORBA thing: if you use _var variables then they are
released automatically, you only have to use CORBA::release if you had
used Admin::ApplicationAdminIntf_ptr AdminRef;

take any CORBA book and it will give all details about this I think.

You also don't have to release the AdminObj because it is a _var.

best regards,
Brecht

Andrew Weaver wrote:
> 
> Moi, I am trying to implement a "watchdog" functionality whereby a process
> can "ping" other applications to see if they are still alive.
> 
> Each of the target apps implements an "ApplicationAdminIntf" interface that
> supports a method called "Ping". This method simply returns void. So, if the
> watchdog gets a successful call to the target, it assumes that all is OK.
> 
> The watchdog has a list of the IORs for each of the targets and periodically
> checks them out.
> 
> The code in use for this is shown below and it appears to work fine.
> However, if I do
> CORBA::release(AdminRef); after the successful "Ping", I get a message
> saying that I am attempting to release an object when the ref count is <= 0.
> 
> Based on my own tracing, this message appears when I try to create a new ref
> after having pinged 3 or 4 applications already.
> 
> 
> CORBA::Object_var AdminObj;
> Admin::ApplicationAdminIntf_var AdminRef;
> 
> ... loop starts ...
> 
> AdminObj = TheOrb->string_to_object(TheIOR);
> AdminRef = Admin::ApplicationAdminIntf::_narrow(AdminObj);
> if (CORBA::is_nil(AdminRef)) {
>     ... some error processing and continue the loop ...
> }
> AdminRef->Ping();
> **** Doing CORBA::release(AdminRef); here triggers the errors ****
> ... continue the loop ...
> 
> Kind Regards
> 
> Andy Weaver
> 
> "But to live outside the law ya must be honest..." R. Zimmerman.
> 
> _______________________________________________
> omniORB-list mailing list
> omniORB-list@omniorb-support.com
> http://www.omniorb-support.com/mailman/listinfo/omniorb-list