Archived

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

Concept question about ICE Object

hi, there,
Because I have to write some documents about Ice, I now have a concept question about ICE Object:

In Ice-Document, an object is defined as :

• A single Ice object can be instantiated in a single server or, redundantly, in multiple servers. If an object has multiple simultaneous instantiations, it is still a single Ice object.
• 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.

I can not fully understand these two points together. That is, If an object has multiple simultaneous instantiations, it is still a single Ice object , then , all these instantiations will have the same identity? It seems conter-intuitive.

Hope getting a clarification.

Thanks

OrNot

Comments

  • bernard
    bernard Jupiter, FL
    Everything you wrote above is correct. What do you find confusing?

    Keep in mind that an Ice object is an abstract concept, unlike servants that correspond to real programming-language objects.

    Cheers,
    Bernard
  • hi, Benard,
    I think my confusion may come from codes like this:


    Ice::ObjectPtr object1 = new PrinterI;
    Ice::ObjectPtr object2=new PrinterI;
    adapter->add(object1,
    Ice::stringToIdentity("SimplePrinter"));
    adapter->add(object2,
    Ice::stringToIdentity("SimplePrinter2"));


    PrinterI is an Object, and it's incarnations are two servants, but they have different identities. Accroding to : (1) If an object has multiple simultaneous instantiations, it is still a single Ice object. and (2) Each Ice object has a unique object identity, does it mean Object1 and Object2 should have a same
    identiy ,say, SimplePrinter?
    There must be some misundersandings in my mind but I can not figure it out.
  • PrinterI is a type (a class or interface), not an object. You create two servants of the type PrinterI. In your example, each servant implements a different Ice object. One Ice object has the identity "SimplePrinter", the other "SimplePrinter2".
  • Maybe I misunderstood these ICE concepts due to some c++ experiences and this words: If an object has multiple simultaneous instantiations, it is still a single Ice object.

    Class == Ice Object
    Object == Servant



    OK then , Thank you very much.
  • No, this is not correct, also not for C++. A class is a type, both in C++ and in Slice.

    Have a look at this FAQ which discusses proxies, Ice objects, and servants.