summaryrefslogtreecommitdiff
path: root/java/src
diff options
context:
space:
mode:
authorBenoit Foucher <benoit@zeroc.com>2005-03-31 15:33:52 +0000
committerBenoit Foucher <benoit@zeroc.com>2005-03-31 15:33:52 +0000
commit838347d01ccf547ed7829c7bc9810e9ef47f4c2c (patch)
treee8ceac7a34a721a9f4179fd8ea3617e9ea4446e0 /java/src
parentmerge from R2_1_branch to get windows installers automation changes (diff)
downloadice-838347d01ccf547ed7829c7bc9810e9ef47f4c2c.tar.bz2
ice-838347d01ccf547ed7829c7bc9810e9ef47f4c2c.tar.xz
ice-838347d01ccf547ed7829c7bc9810e9ef47f4c2c.zip
ObjectNotExistException are now always retried.
Diffstat (limited to 'java/src')
-rw-r--r--java/src/Ice/ObjectPrxHelperBase.java27
-rw-r--r--java/src/IceInternal/LocatorInfo.java19
-rw-r--r--java/src/IceInternal/Outgoing.java6
-rw-r--r--java/src/IceInternal/OutgoingAsync.java32
-rw-r--r--java/src/IceInternal/ProxyFactory.java25
5 files changed, 47 insertions, 62 deletions
diff --git a/java/src/Ice/ObjectPrxHelperBase.java b/java/src/Ice/ObjectPrxHelperBase.java
index c7e831add11..2c30be1202b 100644
--- a/java/src/Ice/ObjectPrxHelperBase.java
+++ b/java/src/Ice/ObjectPrxHelperBase.java
@@ -588,18 +588,6 @@ public class ObjectPrxHelperBase implements ObjectPrx
_delegate = null;
}
- try
- {
- IceInternal.IndirectReference ir = (IceInternal.IndirectReference)_reference;
- if(ir != null && ir.getLocatorInfo() != null)
- {
- ir.getLocatorInfo().clearObjectCache(ir);
- }
- }
- catch(ClassCastException e)
- {
- }
-
if(ice_isOneway() || ice_isBatchOneway())
{
//
@@ -618,7 +606,7 @@ public class ObjectPrxHelperBase implements ObjectPrx
IceInternal.ProxyFactory proxyFactory = _reference.getInstance().proxyFactory();
if(proxyFactory != null)
{
- return proxyFactory.checkRetryAfterException(ex, cnt);
+ return proxyFactory.checkRetryAfterException(ex, _reference, cnt);
}
else
{
@@ -634,19 +622,6 @@ public class ObjectPrxHelperBase implements ObjectPrx
__rethrowException(LocalException ex)
{
_delegate = null;
-
- try
- {
- IceInternal.IndirectReference ir = (IceInternal.IndirectReference)_reference;
- if(ir != null && ir.getLocatorInfo() != null)
- {
- ir.getLocatorInfo().clearObjectCache(ir);
- }
- }
- catch(ClassCastException e)
- {
- }
-
throw ex;
}
diff --git a/java/src/IceInternal/LocatorInfo.java b/java/src/IceInternal/LocatorInfo.java
index 5e77ee05907..35b096b15b9 100644
--- a/java/src/IceInternal/LocatorInfo.java
+++ b/java/src/IceInternal/LocatorInfo.java
@@ -111,19 +111,22 @@ public final class LocatorInfo
}
else
{
+ boolean objectCached = true;
object = _table.getProxy(identity);
if(object == null)
{
- cached.value = false;
+ objectCached = false;
object = _locator.findObjectById(identity);
}
-
+
+ boolean endpointsCached = true;
if(object != null)
{
Reference r = ((Ice.ObjectPrxHelperBase)object).__reference();
if(r instanceof DirectReference)
{
+ endpointsCached = false;
DirectReference odr = (DirectReference)r;
endpoints = odr.getEndpoints();
}
@@ -132,15 +135,19 @@ public final class LocatorInfo
IndirectReference oir = (IndirectReference)r;
if(oir.getAdapterId().length() > 0)
{
- endpoints = getEndpoints(oir, cached);
+ Ice.BooleanHolder c = new Ice.BooleanHolder();
+ endpoints = getEndpoints(oir, c);
+ endpointsCached = c.value;
}
}
}
- if(!cached.value && endpoints != null && endpoints.length > 0)
+ if(!objectCached && endpoints != null && endpoints.length > 0)
{
_table.addProxy(identity, object);
}
+
+ cached.value = objectCached || endpointsCached;
}
}
catch(Ice.AdapterNotFoundException ex)
@@ -204,7 +211,7 @@ public final class LocatorInfo
Ice.ObjectPrx object = _table.removeProxy(ref.getIdentity());
if(object != null)
{
- if(object instanceof IndirectReference)
+ if(((Ice.ObjectPrxHelperBase)object).__reference() instanceof IndirectReference)
{
IndirectReference oir = (IndirectReference)((Ice.ObjectPrxHelperBase)object).__reference();
if(oir.getAdapterId().length() > 0)
@@ -241,7 +248,7 @@ public final class LocatorInfo
Ice.ObjectPrx object = _table.removeProxy(ref.getIdentity());
if(object != null)
{
- if(object instanceof IndirectReference)
+ if(((Ice.ObjectPrxHelperBase)object).__reference() instanceof IndirectReference)
{
IndirectReference oir = (IndirectReference)((Ice.ObjectPrxHelperBase)object).__reference();
if(oir.getAdapterId().length() > 0)
diff --git a/java/src/IceInternal/Outgoing.java b/java/src/IceInternal/Outgoing.java
index c3e5d3ac146..6d31ef9a69f 100644
--- a/java/src/IceInternal/Outgoing.java
+++ b/java/src/IceInternal/Outgoing.java
@@ -168,7 +168,11 @@ public final class Outgoing
// guarantees that all outstanding requests can safely
// be repeated.
//
- if(_exception instanceof Ice.CloseConnectionException)
+ // An ObjectNotExistException can always be retried as
+ // well without violating "at-most-once".
+ //
+ if(_exception instanceof Ice.CloseConnectionException ||
+ _exception instanceof Ice.ObjectNotExistException)
{
throw _exception;
}
diff --git a/java/src/IceInternal/OutgoingAsync.java b/java/src/IceInternal/OutgoingAsync.java
index dd14bb10a77..3c04ba877d1 100644
--- a/java/src/IceInternal/OutgoingAsync.java
+++ b/java/src/IceInternal/OutgoingAsync.java
@@ -175,15 +175,6 @@ public abstract class OutgoingAsync
{
if(_reference != null)
{
- try
- {
- IndirectReference ir = (IndirectReference)_reference;
- ir.getLocatorInfo().clearObjectCache(ir);
- }
- catch(ClassCastException ex)
- {
- }
-
boolean doRetry = false;
//
@@ -195,15 +186,18 @@ public abstract class OutgoingAsync
// be repeated. Otherwise, we can also retry if the
// operation mode is Nonmutating or Idempotent.
//
+ // An ObjectNotExistException can always be retried as
+ // well without violating "at-most-once".
+ //
if(_mode == Ice.OperationMode.Nonmutating || _mode == Ice.OperationMode.Idempotent ||
- exc instanceof Ice.CloseConnectionException)
+ exc instanceof Ice.CloseConnectionException || exc instanceof Ice.ObjectNotExistException)
{
try
{
ProxyFactory proxyFactory = _reference.getInstance().proxyFactory();
if(proxyFactory != null)
{
- _cnt = proxyFactory.checkRetryAfterException(exc, _cnt);
+ _cnt = proxyFactory.checkRetryAfterException(exc, _reference, _cnt);
}
else
{
@@ -396,23 +390,11 @@ public abstract class OutgoingAsync
return;
}
catch(Ice.LocalException ex)
- {
- try
- {
- IndirectReference ir = (IndirectReference)_reference;
- if(ir != null && ir.getLocatorInfo() != null)
- {
- ir.getLocatorInfo().clearObjectCache(ir);
- }
- }
- catch(ClassCastException e)
- {
- }
-
+ {
ProxyFactory proxyFactory = _reference.getInstance().proxyFactory();
if(proxyFactory != null)
{
- _cnt = proxyFactory.checkRetryAfterException(ex, _cnt);
+ _cnt = proxyFactory.checkRetryAfterException(ex, _reference, _cnt);
}
else
{
diff --git a/java/src/IceInternal/ProxyFactory.java b/java/src/IceInternal/ProxyFactory.java
index 6b669857b62..158a12d1247 100644
--- a/java/src/IceInternal/ProxyFactory.java
+++ b/java/src/IceInternal/ProxyFactory.java
@@ -77,13 +77,30 @@ public final class ProxyFactory
}
public int
- checkRetryAfterException(Ice.LocalException ex, int cnt)
+ checkRetryAfterException(Ice.LocalException ex, Reference ref, int cnt)
{
//
- // We don't retry *NotExistException, which are all derived from
- // RequestFailedException.
+ // We retry ObjectNotExistException if the reference is
+ // indirect. Otherwise, we don't retry other *NotExistException,
+ // which are all derived from RequestFailedException.
//
- if(ex instanceof Ice.RequestFailedException)
+ if(ex instanceof Ice.ObjectNotExistException)
+ {
+ try
+ {
+ IceInternal.IndirectReference ir = (IceInternal.IndirectReference)ref;
+ if(ir.getLocatorInfo() == null)
+ {
+ throw ex;
+ }
+ ir.getLocatorInfo().clearObjectCache(ir);
+ }
+ catch(ClassCastException e)
+ {
+ throw ex;
+ }
+ }
+ else if(ex instanceof Ice.RequestFailedException)
{
throw ex;
}