Archived

This forum has been archived. Please start a new discussion on GitHub.

obtaining a proxy for "this" in a servant

Within a servant implementation, is there a canonical way for obtaining a Proxy for "this", so that one can pass it to remote method for callback purposes?

I've currently been using the following, which seems to do the right thing..
void
FooI::doFoo(const Ice::Current& c)
{
    FooPrx thisPrx = FooPrx::uncheckedCast(c.adapter->createProxy(c.id));

    ...
}

Can I safely cache thisPrx, assuming I only add the servant to one adapter? In the multiple adapter case, can I store a per-adapter cached Prx?

Thanks in advance for any information!

Comments

  • As long as your servant only implements one single Ice object, and you use it only with one object adapter, you can cache thisPrx.