[omniORB] Do _narrow() always result in net traffic?
Frank Lynch
flynch@usa.net
3 Nov 99 08:49:12 MST
Hi,
I'm not certain how omniORB implements this but other ORB's I've used hav=
e the
following behaviour....
_narrow() does not normally result in a remote call, however there is one=
situation (that I know of) where it does....
This happens in a situation where in a server you create an object say
checkingAccount that inherits from Account,and your client only has stub=
code
for Account. =
// Psuedo - IDL
interface Account {...}
interface CheckingAccount : Account {...}
1. Your server creates and publishes a CheckingAccount object.
2. Your client obtains an Object reference (from the NS or a file) and
attempts to narrow the CORBA Object to an Account proxy. The type_id in t=
he
IOR will refer to the type CheckingAccount, which your client has no know=
ledge
of (as it only has stub code for the Account type). In this situation the=
call
to Account::_narrow(obj); results in a remote _is_a(). If CheckingAccount=
inherits from account (as is this case) the _is_a() will succeed and the
narrow will succeed, otherwise the narrow will return a nil object.
Hope this helps,
Frank. =
>I'm replying to myself, as I think I found the answer.
>
>After browsing the omniorb code, and verifying it with another
>orb
>(Orbacus for java), I found that the _narrow() call will only
>ask the remote object if the cast qualifies for a class cast
>exception.
>
>So - there is practically no overhead in calling _narrow()!
>-Haarek Ryeng (thinking loud)
>
>
>Haarek Ryeng wrote:
>
>> Object reference _narrow() question:
>>
>> Will a down-casting through the reference
>> <reftype>::_narrow(ref) function generate net traffic?
>> (unless the ref is of the same as <reftype>)
>>
>> Reason I ask, is that I'm implementing a data-pushing
>> mechanism where it=92s convenient to store only references of
>> the base class, but to push data to a more specialised class
>> =96 thus needing to down-cast.
>> As always =96 alas =96 the communication rate is limited.
>>
>> Haarek Ryeng
____________________________________________________________________
Get free email and a permanent address at http://www.netaddress.com/?N=3D=
1