How to check if object already activated? - Object
This is a discussion on How to check if object already activated? - Object ; I have a factory that creates objects, but it gives an error if
objects with the same id are created.
Is there a way to check if an object with a particular id is
already activated so I won't activate ...
-
How to check if object already activated?
I have a factory that creates objects, but it gives an error if
objects with the same id are created.
Is there a way to check if an object with a particular id is
already activated so I won't activate the same object twice?
My current factory code :
SessImpl *si = new SessImpl(poa_m, objectid, _this());
PortableServer::ObjectId_var id = PortableServer::string_to_ObjectId(objectid);
// is there a way to check if the id above already is activated before
// I call the code below??
poa_m->activate_object_with_id(id,si);
CORBA::Object_var obj = poa_m->id_to_reference(id);
sessref = Mod::Sess::_narrow(obj);
-
Re: How to check if object already activated?
brightoceanlight@hotmail.com (Gil) writes:
> I have a factory that creates objects, but it gives an error if
> objects with the same id are created.
>
> Is there a way to check if an object with a particular id is
> already activated so I won't activate the same object twice?
>
> My current factory code :
>
> SessImpl *si = new SessImpl(poa_m, objectid, _this());
> PortableServer::ObjectId_var id = PortableServer::string_to_ObjectId(objectid);
> // is there a way to check if the id above already is activated before
> // I call the code below??
You could use
poa_m->id_to_reference(id);
or
poa_m->id_to_servant(id);
If it throws ObjectNotActive, it's not active.
> poa_m->activate_object_with_id(id,si);
> CORBA::Object_var obj = poa_m->id_to_reference(id);
> sessref = Mod::Sess::_narrow(obj);
Best regards, Matthias
-
Re: How to check if object already activated?
Matthias Riese <Matthias.Riese@rieseIT.de> wrote in message news:<c1sclk$2st$1@news1.ewetel.de>...
> brightoceanlight@hotmail.com (Gil) writes:
>
> > I have a factory that creates objects, but it gives an error if
> > objects with the same id are created.
> >
> > Is there a way to check if an object with a particular id is
> > already activated so I won't activate the same object twice?
> >
> > My current factory code :
> >
> > SessImpl *si = new SessImpl(poa_m, objectid, _this());
> > PortableServer::ObjectId_var id = PortableServer::string_to_ObjectId(objectid);
> > // is there a way to check if the id above already is activated before
> > // I call the code below??
>
> You could use
> poa_m->id_to_reference(id);
> or
> poa_m->id_to_servant(id);
> If it throws ObjectNotActive, it's not active.
>
> > poa_m->activate_object_with_id(id,si);
> > CORBA::Object_var obj = poa_m->id_to_reference(id);
> > sessref = Mod::Sess::_narrow(obj);
>
> Best regards, Matthias
Thanks Matthias for the response!
So basically, I need to call poa_m->id_to_reference(id) before
poa_m->activate_object_with_id(id,si), and activate the object
in the catch block?
-
Re: How to check if object already activated?
Matthias Riese <Matthias.Riese@rieseIT.de> wrote in message news:<c1sclk$2st$1@news1.ewetel.de>...
> brightoceanlight@hotmail.com (Gil) writes:
>
> > I have a factory that creates objects, but it gives an error if
> > objects with the same id are created.
> >
> > Is there a way to check if an object with a particular id is
> > already activated so I won't activate the same object twice?
> >
> > My current factory code :
> >
> > SessImpl *si = new SessImpl(poa_m, objectid, _this());
> > PortableServer::ObjectId_var id = PortableServer::string_to_ObjectId(objectid);
> > // is there a way to check if the id above already is activated before
> > // I call the code below??
>
> You could use
> poa_m->id_to_reference(id);
> or
> poa_m->id_to_servant(id);
> If it throws ObjectNotActive, it's not active.
>
> > poa_m->activate_object_with_id(id,si);
> > CORBA::Object_var obj = poa_m->id_to_reference(id);
> > sessref = Mod::Sess::_narrow(obj);
>
> Best regards, Matthias
Thanks Matthias for the response!
So basically, I need to call poa_m->id_to_reference(id) before
poa_m->activate_object_with_id(id,si), and activate the object
in the catch block?
Similar Threads
-
By Application Development in forum XML SOAP
Replies: 2
Last Post: 04-09-2007, 02:48 PM
-
By Application Development in forum DOTNET
Replies: 0
Last Post: 06-21-2005, 10:54 AM
-
By Application Development in forum basic.visual
Replies: 0
Last Post: 06-21-2005, 10:40 AM
-
By Application Development in forum DOTNET
Replies: 2
Last Post: 01-29-2004, 11:55 AM
-
By Application Development in forum DOTNET
Replies: 1
Last Post: 10-28-2003, 03:47 AM