Discussion:
[omniORB] Why does _this() increment ref count on servant for the first time it's called?
Tuyen Chau
2006-10-31 22:38:45 UTC
Permalink
We are debugging the reference counting on our servants and ran into a
peculiar problem with _this() function. Why does _this() increment the
reference count on the servant for the first time the function is
called, and then if we call _this() again on the same servant
subsequently, it does not increment the reference count again? Is this
the correct behavior that we are seeing?

Our servants derive from RefCountServantBase because we want them to go
away when no clients need them anymore. We are very careful with object
reference counts and make sure that they are correct for the number of
clients.

Thanks in advance for any help you can provide,
Tuyen
Clarke Brunt
2006-10-31 22:56:53 UTC
Permalink
Post by Tuyen Chau
We are debugging the reference counting on our servants and
ran into a
peculiar problem with _this() function. Why does _this() increment
the reference count on the servant for the first time the function is
called, and then if we call _this() again on the same servant
subsequently, it does not increment the reference count
again? Is this
the correct behavior that we are seeing?
Our servants derive from RefCountServantBase because we want them to
go away when no clients need them anymore. We are very careful with
object reference counts and make sure that they are correct for the
number of clients.
Quick answer without me spending time to look up the details: it because
you are using 'implicit activation' and the first time you use _this(),
the servant is activated, and the counted reference to it is from the
POA. When you call it again, the servant has already been activated, so
no extra reference is needed.
--
Clarke Brunt, Principal Software Engineer, Trafficmaster


This email and any files transmitted with it are confidential and intended solely for the use of the individual or entity to whom they are addressed. If you have received this email in error please notify the system manager. This message contains confidential information and is intended only for the individual named. If you are not the named addressee you should not disseminate, distribute or copy this e-mail. Please notify the sender immediately by e-mail if you have received this e-mail by mistake and delete this e-mail from your system. If you are not the intended recipient you are notified that disclosing, copying, distributing or taking any action in reliance on the contents of this information is strictly prohibited.
Alex Tingle
2006-10-31 22:57:57 UTC
Permalink
It's because _this() activates the servant in the default POA the first
time it is called (but only if the servant hasn't already been
activated, of course).

The extra reference is the one owned by the POA. When you deactivate
the object (with deactivate_object()) the POA will eventually call
_remove_ref(), and everything will balance out.

-Alex

--
:: Let me solve your problems: http://www.firetree.net/consulting/
:: alex.tingle AT firetree.net +44-7901-552763
Post by Tuyen Chau
We are debugging the reference counting on our servants and ran into a
peculiar problem with _this() function. Why does _this() increment
the reference count on the servant for the first time the function is
called, and then if we call _this() again on the same servant
subsequently, it does not increment the reference count again? Is
this the correct behavior that we are seeing?
Our servants derive from RefCountServantBase because we want them to
go away when no clients need them anymore. We are very careful with
object reference counts and make sure that they are correct for the
number of clients.
Thanks in advance for any help you can provide,
Tuyen
_______________________________________________
omniORB-list mailing list
http://www.omniorb-support.com/mailman/listinfo/omniorb-list
Loading...