Home Help Center

how to use multi objectadapters?

fanfan Member
hi, there,
Suppose that we have to use two objectAdapters without icepack involved:

Ice::ObjectAdapterPtr adapter = communicator->createObjectAdapter("Hello");
Ice::ObjectPtr object = new HelloI;
adapter->add(object, Ice::stringToIdentity("hello"));


Ice::ObjectAdapterPtr adapter2 = communicator->createObjectAdapter("HelloHello");
object = new HelloI;
adapter2->add(object, Ice::stringToIdentity("hello"));



And in client, I want to visist the hello servant of HelloHello , I don't know how to modify the config file.

Here is my draft but doesn't work:




# client
[email protected]:tcp -p 10000

#Server
Hello.Endpoints=tcp -p 10000
HelloHello.Endpoints=tcp -p 10000



thanks in advance
fan

Comments

  • matthewmatthew NL, CanadaMember Matthew NewhookOrganization: ZeroC, Inc.Project: Internet Communications Engine ✭✭✭
    You have told the two object adapters to use the same endpoint. This cannot work. If you choose a different port, then it can work. Also, do you really mean to use the same object id on the second object adapter?

    Anyway, why do you want to do this? In a typical application this is not necessary.

    Regards, Matthew
  • fanfan Member
    thank your quick reply.

    I do this just to clarify some concepts about ice ;) .

    I have changed the port to 10001 but still not work.

    .\Reference.cpp:1103: Ice::NoEndpointException:
    no suitable endpoint available for proxy `hello -t @ HelloHello:tcp'
    Also, do you really mean to use the same object id on the second object adapter?
    I just wanted to test the fact that ASM belongs to each objectAdapter but not communicator :) . Or, Any advice?
  • marcmarc FloridaAdministrators, ZeroC Staff Marc LaukienOrganization: ZeroC, Inc.Project: The Internet Communications Engine ZeroC Staff
    Object identities must be unique, even across object adapters. So do not use the identity "hello" twice. Also, there is no proxy form "[email protected]:endpoints...". If you do not use a locator, then use "identity:endpoints...". If you use a locator, then use "[email protected]".
  • matthewmatthew NL, CanadaMember Matthew NewhookOrganization: ZeroC, Inc.Project: Internet Communications Engine ✭✭✭
    You should do:

    # client
    Hello.Proxy=hello:tcp -p 10000
    Hello.Proxy2=hello2:tcp -p 10001

    #Server
    Hello.Endpoints=tcp -p 10000
    HelloHello.Endpoints=tcp -p 10001

    Regards, Matthew
  • fanfan Member
    OK.Thank you two.

    1) If the document D1.Proxies can be a little clearer, we readers may feel happier. :p

    2) That's to say, the ASM is not the private stuff of ObjectAdapter since the object identities should be unique
    even across adapters?
  • marcmarc FloridaAdministrators, ZeroC Staff Marc LaukienOrganization: ZeroC, Inc.Project: The Internet Communications Engine ZeroC Staff
    The ASM is private to object adapters, but this is simply an implementation technicality. Ice object identities still have to be unique, even if the Ice core does not detect non-unique identities being used with different ASMs.

    I think the Ice manual is already very clear about this. From page 11:

    "Each Ice object has a unique object identity. An object’s identity is an identifying value that distinguishes the object from all other objects. The Ice object model assumes that object identities are globally unique, that is, no two objects within an Ice communication domain can have the same object identity."
Sign In or Register to comment.