Home Help Center

Server returning an IceGrid::Session proxy

BorlecBorlec Member Boris LecourtOrganization: ISISProject: Integration Bench
Hello !

Is it possible for a server to create and return a proxy to an IceGrid::Session and have the client keepAlive the returned session ?

I tried that :
- the session in the server is well created (I can invoque setAllocationTimeout for example)
- but the client got the exception ObjectNotExist when invoquing keepAlive or setAllocationTimeout .

What does wrong ?
Thanks !
Boris.

Comments

  • BorlecBorlec Member Boris LecourtOrganization: ISISProject: Integration Bench
    Actually, my code is slightly different from described above...

    In fact, it is a client which create the IceGrid session and give it to a server:
    registry = IceGrid::RegistryPrx::checkedCast(ic->stringToProxy("SYSTEM/Registry"));
    session = registry->createSession("root","...");
    server_proxy->InstanciateAndAllocateNewServer(session);
    

    The interface of the server :
    interface ... {
        int InstanciateAndAllocateNewServer(IceGrid::Session* session);
    };
    

    And the implementation of the server interface :
    Ice::Int ...::InstanciateAndAllocateNewServer(const ::IceGrid::SessionPrx& session,...) {
        session->setAllocationTimeout(5000);
        // exception Ice::ObjectNotExistException
    }
    

    Ice version 3.3.1 on Windows XP

    Tanks in advance for your help !
  • benoitbenoit Rennes, FranceAdministrators, ZeroC Staff Benoit FoucherOrganization: ZeroC, Inc.Project: Ice ZeroC Staff
    Hi,

    The IceGrid session object is tied to the connection between the client and the IceGrid registry so other processes can't invoke on the Ice session proxy. This ensures that only the client which was authorized to create the session uses it. Why don't you have the server create the session itself on behalf of the client and implement a session facade for the client to invoke on the server?

    We demonstrated this in the issue 18 and 19 of the "Ice Connections" newsletter. I also recommend checking out the issue 16 and 17 for more background on the MP3 encoder demo used to illustrate these articles. To access the newsletter archive, follow this link.

    Cheers,
    Benoit.
  • BorlecBorlec Member Boris LecourtOrganization: ISISProject: Integration Bench
    OK, I understand, thanks for your answer.
    Bye !
Sign In or Register to comment.