<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<META http-equiv=Content-Type content="text/html; charset=iso-8859-1">
<META content="MSHTML 6.00.2900.2802" name=GENERATOR></HEAD>
<BODY>
<DIV dir=ltr align=left><FONT face=Arial color=#0000ff
size=2></FONT> </DIV>
<DIV dir=ltr align=left><SPAN class=323221711-10052006><FONT face=Arial
color=#0000ff size=2>Hi Attila,</FONT></SPAN></DIV>
<DIV dir=ltr align=left><SPAN class=323221711-10052006><FONT face=Arial
color=#0000ff size=2></FONT></SPAN> </DIV>
<DIV dir=ltr align=left><SPAN class=323221711-10052006><FONT face=Arial
color=#0000ff size=2>if you call _remove_ref() right after the object activation
or any time later but before deactivate_object(), the later call to
deactivate_object() is sufficient for its deletion, as Clarke Brunt
wrote.</FONT></SPAN></DIV>
<DIV dir=ltr align=left><SPAN class=323221711-10052006><FONT face=Arial
color=#0000ff size=2></FONT></SPAN> </DIV>
<DIV dir=ltr align=left><SPAN class=323221711-10052006><FONT face=Arial
color=#0000ff size=2>If you call _remove_ref() only after deactivate_object()
there is no problem if the object is still busy. The deletion will only happen
after all references to the object have been removed, so there will be no clash
or exception.</FONT></SPAN></DIV>
<DIV dir=ltr align=left><SPAN class=323221711-10052006><FONT face=Arial
color=#0000ff size=2></FONT></SPAN> </DIV>
<DIV dir=ltr align=left><SPAN class=323221711-10052006><FONT face=Arial
color=#0000ff size=2>Regards, Wernke</FONT></SPAN></DIV>
<DIV dir=ltr align=left><SPAN class=323221711-10052006><FONT face=Arial
color=#0000ff size=2></FONT></SPAN> </DIV><BR>
<BLOCKQUOTE
style="PADDING-LEFT: 5px; MARGIN-LEFT: 5px; BORDER-LEFT: #0000ff 2px solid; MARGIN-RIGHT: 0px">
<DIV class=OutlookMessageHeader lang=en-us dir=ltr align=left>
<HR tabIndex=-1>
<FONT face=Tahoma size=2><B>From:</B> Attila Czigány
[mailto:atteeharp@gmail.com] <BR><B>Sent:</B> 10 May 2006 12:11<BR><B>To:</B>
Wernke zur Borg<BR><B>Cc:</B> Luke Deller; omniorb-list<BR><B>Subject:</B> Re:
[omniORB] Destroying itself<BR></FONT><BR></DIV>
<DIV></DIV>
<DIV>
<DIV>Hello,<BR>Thanks for the replies.<BR><BR></DIV>
<BLOCKQUOTE class=gmail_quote
style="PADDING-LEFT: 1ex; MARGIN: 0pt 0pt 0pt 0.8ex; BORDER-LEFT: rgb(204,204,204) 1px solid">I
am working on a quite similar application, and I think the pattern is very
common. In my case there are a number of methods on the processor object
that the client can call. Therefore I have added a close() method so that
the client can signal when the object is no longer needed. In the close()
function I call poa->deactivate_object() but this does not deactivate the
object straight away nor does it delete the servant!</BLOCKQUOTE>
<DIV>Not? deactivate_object() says to the POA, that the servant should be
destroyed. It waits until the servant finishes its jobs, and then deactivates
and deletes the servant. So are you sure about that in your app?<BR>Here is a
dump of mine:<BR>app: Finish method started.<BR>omniORB: State root<1>
(active) -> deactivating<BR>omniORB: Object is still busy -- etherealise
later.<BR>app: Finish method finished<BR>omniORB: sendChunk: to giop:tcp:<A
href="http://10.0.0.10:42682">10.0.0.10:42682</A> 24 bytes<BR>omniORB:
POA(RootPOA) etherealising object root<1> (deactivating).<BR> id:
IDL:root/Generator:1.0<BR>omniORB: State root<1> (deactivating) ->
etherealising<BR>omniORB: Removing root<1> (etherealising) from object
table<BR>omniORB: Object table entry root<1> (dead) deleted.<BR>omniORB:
RefCountServantBase has zero ref count -- deleted.<BR>app: destructor invoked,
got dead<BR><BR>So it is deleted right, deactivation decreases the ref_count,
so the _remove_ref() should not be invoked, just after the activation.<BR>I
just wanted to do this without an additional method. I just wanted to automate
this process.<BR>(As it is in EJB3 for example) </DIV><BR>
<BLOCKQUOTE class=gmail_quote
style="PADDING-LEFT: 1ex; MARGIN: 0pt 0pt 0pt 0.8ex; BORDER-LEFT: rgb(204,204,204) 1px solid">To
my knowledge there are two possibilities for servant deletion:
<BR></BLOCKQUOTE>
<BLOCKQUOTE class=gmail_quote
style="PADDING-LEFT: 1ex; MARGIN: 0pt 0pt 0pt 0.8ex; BORDER-LEFT: rgb(204,204,204) 1px solid">(a)
Use a ServantActivator POA for the activation of servants - its method
etherealize() will be called when the object is no longer in use. This
pattern is well described in [Bolton, Pure Corba].</BLOCKQUOTE>
<DIV><BR>Yes I thought something similar to this, is this complex very much?
This would eliminate the additional close/remove method. If yes, maybe the
efforts do not worth the time. <BR></DIV><BR>
<BLOCKQUOTE class=gmail_quote
style="PADDING-LEFT: 1ex; MARGIN: 0pt 0pt 0pt 0.8ex; BORDER-LEFT: rgb(204,204,204) 1px solid">(b)
Derive your servant from RefCountServantBase and call _remove_ref() after
poa->deactivate_object(). I have made some tests and up to now the object
gets properly destructed in all cases. Perhaps somebody can confirm that
this is a safe way to proceed.</BLOCKQUOTE>
<DIV>This should not be used, because the _remove_ref() decreases immediatelly
the ref_count, and the object is still busy, as we invoked this things from
its method, and it hasnt returned. So if you use _remove_ref, the deletion
will be faster than the deactivation and you will get exceptions, so the
remove is not clear, and poa can deactivate nothing as the object is already
deleted.<BR>Correct me if I am mistaken.<BR><BR></DIV></DIV>I will check the
ServantActivator POA, I hope it is not too complex:) Does anybody have some
experiences with it?<BR>Thanks again, Attila<BR></BLOCKQUOTE></BODY></HTML>