[omniORB] Which exceptions can be thrown by a call to _narrow () and when?

Ilinykh, Andre AIlinykh@SECTORBASE.COM
Thu, 25 Jan 2001 10:35:57 -0800


We don't use NameService, I create object Factory using IP and port.
Every time server is down I get COMM_FAILURE exception.
This is my code.
Thank you,
  Andrey
bool InitFactory()
{

	char tmp[256];
	sprintf(tmp,"corbaloc:iiop:%s:2000/KeyOfMyServer",ssIP);
	CORBA::Object_var obj = orb->string_to_object(tmp);
	try {	
		fref= SS::SubscriptionFactory::_narrow(obj);
	} catch(...){
		return false;
	}
	if( CORBA::is_nil(fref) ) {
		//cerr << "Can't narrow reference to type SF (or it was
nil)." << endl;
		return false;
	}
	return true;
}

-----Original Message-----
From: Sai-Lai Lo [mailto:S.Lo@uk.research.att.com]
Sent: Thursday, January 25, 2001 10:11 AM
To: omniorb-list@uk.research.att.com
Subject: Re: [omniORB] Which exceptions can be thrown by a call to
_narrow () and when?


_narrow() may or may not have to contact the real object to determine
whether the operation should succeed. The chapter on type checking in the
omniORB user guide explains this in some detail. Since a remote invocation
may be called as part of a _narrow, the full range of system exception may
be reported.

By the way, omniORB never needs to contact the server to do
string_to_object. If you have some code that shows the contrary, please
send it to me.

Sai-Lai


>>>>> Ilinykh, Andre writes:

> There are others, for example COMM_FAILURE. _narrow() can check the type
of
> real object. I'm not sure when it does this way. At least, every time I
> create object reference by string_to_object("corbaloc:iiop:/...") it goes
to
> my server.
> Thanks,
>   Andrey

> -----Original Message-----
> From: ERIKSSON,TOBIAS (A-Sweden,ex1)
> [mailto:tobias_eriksson@agilent.com]
> Sent: Thursday, January 25, 2001 2:19 AM
> To: omniorb-list@uk.research.att.com
> Subject: [omniORB] Which exceptions can be thrown by a call to _narrow()
> and when?


> Hi
>  I'm trying to use narrow to tell me if the type of the object beeing
> narrowed actually is of the type I want, 
> I think that it will throw BAD_PARAM if they are not the same, is this
> correct and are there any others?

>  Regards
>    Tobias




-- 
Sai-Lai Lo                                   S.Lo@uk.research.att.com
AT&T Laboratories Cambridge           WWW:   http://www.uk.research.att.com 
24a Trumpington Street                Tel:   +44 1223 343000
Cambridge CB2 1QA                     Fax:   +44 1223 313542
ENGLAND