summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--csharp/src/IceLocatorDiscovery/PluginI.cs38
-rw-r--r--java/src/IceLocatorDiscovery/src/main/java/IceLocatorDiscovery/PluginI.java53
2 files changed, 55 insertions, 36 deletions
diff --git a/csharp/src/IceLocatorDiscovery/PluginI.cs b/csharp/src/IceLocatorDiscovery/PluginI.cs
index 9f3a9a99a1c..b1e465880b2 100644
--- a/csharp/src/IceLocatorDiscovery/PluginI.cs
+++ b/csharp/src/IceLocatorDiscovery/PluginI.cs
@@ -43,22 +43,30 @@ namespace IceLocatorDiscovery
public void
invoke(Ice.LocatorPrx l)
{
- _locatorPrx = l;
- try
+ if(_locatorPrx == null || !_locatorPrx.Equals(l))
{
- l.begin_ice_invoke(_operation, _mode, _inParams, _context).whenCompleted(
- (bool ok, byte[] outParams) =>
- {
- _amdCB.ice_response(ok, outParams);
- },
- (Ice.Exception ex) =>
- {
- exception(ex);
- });
+ _locatorPrx = l;
+ try
+ {
+ l.begin_ice_invoke(_operation, _mode, _inParams, _context).whenCompleted(
+ (bool ok, byte[] outParams) =>
+ {
+ _amdCB.ice_response(ok, outParams);
+ },
+ (Ice.Exception ex) =>
+ {
+ exception(ex);
+ });
+ }
+ catch(Ice.LocalException ex)
+ {
+ exception(ex);
+ }
}
- catch(Ice.LocalException ex)
+ else
{
- exception(ex);
+ Debug.Assert(_exception != null);
+ throw _exception;
}
}
@@ -89,8 +97,9 @@ namespace IceLocatorDiscovery
{
_amdCB.ice_exception(new Ice.ObjectNotExistException());
}
- catch(Ice.Exception)
+ catch(Ice.Exception exc)
{
+ _exception = exc;
_locator.invoke(_locatorPrx, this); // Retry with new locator proxy
}
}
@@ -103,6 +112,7 @@ namespace IceLocatorDiscovery
private readonly Ice.AMD_Object_ice_invoke _amdCB;
private Ice.LocatorPrx _locatorPrx;
+ private Ice.Exception _exception;
}
internal class VoidLocatorI : Ice.LocatorDisp_
diff --git a/java/src/IceLocatorDiscovery/src/main/java/IceLocatorDiscovery/PluginI.java b/java/src/IceLocatorDiscovery/src/main/java/IceLocatorDiscovery/PluginI.java
index b2fb41d7ced..dd0e3bd4c78 100644
--- a/java/src/IceLocatorDiscovery/src/main/java/IceLocatorDiscovery/PluginI.java
+++ b/java/src/IceLocatorDiscovery/src/main/java/IceLocatorDiscovery/PluginI.java
@@ -35,30 +35,38 @@ class PluginI implements Ice.Plugin
void
invoke(Ice.LocatorPrx l)
{
- _locatorPrx = l;
- try
+ if(_locatorPrx == null || !_locatorPrx.equals(l))
{
- l.begin_ice_invoke(_operation, _mode, _inParams, _context,
- new Ice.Callback_Object_ice_invoke()
- {
- @Override
- public void
- response(boolean ok, byte[] outParams)
- {
- _amdCB.ice_response(ok, outParams);
- }
-
- @Override
- public void
- exception(Ice.LocalException ex)
+ _locatorPrx = l;
+ try
+ {
+ l.begin_ice_invoke(_operation, _mode, _inParams, _context,
+ new Ice.Callback_Object_ice_invoke()
{
- Request.this.exception(ex);
- }
- });
+ @Override
+ public void
+ response(boolean ok, byte[] outParams)
+ {
+ _amdCB.ice_response(ok, outParams);
+ }
+
+ @Override
+ public void
+ exception(Ice.LocalException ex)
+ {
+ Request.this.exception(ex);
+ }
+ });
+ }
+ catch(Ice.LocalException ex)
+ {
+ exception(ex);
+ }
}
- catch(Ice.LocalException ex)
+ else
{
- exception(ex);
+ assert(_exception != null); // Don't retry if the proxy didn't change
+ _amdCB.ice_exception(_exception);
}
}
@@ -91,6 +99,7 @@ class PluginI implements Ice.Plugin
}
catch(Ice.LocalException exc)
{
+ _exception = exc;
_locator.invoke(_locatorPrx, Request.this); // Retry with new locator proxy
}
}
@@ -102,7 +111,8 @@ class PluginI implements Ice.Plugin
private final byte[] _inParams;
private final Ice.AMD_Object_ice_invoke _amdCB;
- private Ice.LocatorPrx _locatorPrx;
+ private Ice.LocatorPrx _locatorPrx = null;
+ private Ice.LocalException _exception = null;
};
static private class VoidLocatorI extends Ice._LocatorDisp
@@ -246,7 +256,6 @@ class PluginI implements Ice.Plugin
_pendingRequests.clear();
}
-
public synchronized void
invoke(Ice.LocatorPrx locator, Request request)
{