Archived

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

Context Proxy Lost

I'm using Ice version 3.6. When passing a proxy around, that started with context information included, the context is lost after it's sent to another 'client'. Is this intended? It seems to me that a context should follow a proxy that is sent over the network. This allows a 'server' to send contextual information along with the proxy providing information about this particular connection. Can someone provide insight on why it doesn't work this way, or perhaps it does and I'm doing something wrong.

Thanks!

Tagged:

Comments

  • mes
    mes California

    Hi Ryan,

    You're not doing anything wrong, you're seeing the intended behavior: the context is a purely local construct and is not part of the marshaled state of a proxy.

    If you can provide more information about your use case, we could offer some suggestions.

    Regards,
    Mark

  • Mark,

    Thanks for the quick response. So I have a couple of different object instances (on the server). What's the best way to refer to multiple instances of an object through an interface? I'd prefer not to be passing some sort of identifier with each method, but need to call a method on the server for each instance and know which object instance was called.

    Ryan

  • mes
    mes California

    In an application, every Ice object is supposed to have a unique identity. Your server has to supply this identity when adding its servants to an object adapter, and your client needs to know the identity in order to construct a proxy. Ice also passes the identity from client to server with each invocation, and the servant can access the identity on which its operation was invoked via the Current argument. This makes it easy for one servant to "incarnate" multiple Ice objects of the same type; it can examine the identity provided in the Current object to determine the target instance.