How to provoke 'false' as return value from a _non_existent() call

How to provoke 'false' as return value from a _non_existent() call

Post by dani » Fri, 25 Jul 2003 02:28:14



Hi,
  I am just curious to know, how I can provoke a 'false'
as a return value when a call to _non_existent() is made.

Can I suspend the server program using the unix command ?
kill -STOP <pid of server>
During this invoke the _non_existent() call.

I tried the following
(1)
kill -9 <pid of server process>

invoke _non_existent( )

(2)
kill -STOP <pid of server process>

invoke _non_existent( )

But in both the cases _non_existent( ) returns true and does not throw
any exception.

Please help me in provoking a 'false' return value or an exception
from _non_existent ( )

Thanks,
daniel.

 
 
 

How to provoke 'false' as return value from a _non_existent() call

Post by Michi Hennin » Fri, 25 Jul 2003 08:18:42



Quote:> Hi,
>   I am just curious to know, how I can provoke a 'false'
> as a return value when a call to _non_existent() is made.

_non_existent() must return true if the server can be reached,
but no servant can be found for the object identity that is
in the IOR. So, to get non-existent to return false, all you
need to do is invoke it via an IOR for an object for which
there is no servant, such as for a previously destroyed (in the life
cycle sense) object, or via a manufactured IOR with an
object identity that is unknown to the server.

_non_existent() must return false if you invoke it via any
IOR for which there *is* a servant, that is, take any IOR
for a working object and call _non_existent() on it. You
should get a false return value.

Quote:> Can I suspend the server program using the unix command ?
> kill -STOP <pid of server>
> During this invoke the _non_existent() call.

> I tried the following
> (1)
> kill -9 <pid of server process>

> invoke _non_existent( )

> (2)
> kill -STOP <pid of server process>

> invoke _non_existent( )

> But in both the cases _non_existent( ) returns true and does not throw
> any exception.

That's wrong. _non_existent() is obliged to not lie to you, that is, if the
server cannot be reached, no reliable determination can be made, and
_non_existent() must throw an exception. (The spec requires that.)
In your case, because the server does not respond to the client's
connection request (or invocation via an already existing connection),
you should get a TRANSIENT exception.

Depending on the timeout policies of the client, if you invoke
_non_existent() while the server is suspended, you could also
end up with _non_existent() waiting indefinitely for an answer.

But, in no case is _non_existent() allowed to return without an
exception if it hasn't confirmed with the server what the status of
the object is.

Cheers,

Michi.

--
Michi Henning              Ph: +61 4 1118-2700
ZeroC, Inc.                http://www.zeroc.com