[omniORB] Detecting activated servants...

Warren Brown warren@scully.xfiles.za.org
Fri Sep 27 13:56:01 2002


------=_NextPart_000_0010_01C26635.C3D5BE20
Content-Type: text/plain;
	charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable

Hi

Maybe deactivate and dead are two different things in Corba.
We use a cgi-script called name-cgi to get references to orbs around the =
building.
There are at least 5 machines per orb, so we have the script do load =
balancing by checking if the orb is alive or dead, if it is dead then =
the cgi-script releases it from the Nameservice, and will eventually =
email a sys-admin to go and check the orb.
So in that sense, we don't deactivate the orbs, just kick them out of =
the nameservice.


  ----- 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_0010_01C26635.C3D5BE20
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>Hi</FONT></DIV>
<DIV><FONT face=3DArial size=3D2></FONT>&nbsp;</DIV>
<DIV><FONT face=3DArial size=3D2>Maybe deactivate and dead are two =
different things=20
in Corba.</FONT></DIV>
<DIV><FONT face=3DArial size=3D2>We use a cgi-script called name-cgi to =
get=20
references to orbs around the building.</FONT></DIV>
<DIV><FONT face=3DArial size=3D2>There are at least 5 machines per orb, =
so we have=20
the script do load balancing by checking if the orb is alive or dead, if =
it is=20
dead then the cgi-script releases it from the Nameservice, and will =
eventually=20
email a sys-admin to go and check the orb.</FONT></DIV>
<DIV><FONT face=3DArial size=3D2>So in that sense, we don't deactivate =
the orbs,=20
just kick them out of the nameservice.</FONT></DIV>
<DIV><FONT face=3DArial size=3D2></FONT>&nbsp;</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">&nbsp;</DIV>
  <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&nbsp; the&nbsp; ._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" &lt;<A =

    href=3D"mailto:marcusma@lsl.co.uk">marcusma@lsl.co.uk</A>&gt; =
<BR>To: "OmniORB=20
    mailing list" &lt;<A=20
    =
href=3D"mailto:omniorb-list@omniorb-support.com">omniorb-list@omniorb-sup=
port.com</A>&gt;=20
    <BR>Sent: Friday, September 27, 2002 12:35 PM <BR>Subject: [omniORB] =

    Detecting activated servants...=20
    <P>&gt; All, <BR>&gt; <BR>&gt; I am using v4.0.0 and NT v4.0 and =
VC++ V5.=20
    <BR>&gt; <BR>&gt; I am getting a message from omni orb telling me =
that I am=20
    deleting <BR>&gt; an active servant, and that it will deactivate it =
first.=20
    <BR>&gt; <BR>&gt; However, when it does this, and my server shuts =
down it=20
    hangs, and <BR>&gt; does not complete properly. <BR>&gt; <BR>&gt; Is =
there=20
    any way I can detect if an object/servant is active, before <BR>&gt; =
I try=20
    to delete it. Is there a method that return true/false (0/1). =
<BR>&gt;=20
    <BR>&gt; Cheers, <BR>&gt; -- <BR>&gt;&nbsp; Marcus A.T MacWilliam, =
MSc,=20
    CEng, MBCS, BSc(Hons). <BR>&gt;&nbsp; Senior Software Engineer, =
Laser-Scan=20
    Ltd, Cambridge, CB4 0FY. <BR>&gt;&nbsp; Tel: +44 (0)1223 420414 =
x213.=20
    Mobile: +44 (0)7803 706597. <BR>&gt;&nbsp; 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>&gt; <BR>&gt; <BR>&gt; <BR>&gt;=20
    _______________________________________________ <BR>&gt; =
omniORB-list=20
    mailing list <BR>&gt; omniORB-list@omniorb-support.com <BR>&gt; <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>&gt;</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>&nbsp;&nbsp;&nbsp; if=20
  (!m_pLastObject._non_existent())</FONT></FONT> <BR><FONT=20
  face=3D"Courier New,Courier"><FONT size=3D-1>&nbsp;&nbsp;&nbsp; =
{</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>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; // Local variable =
to hold=20
  entry.</FONT></FONT> <BR><FONT face=3D"Courier New,Courier"><FONT=20
  size=3D-1>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; GOTH_VALUE temp =
=3D=20
  goth_null_value;</FONT></FONT> <BR><FONT face=3D"Courier =
New,Courier"><FONT=20
  size=3D-1>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; temp =3D =
constructEntry(=20
  m_pLastObject-&gt;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>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; // Output that we =
had to=20
  deactivate object.</FONT></FONT> <BR><FONT face=3D"Courier =
New,Courier"><FONT=20
  size=3D-1>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; (void) =
goth_printf(=20
  goth_stdout, "DEBUG&gt;\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>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; // Free the =
assigned=20
  temporary string.</FONT></FONT> <BR><FONT face=3D"Courier =
New,Courier"><FONT=20
  size=3D-1>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; (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>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; // Deactivate the =
object,=20
  using its unique object id.</FONT></FONT> <BR><FONT=20
  face=3D"Courier New,Courier"><FONT=20
  size=3D-1>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; m_poa -&gt;=20
  deactivate_object( m_pLastObject -&gt; m_last_object_id =
);</FONT></FONT>=20
  <BR><FONT face=3D"Courier New,Courier"><FONT =
size=3D-1>&nbsp;&nbsp;&nbsp;=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>&nbsp;Marcus A.T MacWilliam, MSc, CEng, MBCS, =
BSc(Hons).=20
  <BR>&nbsp;Senior Software Engineer, Laser-Scan Ltd, Cambridge, CB4 =
0FY.=20
  <BR>&nbsp;Tel: +44 (0)1223 420414 x213. Mobile: +44 (0)7803 706597.=20
  <BR>&nbsp;Fax: +44 (0)1223 420044. Web: <A=20
  href=3D"http://www.laser-scan.co.uk/">http://www.laser-scan.co.uk/</A> =

  <BR>&nbsp; </P></BLOCKQUOTE></BODY></HTML>

------=_NextPart_000_0010_01C26635.C3D5BE20--