[omniORB] Detecting activated servants...

Marcus MacWilliam marcusma@lsl.co.uk
Fri Sep 27 12:44:01 2002


--------------FB83D8E8D1433B56421587E4
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit

Warren Brown wrote:

> Try  the  ._non_existent() method in a try catch block.
>
> Warren Brown
> Telkom South Africa
>
> ----- Original Message -----
> From: "Marcus MacWilliam" <marcusma@lsl.co.uk>
> To: "OmniORB mailing list" <omniorb-list@omniorb-support.com>
> Sent: Friday, September 27, 2002 12:35 PM
> Subject: [omniORB] Detecting activated servants...
>
> > All,
> >
> > I am using v4.0.0 and NT v4.0 and VC++ V5.
> >
> > I am getting a message from omni orb telling me that I am deleting
> > an active servant, and that it will deactivate it first.
> >
> > However, when it does this, and my server shuts down it hangs, and
> > does not complete properly.
> >
> > Is there any way I can detect if an object/servant is active, before
> > I try to delete it. Is there a method that return true/false (0/1).
> >
> > Cheers,
> > --
> >  Marcus A.T MacWilliam, MSc, CEng, MBCS, BSc(Hons).
> >  Senior Software Engineer, Laser-Scan Ltd, Cambridge, CB4 0FY.
> >  Tel: +44 (0)1223 420414 x213. Mobile: +44 (0)7803 706597.
> >  Fax: +44 (0)1223 420044. Web: http://www.laser-scan.co.uk/
> >
> >
> >
> > _______________________________________________
> > omniORB-list mailing list
> > omniORB-list@omniorb-support.com
> > http://www.omniorb-support.com/mailman/listinfo/omniorb-list
> >

OK,

Below is a fragment of my code. The servant always exists, but it should
already have been deactivated by an earlier release() method. Will
_non_existent() in this case, tell me if it is still active.

// Sanity check, if the object is still active, deactivate it.
try
{
    if (!m_pLastObject._non_existent())
    {
#ifdef GOTHIC_DEBUG
        // Local variable to hold entry.
        GOTH_VALUE temp = goth_null_value;
        temp = constructEntry( m_pLastObject->getWrappedClassName(),
m_lastObjectKey );

        // Output that we had to deactivate object.
        (void) goth_printf( goth_stdout, "DEBUG>\t\t\t\t\t[D] -
Deactivating object - %s.\n", temp.string );

        // Free the assigned temporary string.
        (void) goth_value_free( temp, DT_STRING );
#endif
        // Deactivate the object, using its unique object id.
        m_poa -> deactivate_object( m_pLastObject -> m_last_object_id );
    }
}
catch ( ... ) {}

// Delete the object.
delete m_pLastObject;

Cheers,
--
 Marcus A.T MacWilliam, MSc, CEng, MBCS, BSc(Hons).
 Senior Software Engineer, Laser-Scan Ltd, Cambridge, CB4 0FY.
 Tel: +44 (0)1223 420414 x213. Mobile: +44 (0)7803 706597.
 Fax: +44 (0)1223 420044. Web: http://www.laser-scan.co.uk/


--------------FB83D8E8D1433B56421587E4
Content-Type: text/html; charset=us-ascii
Content-Transfer-Encoding: 7bit

<!doctype html public "-//w3c//dtd html 4.0 transitional//en">
<html>
Warren Brown wrote:
<blockquote TYPE=CITE>Try&nbsp; the&nbsp; ._non_existent() method in a
try catch block.
<p>Warren Brown
<br>Telkom South Africa
<p>----- Original Message -----
<br>From: "Marcus MacWilliam" &lt;marcusma@lsl.co.uk>
<br>To: "OmniORB mailing list" &lt;omniorb-list@omniorb-support.com>
<br>Sent: Friday, September 27, 2002 12:35 PM
<br>Subject: [omniORB] Detecting activated servants...
<p>> All,
<br>>
<br>> I am using v4.0.0 and NT v4.0 and VC++ V5.
<br>>
<br>> I am getting a message from omni orb telling me that I am deleting
<br>> an active servant, and that it will deactivate it first.
<br>>
<br>> However, when it does this, and my server shuts down it hangs, and
<br>> does not complete properly.
<br>>
<br>> Is there any way I can detect if an object/servant is active, before
<br>> I try to delete it. Is there a method that return true/false (0/1).
<br>>
<br>> Cheers,
<br>> --
<br>>&nbsp; Marcus A.T MacWilliam, MSc, CEng, MBCS, BSc(Hons).
<br>>&nbsp; Senior Software Engineer, Laser-Scan Ltd, Cambridge, CB4 0FY.
<br>>&nbsp; Tel: +44 (0)1223 420414 x213. Mobile: +44 (0)7803 706597.
<br>>&nbsp; Fax: +44 (0)1223 420044. Web: <a href="http://www.laser-scan.co.uk/">http://www.laser-scan.co.uk/</a>
<br>>
<br>>
<br>>
<br>> _______________________________________________
<br>> omniORB-list mailing list
<br>> omniORB-list@omniorb-support.com
<br>> <a href="http://www.omniorb-support.com/mailman/listinfo/omniorb-list">http://www.omniorb-support.com/mailman/listinfo/omniorb-list</a>
<br>></blockquote>
OK,
<p>Below is a fragment of my code. The servant always exists, but it should
<br>already have been deactivated by an earlier release() method. Will
<br>_non_existent() in this case, tell me if it is still active.
<p><font face="Courier New,Courier"><font size=-1>// Sanity check, if the
object is still active, deactivate it.</font></font>
<br><font face="Courier New,Courier"><font size=-1>try</font></font>
<br><font face="Courier New,Courier"><font size=-1>{</font></font>
<br><font face="Courier New,Courier"><font size=-1>&nbsp;&nbsp;&nbsp; if
(!m_pLastObject._non_existent())</font></font>
<br><font face="Courier New,Courier"><font size=-1>&nbsp;&nbsp;&nbsp; {</font></font>
<br><font face="Courier New,Courier"><font size=-1>#ifdef GOTHIC_DEBUG</font></font>
<br><font face="Courier New,Courier"><font size=-1>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
// Local variable to hold entry.</font></font>
<br><font face="Courier New,Courier"><font size=-1>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
GOTH_VALUE temp = goth_null_value;</font></font>
<br><font face="Courier New,Courier"><font size=-1>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
temp = constructEntry( m_pLastObject->getWrappedClassName(), m_lastObjectKey
);</font></font><font face="Courier New,Courier"><font size=-1></font></font>
<p><font face="Courier New,Courier"><font size=-1>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
// Output that we had to deactivate object.</font></font>
<br><font face="Courier New,Courier"><font size=-1>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
(void) goth_printf( goth_stdout, "DEBUG>\t\t\t\t\t[D] - Deactivating object
- %s.\n", temp.string );</font></font><font face="Courier New,Courier"><font size=-1></font></font>
<p><font face="Courier New,Courier"><font size=-1>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
// Free the assigned temporary string.</font></font>
<br><font face="Courier New,Courier"><font size=-1>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
(void) goth_value_free( temp, DT_STRING );</font></font>
<br><font face="Courier New,Courier"><font size=-1>#endif</font></font>
<br><font face="Courier New,Courier"><font size=-1>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
// Deactivate the object, using its unique object id.</font></font>
<br><font face="Courier New,Courier"><font size=-1>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
m_poa -> deactivate_object( m_pLastObject -> m_last_object_id );</font></font>
<br><font face="Courier New,Courier"><font size=-1>&nbsp;&nbsp;&nbsp; }</font></font>
<br><font face="Courier New,Courier"><font size=-1>}</font></font>
<br><font face="Courier New,Courier"><font size=-1>catch ( ... ) {}</font></font><font face="Courier New,Courier"><font size=-1></font></font>
<p><font face="Courier New,Courier"><font size=-1>// Delete the object.</font></font>
<br><font face="Courier New,Courier"><font size=-1>delete m_pLastObject;</font></font>
<p>Cheers,
<br>--
<br>&nbsp;Marcus A.T MacWilliam, MSc, CEng, MBCS, BSc(Hons).
<br>&nbsp;Senior Software Engineer, Laser-Scan Ltd, Cambridge, CB4 0FY.
<br>&nbsp;Tel: +44 (0)1223 420414 x213. Mobile: +44 (0)7803 706597.
<br>&nbsp;Fax: +44 (0)1223 420044. Web: <A HREF="http://www.laser-scan.co.uk/">http://www.laser-scan.co.uk/</A>
<br>&nbsp;</html>

--------------FB83D8E8D1433B56421587E4--