Discussion:
[omniORB] Help: Identify object/servant location
Carsten.Agger at tieto.com ()
2009-01-27 18:39:33 UTC
Permalink
I'm implementing a CORBA service which is to be deployed in several
instances in various locations on the network.



The servants may receive and process CORBA objects which are members of
its own class.



This raises a problem: In some cases, a servant may be passed a
reference to a servant object located on its own service. In this case,
the processing needs to differ slightly to allow services to be
redundant mirrors of the same data. What I need is basically: If the
object reference is to the same database, don't call remotely via the
ORB, process locally, as the servant may be loaded here.



But how do I know it is local or to the same database? I thought of
using user generated IDs and code the database identifier
(server.database) in the object ID, but there doesn't seem to be an easy
way to extract the object ID from an object pointer, as it seems to be
located on the servant's POA only.



Because of backwards compatibility problems we can't easily change or
extend the IDL to include a getLocation() method. So how would one
actually do it?



best regards and TIA for any response,



Carsten Agger,

Tieto.com, Denmark



-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.omniorb-support.com/pipermail/omniorb-list/attachments/20090127/873e7334/attachment.htm
Duncan Grisby
2009-01-27 22:25:22 UTC
Permalink
On Tuesday 27 January, ***@tieto.com wrote:

[...]
This raises a problem: In some cases, a servant may be passed a reference to a
servant object located on its own service. In this case, the processing needs
to differ slightly to allow services to be redundant mirrors of the same data.
What I need is basically: If the object reference is to the same database,
don?t call remotely via the ORB, process locally, as the servant may be loaded
here.
But how do I know it is local or to the same database? I thought of using user
generated IDs and code the database identifier (server.database) in the object
ID, but there doesn?t seem to be an easy way to extract the object ID from an
object pointer, as it seems to be located on the servant?s POA only.
As long as you know which POA the servant is activated in, you can try
calling poa->reference_to_servant(), giving it the object reference. If
that succeeds, you know that the object corresponds to a local servant;
if it fails with a PortableServer::POA::WrongAdapter exception, then you
know it's not an object in that POA (and thus is remote). You might also
get an ObjectNotActive exception, which means the object reference
corresponds to the POA, but that the object id in it is not active.

Cheers,

Duncan.
--
-- Duncan Grisby --
-- ***@grisby.org --
-- http://www.grisby.org --
Martin Trappel
2009-01-28 13:11:56 UTC
Permalink
Post by Carsten.Agger at tieto.com ()
...
This raises a problem: In some cases, a servant may be passed a
reference to a servant object located on its own service. In this case,
the processing needs to differ slightly to allow services to be
redundant mirrors of the same data. What I need is basically: If the
object reference is to the same database, don?t call remotely via the
ORB, process locally, as the servant may be loaded here.
But how do I know it is local or to the same database? I thought of
...
Because of backwards compatibility problems we can?t easily change or
extend the IDL to include a getLocation() method. So how would one
actually do it?
I thought extending IDLs does not raise compatibility issues?
i.e.
old.idl:
module X
{
interface IX
{
void foo();
};
}

new.idl:
module X
{
interface IX
{
void foo();
string getLocation()
};
}

"clients" using old.idl can communicate with "servers" using new.idl
without problems

br,
Martin

Loading...