If two servers implement differenct interfaces, but they have the same identity(for example: thePrinter@theAdapter), what will happen if they register to IceRegistry ? Can IceRegistry reject the second server's registration ? The following is my demo code:
--------------------Printer.ice---
module Demo
{
interface PrinterA
{
void printStringA(string s);
};
interface PrinterB
{
void printStringB(string s);
};
};
--------------------ServerA.cpp----
class PrinterAI : public PrinterA {
public:
virtual void printString(const string & s,
const Ice::Current &);
};
int
main(int argc, char* argv[])
{
int status = 0;
Ice::CommunicatorPtr ic;
try {
ic = Ice::initialize(argc, argv);
Ice::ObjectAdapterPtr adapter
= ic->createObjectAdapterWithEndpoints("theAdapter", "default -p 10000");
Ice::ObjectPtr object = new PrinterAI;
//objectId: thePrinter@theAdapter - implementation the PrinterA interface
adapter->add(object,
Ice::stringToIdentity("thePrinter"));
adapter->activate();
ic->waitForShutdown();
} catch (const Ice::Exception & e) {
//...
}
}
---------------------ServerB.cpp---
class PrinterBI : public PrinterB {
public:
virtual void printString(const string & s,
const Ice::Current &);
};
//...
int
main(int argc, char* argv[])
{
int status = 0;
Ice::CommunicatorPtr ic;
try {
ic = Ice::initialize(argc, argv);
Ice::ObjectAdapterPtr adapter
= ic->createObjectAdapterWithEndpoints("theAdapter", "default -p 10001");
Ice::ObjectPtr object = new PrinterBI;
//objectId: thePrinter@theAdapter - implementation the PrinterB interface
adapter->add(object,
Ice::stringToIdentity("thePrinter"));
adapter->activate();
ic->waitForShutdown();
} catch (const Ice::Exception & e) {
//...
}
}

Reply With Quote
. I'll describe how IcePack currently handle this, IceGrid won't be different in this respect.