Home Help Center

Self access problem

A simple interface as below:
interface Hello
{
	string say();
};
and its implementation has been registered as a global object "hello" during initialization:
	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.
::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? :confused:

Comments

  • mesmes CaliforniaAdministrators, ZeroC Staff Mark SpruiellOrganization: ZeroC, Inc.Project: Ice Developer ZeroC Staff
    Hi,

    I'm pretty sure that you're encountering a thread pool size limitation. The default size of the server thread pool is one, therefore if a server makes a call to itself the server will deadlock unless the size of the thread pool is increased.

    The property to set is Ice.ThreadPool.Server.Size.

    Take care,
    - Mark
  • JonathanJonathan Member
    Yeah, it's the problem. Thanks very much.:D
    I've seen the warning but I forgot this:p
Sign In or Register to comment.