client creating objects

in Help Center
Hello,
I am a CORBA newbie. Firstly i transited to Ice recently after some frustrations with other open source CORBA implementations. I could get basic \demo\Ice\Hello\ examples working well.
So, referring to "demo\Ice\Hello" example, it seems like the client can only access an existing object at the server by getting a proxyString. I extended this so that this server object can create more objects and return strings to the client on the same adapter.
My question is, is this how the client can create new objects or is there a known way that most experts use. Once again, the question is " how does the client create new objects at the server dynamically without referring to it in the configuration file".
thanks
bks
I am a CORBA newbie. Firstly i transited to Ice recently after some frustrations with other open source CORBA implementations. I could get basic \demo\Ice\Hello\ examples working well.
So, referring to "demo\Ice\Hello" example, it seems like the client can only access an existing object at the server by getting a proxyString. I extended this so that this server object can create more objects and return strings to the client on the same adapter.
My question is, is this how the client can create new objects or is there a known way that most experts use. Once again, the question is " how does the client create new objects at the server dynamically without referring to it in the configuration file".
thanks
bks
0
Comments
Cheers,
Michi.
thanks that helped. As an extension to the above discussion, what is the appropriate way for the client to destroy this object.
I am thinking, for every create method, a destroy method that passes the Proxy as a parameter. In the implementation do proxy->ice_getIdentity() and then remove(identity) from the ASM. I beleive once the object is gone from the ASM it is subject to garbage collection, rite? Am I mising somethign here?
thanks
bks
I would advise against doing it this way. If you put a destroy() method on the factory, then, to destroy an object, you must know which factory created it. But, in a complex system with lots of factories and objects, that can rapidly become complex. A better option is to put the destroy() method on the object itself. That way, if you have created an object and passed it around to various other parties, anyone can destroy() the object by asking it to commit suicide: It depends on whether your application code still holds a smart pointer to the servant or not. If it doesn't, then the entry in the ASM is the last smart pointer to the servant and, when you remove the servant's registration from the ASM, the Ice runtime decrements the ref count, which causes the servant to be deleted.
Cheers,
Michi.