[omniORB] How to shut my Corba Server application in another thread?

Duncan Grisby dgrisby@uk.research.att.com
Mon, 12 Mar 2001 18:14:43 +0000


On Friday 9 March, "Len Holgate \(Mail List Account\)" wrote:

> I was playing around with something like this today and I found that
> 
> void ServerControlImpl::shutdown()
> {
>     orb->shutdown(0);
> }
> 
> worked for me, this seems to prevent further method calls and then causes
> the server to shut down once all active method calls complete.

That is the correct way to shut down the ORB from within an operation
implementation.

> The problem you have with
> 
>     orb->shutdown(true);
> 
> is that the method call that calls shutdown will never complete - because
> it's waiting for the shutdown to happen... If you pass 0 then the call to
> shutdown will return straight away, your method call will finish and the
> server will shutdown when any other outstanding calls finish.

The CORBA spec says that the ORB should throw CORBA::BAD_INV_ORDER if
you try that. Unfortunately, that requires Current support which
omniORB 3 doesn't have. omniORB 4 will correctly throw the exception.

Cheers,

Duncan.

-- 
 -- Duncan Grisby  \  Research Engineer  --
  -- AT&T Laboratories Cambridge          --
   -- http://www.uk.research.att.com/~dpg1 --