[omniORB] Detecting activated servants...
Warren Brown
warren@scully.xfiles.za.org
Fri Sep 27 14:11:01 2002
------=_NextPart_000_0024_01C26637.D1707DC0
Content-Type: text/plain;
charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable
Page 30 of Pure Corba for shutting down
Shutting down an orb: CORBA::ORB::shutdown() or CORBA::ORB::destroy()
and Page 344 of Pure Corba for deativating.
'The developer calls deactivate_object(), passing the appropriate =
ObjectId as the argument. The corresponding active object map entry is =
marked and the deativate_object() operation returns immediately. The =
object is still active at this point.
2. At the next opportunity, the POA checks whether the marked object is =
currently processing a request. If the marked object is busy processing, =
the POA does nothing, waiting until the next opportunity to check the =
object.
If the marked object is not busy processing, the POA removes the marked =
entry from theactive object map and calls etherealize() on its =
associated ServantActivator object.
3. The etherealize() operation is implemented by the developer. It is =
responsible for deleting the servant object and cleaning up other =
resources associated with the corba object.
Effectively deactivate_object() performs a gentle shutdown of a corba =
object.
Hope that helps
----- Original Message -----=20
From: Marcus MacWilliam=20
To: OmniORB mailing list=20
Sent: Friday, September 27, 2002 1:43 PM
Subject: Re: [omniORB] Detecting activated servants...
Warren Brown wrote:=20
Try the ._non_existent() method in a try catch block.=20
Warren Brown=20
Telkom South Africa=20
----- Original Message -----=20
From: "Marcus MacWilliam" <marcusma@lsl.co.uk>=20
To: "OmniORB mailing list" <omniorb-list@omniorb-support.com>=20
Sent: Friday, September 27, 2002 12:35 PM=20
Subject: [omniORB] Detecting activated servants...=20
> All,=20
>=20
> I am using v4.0.0 and NT v4.0 and VC++ V5.=20
>=20
> I am getting a message from omni orb telling me that I am deleting =
> an active servant, and that it will deactivate it first.=20
>=20
> However, when it does this, and my server shuts down it hangs, and =
> does not complete properly.=20
>=20
> Is there any way I can detect if an object/servant is active, =
before=20
> I try to delete it. Is there a method that return true/false =
(0/1).=20
>=20
> Cheers,=20
> --=20
> Marcus A.T MacWilliam, MSc, CEng, MBCS, BSc(Hons).=20
> Senior Software Engineer, Laser-Scan Ltd, Cambridge, CB4 0FY.=20
> Tel: +44 (0)1223 420414 x213. Mobile: +44 (0)7803 706597.=20
> Fax: +44 (0)1223 420044. Web: http://www.laser-scan.co.uk/=20
>=20
>=20
>=20
> _______________________________________________=20
> omniORB-list mailing list=20
> omniORB-list@omniorb-support.com=20
> http://www.omniorb-support.com/mailman/listinfo/omniorb-list=20
>
OK,=20
Below is a fragment of my code. The servant always exists, but it =
should=20
already have been deactivated by an earlier release() method. Will=20
_non_existent() in this case, tell me if it is still active.=20
// Sanity check, if the object is still active, deactivate it.=20
try=20
{=20
if (!m_pLastObject._non_existent())=20
{=20
#ifdef GOTHIC_DEBUG=20
// Local variable to hold entry.=20
GOTH_VALUE temp =3D goth_null_value;=20
temp =3D constructEntry( m_pLastObject->getWrappedClassName(), =
m_lastObjectKey );=20
// Output that we had to deactivate object.=20
(void) goth_printf( goth_stdout, "DEBUG>\t\t\t\t\t[D] - =
Deactivating object - %s.\n", temp.string );=20
// Free the assigned temporary string.=20
(void) goth_value_free( temp, DT_STRING );=20
#endif=20
// Deactivate the object, using its unique object id.=20
m_poa -> deactivate_object( m_pLastObject -> m_last_object_id =
);=20
}=20
}=20
catch ( ... ) {}=20
// Delete the object.=20
delete m_pLastObject;=20
Cheers,=20
--=20
Marcus A.T MacWilliam, MSc, CEng, MBCS, BSc(Hons).=20
Senior Software Engineer, Laser-Scan Ltd, Cambridge, CB4 0FY.=20
Tel: +44 (0)1223 420414 x213. Mobile: +44 (0)7803 706597.=20
Fax: +44 (0)1223 420044. Web: http://www.laser-scan.co.uk/=20
=20
------=_NextPart_000_0024_01C26637.D1707DC0
Content-Type: text/html;
charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<META http-equiv=3DContent-Type content=3D"text/html; =
charset=3Diso-8859-1">
<META content=3D"MSHTML 6.00.2719.2200" name=3DGENERATOR>
<STYLE></STYLE>
</HEAD>
<BODY bgColor=3D#ffffff>
<DIV><FONT face=3DArial size=3D2>Page 30 of Pure Corba for shutting=20
down</FONT></DIV>
<DIV><FONT face=3DArial size=3D2></FONT> </DIV>
<DIV><FONT face=3DArial size=3D2>Shutting down an orb: =
CORBA::ORB::shutdown() or=20
CORBA::ORB::destroy()</FONT></DIV>
<DIV><FONT face=3DArial size=3D2></FONT> </DIV>
<DIV><FONT face=3DArial size=3D2>and Page 344 of Pure Corba for=20
deativating.</FONT></DIV>
<DIV> </DIV>
<DIV><EM><FONT face=3DArial size=3D2>'The developer calls =
deactivate_object(),=20
passing the appropriate ObjectId as the argument. The =
corresponding active=20
object map entry is marked and the deativate_object() operation returns=20
immediately. The object is still active at this =
point.</FONT></EM></DIV>
<DIV><EM><FONT face=3DArial size=3D2></FONT></EM> </DIV>
<DIV><EM><FONT face=3DArial size=3D2>2. At the next opportunity, the POA =
checks=20
whether the marked object is currently processing a request. If the =
marked=20
object is busy processing, the POA does nothing, waiting until the next=20
opportunity to check the object.</FONT></EM></DIV>
<DIV><EM><FONT face=3DArial size=3D2>If the marked object is not busy =
processing,=20
the POA removes the marked entry from theactive object map and calls=20
etherealize() on its associated ServantActivator =
object.</FONT></EM></DIV>
<DIV><EM><FONT face=3DArial size=3D2>3. The etherealize() operation is =
implemented=20
by the developer. It is responsible for deleting the servant object and =
cleaning=20
up other resources associated with the corba object.</FONT></EM></DIV>
<DIV><EM><FONT face=3DArial size=3D2>Effectively deactivate_object() =
performs a=20
gentle shutdown of a corba object.</FONT></EM></DIV>
<DIV><EM><FONT face=3DArial size=3D2></FONT></EM> </DIV>
<DIV><FONT face=3DArial size=3D2>Hope that helps</FONT></DIV>
<BLOCKQUOTE dir=3Dltr=20
style=3D"PADDING-RIGHT: 0px; PADDING-LEFT: 5px; MARGIN-LEFT: 5px; =
BORDER-LEFT: #000000 2px solid; MARGIN-RIGHT: 0px">
<DIV style=3D"FONT: 10pt arial">----- Original Message ----- </DIV>
<DIV=20
style=3D"BACKGROUND: #e4e4e4; FONT: 10pt arial; font-color: =
black"><B>From:</B>=20
<A title=3Dmarcusma@lsl.co.uk =
href=3D"mailto:marcusma@lsl.co.uk">Marcus=20
MacWilliam</A> </DIV>
<DIV style=3D"FONT: 10pt arial"><B>To:</B> <A=20
title=3Domniorb-list@omniorb-support.com=20
href=3D"mailto:omniorb-list@omniorb-support.com">OmniORB mailing =
list</A> </DIV>
<DIV style=3D"FONT: 10pt arial"><B>Sent:</B> Friday, September 27, =
2002 1:43=20
PM</DIV>
<DIV style=3D"FONT: 10pt arial"><B>Subject:</B> Re: [omniORB] =
Detecting=20
activated servants...</DIV>
<DIV><BR></DIV>Warren Brown wrote:=20
<BLOCKQUOTE TYPE=3D"CITE">Try the ._non_existent() method =
in a try=20
catch block.=20
<P>Warren Brown <BR>Telkom South Africa=20
<P>----- Original Message ----- <BR>From: "Marcus MacWilliam" <<A =
href=3D"mailto:marcusma@lsl.co.uk">marcusma@lsl.co.uk</A>> =
<BR>To: "OmniORB=20
mailing list" <<A=20
=
href=3D"mailto:omniorb-list@omniorb-support.com">omniorb-list@omniorb-sup=
port.com</A>>=20
<BR>Sent: Friday, September 27, 2002 12:35 PM <BR>Subject: [omniORB] =
Detecting activated servants...=20
<P>> All, <BR>> <BR>> I am using v4.0.0 and NT v4.0 and =
VC++ V5.=20
<BR>> <BR>> I am getting a message from omni orb telling me =
that I am=20
deleting <BR>> an active servant, and that it will deactivate it =
first.=20
<BR>> <BR>> However, when it does this, and my server shuts =
down it=20
hangs, and <BR>> does not complete properly. <BR>> <BR>> Is =
there=20
any way I can detect if an object/servant is active, before <BR>> =
I try=20
to delete it. Is there a method that return true/false (0/1). =
<BR>>=20
<BR>> Cheers, <BR>> -- <BR>> Marcus A.T MacWilliam, =
MSc,=20
CEng, MBCS, BSc(Hons). <BR>> Senior Software Engineer, =
Laser-Scan=20
Ltd, Cambridge, CB4 0FY. <BR>> Tel: +44 (0)1223 420414 =
x213.=20
Mobile: +44 (0)7803 706597. <BR>> Fax: +44 (0)1223 420044. =
Web: <A=20
=
href=3D"http://www.laser-scan.co.uk/">http://www.laser-scan.co.uk/</A>=20
<BR>> <BR>> <BR>> <BR>>=20
_______________________________________________ <BR>> =
omniORB-list=20
mailing list <BR>> omniORB-list@omniorb-support.com <BR>> <A=20
=
href=3D"http://www.omniorb-support.com/mailman/listinfo/omniorb-list">htt=
p://www.omniorb-support.com/mailman/listinfo/omniorb-list</A>=20
<BR>></P></BLOCKQUOTE>OK,=20
<P>Below is a fragment of my code. The servant always exists, but it =
should=20
<BR>already have been deactivated by an earlier release() method. Will =
<BR>_non_existent() in this case, tell me if it is still active.=20
<P><FONT face=3D"Courier New,Courier"><FONT size=3D-1>// Sanity check, =
if the=20
object is still active, deactivate it.</FONT></FONT> <BR><FONT=20
face=3D"Courier New,Courier"><FONT size=3D-1>try</FONT></FONT> =
<BR><FONT=20
face=3D"Courier New,Courier"><FONT size=3D-1>{</FONT></FONT> <BR><FONT =
face=3D"Courier New,Courier"><FONT size=3D-1> if=20
(!m_pLastObject._non_existent())</FONT></FONT> <BR><FONT=20
face=3D"Courier New,Courier"><FONT size=3D-1> =
{</FONT></FONT>=20
<BR><FONT face=3D"Courier New,Courier"><FONT size=3D-1>#ifdef=20
GOTHIC_DEBUG</FONT></FONT> <BR><FONT face=3D"Courier =
New,Courier"><FONT=20
size=3D-1> // Local variable =
to hold=20
entry.</FONT></FONT> <BR><FONT face=3D"Courier New,Courier"><FONT=20
size=3D-1> GOTH_VALUE temp =
=3D=20
goth_null_value;</FONT></FONT> <BR><FONT face=3D"Courier =
New,Courier"><FONT=20
size=3D-1> temp =3D =
constructEntry(=20
m_pLastObject->getWrappedClassName(), m_lastObjectKey =
);</FONT></FONT><FONT=20
face=3D"Courier New,Courier"><FONT size=3D-1></FONT></FONT>=20
<P><FONT face=3D"Courier New,Courier"><FONT=20
size=3D-1> // Output that we =
had to=20
deactivate object.</FONT></FONT> <BR><FONT face=3D"Courier =
New,Courier"><FONT=20
size=3D-1> (void) =
goth_printf(=20
goth_stdout, "DEBUG>\t\t\t\t\t[D] - Deactivating object - %s.\n",=20
temp.string );</FONT></FONT><FONT face=3D"Courier New,Courier"><FONT=20
size=3D-1></FONT></FONT>=20
<P><FONT face=3D"Courier New,Courier"><FONT=20
size=3D-1> // Free the =
assigned=20
temporary string.</FONT></FONT> <BR><FONT face=3D"Courier =
New,Courier"><FONT=20
size=3D-1> (void) =
goth_value_free(=20
temp, DT_STRING );</FONT></FONT> <BR><FONT face=3D"Courier =
New,Courier"><FONT=20
size=3D-1>#endif</FONT></FONT> <BR><FONT face=3D"Courier =
New,Courier"><FONT=20
size=3D-1> // Deactivate the =
object,=20
using its unique object id.</FONT></FONT> <BR><FONT=20
face=3D"Courier New,Courier"><FONT=20
size=3D-1> m_poa ->=20
deactivate_object( m_pLastObject -> m_last_object_id =
);</FONT></FONT>=20
<BR><FONT face=3D"Courier New,Courier"><FONT =
size=3D-1> =20
}</FONT></FONT> <BR><FONT face=3D"Courier New,Courier"><FONT=20
size=3D-1>}</FONT></FONT> <BR><FONT face=3D"Courier New,Courier"><FONT =
size=3D-1>catch ( ... ) {}</FONT></FONT><FONT face=3D"Courier =
New,Courier"><FONT=20
size=3D-1></FONT></FONT>=20
<P><FONT face=3D"Courier New,Courier"><FONT size=3D-1>// Delete the=20
object.</FONT></FONT> <BR><FONT face=3D"Courier New,Courier"><FONT=20
size=3D-1>delete m_pLastObject;</FONT></FONT>=20
<P>Cheers, <BR>-- <BR> Marcus A.T MacWilliam, MSc, CEng, MBCS, =
BSc(Hons).=20
<BR> Senior Software Engineer, Laser-Scan Ltd, Cambridge, CB4 =
0FY.=20
<BR> Tel: +44 (0)1223 420414 x213. Mobile: +44 (0)7803 706597.=20
<BR> Fax: +44 (0)1223 420044. Web: <A=20
href=3D"http://www.laser-scan.co.uk/">http://www.laser-scan.co.uk/</A> =
<BR> </P></BLOCKQUOTE></BODY></HTML>
------=_NextPart_000_0024_01C26637.D1707DC0--