diff options
-rw-r--r-- | cs/demo/IceGrid/simple/application_with_replication.xml | 6 | ||||
-rwxr-xr-x | cs/src/Ice/ObjectAdapterI.cs | 56 | ||||
-rw-r--r-- | cs/src/Ice/PropertyNames.cs | 30 |
3 files changed, 59 insertions, 33 deletions
diff --git a/cs/demo/IceGrid/simple/application_with_replication.xml b/cs/demo/IceGrid/simple/application_with_replication.xml index a6f1e25db34..84a1fb4fa69 100644 --- a/cs/demo/IceGrid/simple/application_with_replication.xml +++ b/cs/demo/IceGrid/simple/application_with_replication.xml @@ -16,15 +16,15 @@ <server-template id="SimpleServer"> <parameter name="index"/> <server id="SimpleServer-${index}" exe="./server" pwd="." activation="on-demand"> - <adapter name="Hello" endpoints="tcp" register-process="true" id="ReplicatedHelloAdapter"/> + <adapter name="Hello" endpoints="tcp" register-process="true" replica-group="ReplicatedHelloAdapter"/> <property name="Identity" value="hello"/> </server> </server-template> - <replicated-adapter id="ReplicatedHelloAdapter"> + <replica-group id="ReplicatedHelloAdapter"> <load-balancing type="round-robin"/> <object identity="hello" type="::Demo::Hello"/> - </replicated-adapter> + </replica-group> <node name="localhost"> <server-instance template="SimpleServer" index="1"/> diff --git a/cs/src/Ice/ObjectAdapterI.cs b/cs/src/Ice/ObjectAdapterI.cs index 79ecb39ff32..97a6f86c83f 100755 --- a/cs/src/Ice/ObjectAdapterI.cs +++ b/cs/src/Ice/ObjectAdapterI.cs @@ -38,7 +38,6 @@ namespace Ice Ice.LocatorRegistryPrx locatorRegistry = null; bool registerProcess = false; string serverId = ""; - string replicaId = ""; Communicator communicator = null; bool printAdapterReady = false; @@ -55,7 +54,6 @@ namespace Ice registerProcess = instance_.properties().getPropertyAsInt(_name + ".RegisterProcess") > 0; serverId = instance_.properties().getProperty("Ice.ServerId"); - replicaId = instance_.properties().getPropertyWithDefault(_name + ".ReplicaId", serverId); printAdapterReady = instance_.properties().getPropertyAsInt("Ice.PrintAdapterReady") > 0; if(registerProcess && locatorRegistry == null) @@ -98,7 +96,7 @@ namespace Ice Identity ident = new Identity(); ident.category = ""; ident.name = "dummy"; - locatorRegistry.setAdapterDirectProxy(_id, replicaId, createDirectProxy(ident)); + locatorRegistry.setAdapterDirectProxy(_id, _replicaGroupId, createDirectProxy(ident)); } catch(Ice.ObjectAdapterDeactivatedException) { @@ -108,9 +106,16 @@ namespace Ice { NotRegisteredException ex1 = new NotRegisteredException(); ex1.kindOfObject = "object adapter"; - ex1.id = ex.replica ? _id + " (replica = " + replicaId + ")" : _id; + ex1.id = _id; throw ex1; } + catch(Ice.InvalidReplicaGroupIdException ex) + { + NotRegisteredException ex1 = new NotRegisteredException(); + ex1.kindOfObject = "replica group"; + ex1.id = _replicaGroupId; + throw ex1; + } catch(Ice.AdapterAlreadyActiveException) { ObjectAdapterIdInUseException ex1 = new ObjectAdapterIdInUseException(); @@ -456,6 +461,17 @@ namespace Ice } } + public ObjectPrx createIndirectProxy(Identity ident) + { + lock(this) + { + checkForDeactivation(); + checkIdentity(ident); + + return newIndirectProxy(ident, "", _id); + } + } + public ObjectPrx createReverseProxy(Identity ident) { lock(this) @@ -789,6 +805,7 @@ namespace Ice _printAdapterReadyDone = false; _name = name; _id = instance.properties().getProperty(name + ".AdapterId"); + _replicaGroupId = instance.properties().getProperty(name + ".ReplicaGroupId"); _incomingConnectionFactories = new ArrayList(); _routerEndpoints = new ArrayList(); _routerInfos = new ArrayList(); @@ -917,19 +934,13 @@ namespace Ice { return newDirectProxy(ident, facet); } + else if(_replicaGroupId.Length == 0) + { + return newIndirectProxy(ident, facet, _id); + } else { - // - // Create a reference with the adapter id and return a - // proxy for the reference. - // - IceInternal.Reference reference = - instance_.referenceFactory().create(ident, instance_.getDefaultContext(), facet, - IceInternal.Reference.Mode.ModeTwoway, - false, _id, null, _locatorInfo, - instance_.defaultsAndOverrides(). - defaultCollocationOptimization); - return instance_.proxyFactory().referenceToProxy(reference); + return newIndirectProxy(ident, facet, _replicaGroupId); } } @@ -969,6 +980,20 @@ namespace Ice return instance_.proxyFactory().referenceToProxy(reference); } + private ObjectPrx newIndirectProxy(Identity ident, string facet, string id) + { + // + // Create a reference with the adapter id and return a + // proxy for the reference. + // + IceInternal.Reference reference = + instance_.referenceFactory().create(ident, instance_.getDefaultContext(), facet, + IceInternal.Reference.Mode.ModeTwoway, + false, id, null, _locatorInfo, + instance_.defaultsAndOverrides().defaultCollocationOptimization); + return instance_.proxyFactory().referenceToProxy(reference); + } + private void checkForDeactivation() { if(_deactivated) @@ -1082,6 +1107,7 @@ namespace Ice private bool _printAdapterReadyDone; private readonly string _name; private readonly string _id; + private readonly string _replicaGroupId; private ArrayList _incomingConnectionFactories; private ArrayList _routerEndpoints; private ArrayList _routerInfos; diff --git a/cs/src/Ice/PropertyNames.cs b/cs/src/Ice/PropertyNames.cs index dca0e43c848..1db9ea19e2e 100644 --- a/cs/src/Ice/PropertyNames.cs +++ b/cs/src/Ice/PropertyNames.cs @@ -7,7 +7,7 @@ // // ********************************************************************** -// Generated by makeprops.py from file `../config/PropertyNames.def', Wed Oct 12 11:03:32 2005 +// Generated by makeprops.py from file `../config/PropertyNames.def', Wed Oct 12 16:57:50 2005 // IMPORTANT: Do not edit this file -- any edits made here will be lost! @@ -83,7 +83,7 @@ namespace IceInternal @"^IceBox\.PrintServicesReady$", @"^IceBox\.Service\.[^\s.]+$", @"^IceBox\.ServiceManager\.AdapterId$", - @"^IceBox\.ServiceManager\.ReplicaId$", + @"^IceBox\.ServiceManager\.ReplicaGroupId$", @"^IceBox\.ServiceManager\.Endpoints$", @"^IceBox\.ServiceManager\.Identity$", @"^IceBox\.ServiceManager\.PublishedEndpoints$", @@ -100,7 +100,7 @@ namespace IceInternal { @"^IceGrid\.InstanceName$", @"^IceGrid\.Node\.AdapterId$", - @"^IceGrid\.Node\.ReplicaId$", + @"^IceGrid\.Node\.ReplicaGroupId$", @"^IceGrid\.Node\.RegisterProcess$", @"^IceGrid\.Node\.CollocateRegistry$", @"^IceGrid\.Node\.Data$", @@ -122,7 +122,7 @@ namespace IceInternal @"^IceGrid\.Node\.Trace\.Patch$", @"^IceGrid\.Node\.WaitTime$", @"^IceGrid\.Registry\.Admin\.AdapterId$", - @"^IceGrid\.Registry\.Admin\.ReplicaId$", + @"^IceGrid\.Registry\.Admin\.ReplicaGroupId$", @"^IceGrid\.Registry\.Admin\.Endpoints$", @"^IceGrid\.Registry\.Admin\.PublishedEndpoints$", @"^IceGrid\.Registry\.Admin\.ThreadPool\.Size$", @@ -131,7 +131,7 @@ namespace IceInternal @"^IceGrid\.Registry\.Admin\.ThreadPool\.StackSize$", @"^IceGrid\.Registry\.AdminIdentity$", @"^IceGrid\.Registry\.Client\.AdapterId$", - @"^IceGrid\.Registry\.Client\.ReplicaId$", + @"^IceGrid\.Registry\.Client\.ReplicaGroupId$", @"^IceGrid\.Registry\.Client\.Endpoints$", @"^IceGrid\.Registry\.Client\.PublishedEndpoints$", @"^IceGrid\.Registry\.Client\.ThreadPool\.Size$", @@ -142,7 +142,7 @@ namespace IceInternal @"^IceGrid\.Registry\.DefaultTemplates$", @"^IceGrid\.Registry\.DynamicRegistration$", @"^IceGrid\.Registry\.Internal\.AdapterId$", - @"^IceGrid\.Registry\.Internal\.ReplicaId$", + @"^IceGrid\.Registry\.Internal\.ReplicaGroupId$", @"^IceGrid\.Registry\.Internal\.Endpoints$", @"^IceGrid\.Registry\.Internal\.PublishedEndpoints$", @"^IceGrid\.Registry\.Internal\.ThreadPool\.Size$", @@ -153,7 +153,7 @@ namespace IceInternal @"^IceGrid\.Registry\.NodeSessionTimeout$", @"^IceGrid\.Registry\.QueryIdentity$", @"^IceGrid\.Registry\.Server\.AdapterId$", - @"^IceGrid\.Registry\.Server\.ReplicaId$", + @"^IceGrid\.Registry\.Server\.ReplicaGroupId$", @"^IceGrid\.Registry\.Server\.Endpoints$", @"^IceGrid\.Registry\.Server\.PublishedEndpoints$", @"^IceGrid\.Registry\.Server\.ThreadPool\.Size$", @@ -187,9 +187,9 @@ namespace IceInternal public static string[] IcePatch2Props = { @"^IcePatch2\.AdapterId$", - @"^IcePatch2\.ReplicaId$", + @"^IcePatch2\.ReplicaGroupId$", @"^IcePatch2\.Admin\.AdapterId$", - @"^IcePatch2\.Admin\.ReplicaId$", + @"^IcePatch2\.Admin\.ReplicaGroupId$", @"^IcePatch2\.Admin\.Endpoints$", @"^IcePatch2\.Admin\.PublishedEndpoints$", @"^IcePatch2\.Admin\.ThreadPool\.Size$", @@ -254,7 +254,7 @@ namespace IceInternal @"^IceStorm\.Flush\.Timeout$", @"^IceStorm\.InstanceName$", @"^IceStorm\.Publish\.AdapterId$", - @"^IceStorm\.Publish\.ReplicaId$", + @"^IceStorm\.Publish\.ReplicaGroupId$", @"^IceStorm\.Publish\.Endpoints$", @"^IceStorm\.Publish\.PublishedEndpoints$", @"^IceStorm\.Publish\.RegisterProcess$", @@ -263,7 +263,7 @@ namespace IceInternal @"^IceStorm\.Publish\.ThreadPool\.SizeWarn$", @"^IceStorm\.Publish\.ThreadPool\.StackSize$", @"^IceStorm\.TopicManagerIdentity$", - @"^IceStorm\.TopicManager\.ReplicaId$", + @"^IceStorm\.TopicManager\.ReplicaGroupId$", @"^IceStorm\.TopicManager\.Endpoints$", @"^IceStorm\.TopicManager\.Proxy$", @"^IceStorm\.TopicManager\.PublishedEndpoints$", @@ -283,10 +283,10 @@ namespace IceInternal { @"^Glacier\.Router\.AcceptCert$", @"^Glacier\.Router\.AdapterId$", - @"^Glacier\.Router\.ReplicaId$", + @"^Glacier\.Router\.ReplicaGroupId$", @"^Glacier\.Router\.AllowCategories$", @"^Glacier\.Router\.Client\.AdapterId$", - @"^Glacier\.Router\.Client\.ReplicaId$", + @"^Glacier\.Router\.Client\.ReplicaGroupId$", @"^Glacier\.Router\.Client\.Endpoints$", @"^Glacier\.Router\.Client\.ForwardContext$", @"^Glacier\.Router\.Client\.PublishedEndpoints$", @@ -301,7 +301,7 @@ namespace IceInternal @"^Glacier\.Router\.PrintProxyOnFd$", @"^Glacier\.Router\.PublishedEndpoints$", @"^Glacier\.Router\.Server\.AdapterId$", - @"^Glacier\.Router\.Server\.ReplicaId$", + @"^Glacier\.Router\.Server\.ReplicaGroupId$", @"^Glacier\.Router\.Server\.Endpoints$", @"^Glacier\.Router\.Server\.ForwardContext$", @"^Glacier\.Router\.Server\.PublishedEndpoints$", @@ -322,7 +322,7 @@ namespace IceInternal @"^Glacier\.Router\.Trace\.Throttle$", @"^Glacier\.Router\.UserId$", @"^Glacier\.Starter\.AdapterId$", - @"^Glacier\.Starter\.ReplicaId$", + @"^Glacier\.Starter\.ReplicaGroupId$", @"^Glacier\.Starter\.AddUserToAllowCategories$", @"^Glacier\.Starter\.Certificate\.BitStrength$", @"^Glacier\.Starter\.Certificate\.CommonName$", |