diff options
author | Benoit Foucher <benoit@zeroc.com> | 2005-11-11 14:00:02 +0000 |
---|---|---|
committer | Benoit Foucher <benoit@zeroc.com> | 2005-11-11 14:00:02 +0000 |
commit | 4ef64a98b907499b2297684e9923bbe3ba991906 (patch) | |
tree | 54b8e5231f197333a677dfcb0de7c2264de52bc4 /java/src/Ice/ObjectAdapterI.java | |
parent | Moved IcePy.so to the python directory. This removes the need to add the (diff) | |
download | ice-4ef64a98b907499b2297684e9923bbe3ba991906.tar.bz2 ice-4ef64a98b907499b2297684e9923bbe3ba991906.tar.xz ice-4ef64a98b907499b2297684e9923bbe3ba991906.zip |
Fixed a bug where the locator would be contact in on the OA activation even
if it's ID was empty.
Diffstat (limited to 'java/src/Ice/ObjectAdapterI.java')
-rw-r--r-- | java/src/Ice/ObjectAdapterI.java | 99 |
1 files changed, 47 insertions, 52 deletions
diff --git a/java/src/Ice/ObjectAdapterI.java b/java/src/Ice/ObjectAdapterI.java index 65c7db8e437..096a9def6b3 100644 --- a/java/src/Ice/ObjectAdapterI.java +++ b/java/src/Ice/ObjectAdapterI.java @@ -60,47 +60,29 @@ public final class ObjectAdapterI extends LocalObjectImpl implements ObjectAdapt } } - - - // - // We must get and call on the locator registry outside the thread - // synchronization to avoid deadlocks. (we can't make remote calls - // within the OA synchronization because the remote call will - // indirectly call isLocal() on this OA with the OA factory - // locked). - // - LocatorRegistryPrx locatorRegistry = null; - if(locatorInfo != null) + if(registerProcess || _id.length() > 0) { - locatorRegistry = _locatorInfo.getLocatorRegistry(); - } + // + // We must get and call on the locator registry outside the thread + // synchronization to avoid deadlocks. (we can't make remote calls + // within the OA synchronization because the remote call will + // indirectly call isLocal() on this OA with the OA factory + // locked). + // - if(registerProcess) - { - if(locatorRegistry == null) - { - communicator.getLogger().warning("object adapter `" + _name + "' cannot register the process " + - "without a locator registry"); - registerProcess = false; - } - else if(serverId.length() == 0) + LocatorRegistryPrx locatorRegistry = null; + if(locatorInfo != null) { - communicator.getLogger().warning("object adapter `" + _name + "' cannot register the process " + - "without a value for Ice.ServerId"); - registerProcess = false; + // + // TODO: This might throw if we can't connect to the + // locator. Shall we raise a special exception for the + // activate operation instead of a non obvious network + // exception? + // + locatorRegistry = _locatorInfo.getLocatorRegistry(); } - } - - if(locatorRegistry != null) - { - // - // TODO: This might throw if we can't connect to the - // locator. Shall we raise a special exception for the - // activate operation instead of a non obvious network - // exception? - // - if(_id.length() > 0) + if(locatorRegistry != null && _id.length() > 0) { try { @@ -144,24 +126,37 @@ public final class ObjectAdapterI extends LocalObjectImpl implements ObjectAdapt if(registerProcess) { - try - { - Process servant = new ProcessI(communicator); - Ice.ObjectPrx proxy = createDirectProxy(addWithUUID(servant).ice_getIdentity()); - locatorRegistry.setServerProcessProxy(serverId, ProcessPrxHelper.uncheckedCast(proxy)); - } - catch(ObjectAdapterDeactivatedException ex) + if(locatorRegistry == null) { - // IGNORE: The object adapter is already inactive. + communicator.getLogger().warning("object adapter `" + _name + "' cannot register the process " + + "without a locator registry"); } - catch(ServerNotFoundException ex) - { - NotRegisteredException ex1 = new NotRegisteredException(); - ex1.id = serverId; - ex1.kindOfObject = "server"; - throw ex1; - } - } + else if(serverId.length() == 0) + { + communicator.getLogger().warning("object adapter `" + _name + "' cannot register the process " + + "without a value for Ice.ServerId"); + } + else + { + try + { + Process servant = new ProcessI(communicator); + Ice.ObjectPrx proxy = createDirectProxy(addWithUUID(servant).ice_getIdentity()); + locatorRegistry.setServerProcessProxy(serverId, ProcessPrxHelper.uncheckedCast(proxy)); + } + catch(ObjectAdapterDeactivatedException ex) + { + // IGNORE: The object adapter is already inactive. + } + catch(ServerNotFoundException ex) + { + NotRegisteredException ex1 = new NotRegisteredException(); + ex1.id = serverId; + ex1.kindOfObject = "server"; + throw ex1; + } + } + } } if(printAdapterReady) |