A simple interface as below:
Code:
interface Hello
{
string say();
};
and its implementation has been registered as a global object "hello" during initialization:
Code:
Ice::ObjectPtr object = new HelloI();
Ice::ObjectPrx obj = _adapter->add(object, Ice::stringToIdentity("hello"));
IcePack::AdminPrx admin = IcePack::AdminPrx::checkedCast(
communicator->stringToProxy("IcePack/Admin")
);
admin->addObjectWithType(obj, "::Hello");
The problem is, inside the implemetation of Hello::say, cannot I access the "hello" object? The following code could not run.
Code:
::std::string
HelloI::say(const Ice::Current& current)
{
// thread blocked here
HelloPrx hello = HelloPrx::checkedCast(
current.adapter->getCommunicator()->stringToProxy("hello")
);
return "hi";
}
What's wrong?