summaryrefslogtreecommitdiff
path: root/java/src
diff options
context:
space:
mode:
authorDwayne Boone <dwayne@zeroc.com>2006-03-14 12:47:12 +0000
committerDwayne Boone <dwayne@zeroc.com>2006-03-14 12:47:12 +0000
commit4ec329c60555de5562c72df0e2fc583d591bf84d (patch)
tree86eb4af9aac33fc6277bed19d8936c4ffdbcd2d5 /java/src
parentFixed http://www.zeroc.com/vbulletin/showthread.php?p=9533#post9533 (diff)
downloadice-4ec329c60555de5562c72df0e2fc583d591bf84d.tar.bz2
ice-4ec329c60555de5562c72df0e2fc583d591bf84d.tar.xz
ice-4ec329c60555de5562c72df0e2fc583d591bf84d.zip
Ported fix for bug 574.
Diffstat (limited to 'java/src')
-rw-r--r--java/src/Ice/ConnectionI.java28
-rw-r--r--java/src/Ice/ObjectPrxHelperBase.java54
-rw-r--r--java/src/Ice/_ObjectDel.java10
-rw-r--r--java/src/Ice/_ObjectDelD.java10
-rw-r--r--java/src/Ice/_ObjectDelM.java20
-rw-r--r--java/src/IceInternal/FixedReference.java1
-rw-r--r--java/src/IceInternal/LocalExceptionWrapper.java49
-rw-r--r--java/src/IceInternal/NonRepeatable.java27
-rw-r--r--java/src/IceInternal/Outgoing.java16
-rw-r--r--java/src/IceInternal/OutgoingAsync.java30
-rw-r--r--java/src/IceInternal/ProxyFactory.java115
-rw-r--r--java/src/IceInternal/RoutableReference.java24
12 files changed, 232 insertions, 152 deletions
diff --git a/java/src/Ice/ConnectionI.java b/java/src/Ice/ConnectionI.java
index c65d91082df..1446568273f 100644
--- a/java/src/Ice/ConnectionI.java
+++ b/java/src/Ice/ConnectionI.java
@@ -319,6 +319,16 @@ public final class ConnectionI extends IceInternal.EventHandler implements Conne
}
public synchronized void
+ throwException()
+ {
+ if(_exception != null)
+ {
+ assert(_state >= StateClosing);
+ throw _exception;
+ }
+ }
+
+ public synchronized void
waitUntilHolding()
{
while(_state < StateHolding || _dispatchCount > 0)
@@ -495,6 +505,7 @@ public final class ConnectionI extends IceInternal.EventHandler implements Conne
public void
sendRequest(IceInternal.BasicStream os, IceInternal.Outgoing out, boolean compress)
+ throws IceInternal.LocalExceptionWrapper
{
int requestId = 0;
IceInternal.BasicStream stream = null;
@@ -505,7 +516,12 @@ public final class ConnectionI extends IceInternal.EventHandler implements Conne
if(_exception != null)
{
- throw _exception;
+ //
+ // If the connection is closed before we even have a chance
+ // to send our request, we always try to send the request
+ // again.
+ //
+ throw new IceInternal.LocalExceptionWrapper(_exception, true);
}
assert(_state > StateNotValidated);
@@ -605,6 +621,7 @@ public final class ConnectionI extends IceInternal.EventHandler implements Conne
public void
sendAsyncRequest(IceInternal.BasicStream os, IceInternal.OutgoingAsync out, boolean compress)
+ throws IceInternal.LocalExceptionWrapper
{
int requestId = 0;
IceInternal.BasicStream stream = null;
@@ -615,7 +632,12 @@ public final class ConnectionI extends IceInternal.EventHandler implements Conne
if(_exception != null)
{
- throw _exception;
+ //
+ // If the connection is closed before we even have a chance
+ // to send our request, we always try to send the request
+ // again.
+ //
+ throw new IceInternal.LocalExceptionWrapper(_exception, true);
}
assert(_state > StateNotValidated);
@@ -2383,7 +2405,7 @@ public final class ConnectionI extends IceInternal.EventHandler implements Conne
public IceInternal.Outgoing
getOutgoing(IceInternal.Reference reference, String operation, OperationMode mode, java.util.Map context,
boolean compress)
- throws IceInternal.NonRepeatable
+ throws IceInternal.LocalExceptionWrapper
{
IceInternal.Outgoing out = null;
diff --git a/java/src/Ice/ObjectPrxHelperBase.java b/java/src/Ice/ObjectPrxHelperBase.java
index 125e227438e..98fd2b40044 100644
--- a/java/src/Ice/ObjectPrxHelperBase.java
+++ b/java/src/Ice/ObjectPrxHelperBase.java
@@ -56,9 +56,9 @@ public class ObjectPrxHelperBase implements ObjectPrx
_ObjectDel __del = __getDelegate();
return __del.ice_isA(__id, __context);
}
- catch(IceInternal.NonRepeatable __ex)
+ catch(IceInternal.LocalExceptionWrapper __ex)
{
- __cnt = __handleException(__ex.get(), __cnt);
+ __cnt = __handleExceptionWrapperRelaxed(__ex, __cnt);
}
catch(LocalException __ex)
{
@@ -86,9 +86,9 @@ public class ObjectPrxHelperBase implements ObjectPrx
__del.ice_ping(__context);
return;
}
- catch(IceInternal.NonRepeatable __ex)
+ catch(IceInternal.LocalExceptionWrapper __ex)
{
- __cnt = __handleException(__ex.get(), __cnt);
+ __cnt = __handleExceptionWrapperRelaxed(__ex, __cnt);
}
catch(LocalException __ex)
{
@@ -115,9 +115,9 @@ public class ObjectPrxHelperBase implements ObjectPrx
_ObjectDel __del = __getDelegate();
return __del.ice_ids(__context);
}
- catch(IceInternal.NonRepeatable __ex)
+ catch(IceInternal.LocalExceptionWrapper __ex)
{
- __cnt = __handleException(__ex.get(), __cnt);
+ __cnt = __handleExceptionWrapperRelaxed(__ex, __cnt);
}
catch(LocalException __ex)
{
@@ -144,9 +144,9 @@ public class ObjectPrxHelperBase implements ObjectPrx
_ObjectDel __del = __getDelegate();
return __del.ice_id(__context);
}
- catch(IceInternal.NonRepeatable __ex)
+ catch(IceInternal.LocalExceptionWrapper __ex)
{
- __cnt = __handleException(__ex.get(), __cnt);
+ __cnt = __handleExceptionWrapperRelaxed(__ex, __cnt);
}
catch(LocalException __ex)
{
@@ -173,15 +173,15 @@ public class ObjectPrxHelperBase implements ObjectPrx
_ObjectDel __del = __getDelegate();
return __del.ice_invoke(operation, mode, inParams, outParams, context);
}
- catch(IceInternal.NonRepeatable __ex)
+ catch(IceInternal.LocalExceptionWrapper __ex)
{
if(mode == OperationMode.Nonmutating || mode == OperationMode.Idempotent)
{
- __cnt = __handleException(__ex.get(), __cnt);
+ __cnt = __handleExceptionWrapperRelaxed(__ex, __cnt);
}
else
{
- __rethrowException(__ex.get());
+ __handleExceptionWrapper(__ex);
}
}
catch(LocalException __ex)
@@ -723,11 +723,35 @@ public class ObjectPrxHelperBase implements ObjectPrx
}
}
- public final synchronized void
- __rethrowException(LocalException ex)
+ public final void
+ __handleExceptionWrapper(IceInternal.LocalExceptionWrapper ex)
{
- _delegate = null;
- throw ex;
+ synchronized(this)
+ {
+ _delegate = null;
+ }
+
+ if(!ex.retry())
+ {
+ throw ex.get();
+ }
+ }
+
+ public final int
+ __handleExceptionWrapperRelaxed(IceInternal.LocalExceptionWrapper ex, int cnt)
+ {
+ if(!ex.retry())
+ {
+ return __handleException(ex.get(), cnt);
+ }
+ else
+ {
+ synchronized(this)
+ {
+ _delegate = null;
+ }
+ return cnt;
+ }
}
public final void
diff --git a/java/src/Ice/_ObjectDel.java b/java/src/Ice/_ObjectDel.java
index 5adb5143e23..f4c208f7fb1 100644
--- a/java/src/Ice/_ObjectDel.java
+++ b/java/src/Ice/_ObjectDel.java
@@ -12,20 +12,20 @@ package Ice;
public interface _ObjectDel
{
boolean ice_isA(String id, java.util.Map context)
- throws IceInternal.NonRepeatable;
+ throws IceInternal.LocalExceptionWrapper;
void ice_ping(java.util.Map context)
- throws IceInternal.NonRepeatable;
+ throws IceInternal.LocalExceptionWrapper;
String[] ice_ids(java.util.Map context)
- throws IceInternal.NonRepeatable;
+ throws IceInternal.LocalExceptionWrapper;
String ice_id(java.util.Map context)
- throws IceInternal.NonRepeatable;
+ throws IceInternal.LocalExceptionWrapper;
boolean ice_invoke(String operation, Ice.OperationMode mode, byte[] inParams, ByteSeqHolder outParams,
java.util.Map context)
- throws IceInternal.NonRepeatable;
+ throws IceInternal.LocalExceptionWrapper;
Connection ice_connection();
}
diff --git a/java/src/Ice/_ObjectDelD.java b/java/src/Ice/_ObjectDelD.java
index 20fd114beb1..40058a4b9f8 100644
--- a/java/src/Ice/_ObjectDelD.java
+++ b/java/src/Ice/_ObjectDelD.java
@@ -13,7 +13,7 @@ public class _ObjectDelD implements _ObjectDel
{
public boolean
ice_isA(String __id, java.util.Map __context)
- throws IceInternal.NonRepeatable
+ throws IceInternal.LocalExceptionWrapper
{
Current __current = new Current();
__initCurrent(__current, "ice_isA", OperationMode.Nonmutating, __context);
@@ -33,7 +33,7 @@ public class _ObjectDelD implements _ObjectDel
public void
ice_ping(java.util.Map __context)
- throws IceInternal.NonRepeatable
+ throws IceInternal.LocalExceptionWrapper
{
Current __current = new Current();
__initCurrent(__current, "ice_ping", OperationMode.Nonmutating, __context);
@@ -54,7 +54,7 @@ public class _ObjectDelD implements _ObjectDel
public String[]
ice_ids(java.util.Map __context)
- throws IceInternal.NonRepeatable
+ throws IceInternal.LocalExceptionWrapper
{
Current __current = new Current();
__initCurrent(__current, "ice_ids", OperationMode.Nonmutating, __context);
@@ -74,7 +74,7 @@ public class _ObjectDelD implements _ObjectDel
public String
ice_id(java.util.Map __context)
- throws IceInternal.NonRepeatable
+ throws IceInternal.LocalExceptionWrapper
{
Current __current = new Current();
__initCurrent(__current, "ice_id", OperationMode.Nonmutating, __context);
@@ -95,7 +95,7 @@ public class _ObjectDelD implements _ObjectDel
public boolean
ice_invoke(String operation, Ice.OperationMode mode, byte[] inParams, ByteSeqHolder outParams,
java.util.Map context)
- throws IceInternal.NonRepeatable
+ throws IceInternal.LocalExceptionWrapper
{
throw new CollocationOptimizationException();
}
diff --git a/java/src/Ice/_ObjectDelM.java b/java/src/Ice/_ObjectDelM.java
index c6301ce909d..6a5501e170c 100644
--- a/java/src/Ice/_ObjectDelM.java
+++ b/java/src/Ice/_ObjectDelM.java
@@ -13,7 +13,7 @@ public class _ObjectDelM implements _ObjectDel
{
public boolean
ice_isA(String __id, java.util.Map __context)
- throws IceInternal.NonRepeatable
+ throws IceInternal.LocalExceptionWrapper
{
IceInternal.Outgoing __og = __connection.getOutgoing(__reference, "ice_isA", OperationMode.Nonmutating,
__context, __compress);
@@ -47,7 +47,7 @@ public class _ObjectDelM implements _ObjectDel
}
catch(LocalException __ex)
{
- throw new IceInternal.NonRepeatable(__ex);
+ throw new IceInternal.LocalExceptionWrapper(__ex, false);
}
}
finally
@@ -58,7 +58,7 @@ public class _ObjectDelM implements _ObjectDel
public void
ice_ping(java.util.Map __context)
- throws IceInternal.NonRepeatable
+ throws IceInternal.LocalExceptionWrapper
{
IceInternal.Outgoing __og = __connection.getOutgoing(__reference, "ice_ping", OperationMode.Nonmutating,
__context, __compress);
@@ -82,7 +82,7 @@ public class _ObjectDelM implements _ObjectDel
}
catch(LocalException __ex)
{
- throw new IceInternal.NonRepeatable(__ex);
+ throw new IceInternal.LocalExceptionWrapper(__ex, false);
}
}
finally
@@ -93,7 +93,7 @@ public class _ObjectDelM implements _ObjectDel
public String[]
ice_ids(java.util.Map __context)
- throws IceInternal.NonRepeatable
+ throws IceInternal.LocalExceptionWrapper
{
IceInternal.Outgoing __og = __connection.getOutgoing(__reference, "ice_ids", OperationMode.Nonmutating,
__context, __compress);
@@ -118,7 +118,7 @@ public class _ObjectDelM implements _ObjectDel
}
catch(LocalException __ex)
{
- throw new IceInternal.NonRepeatable(__ex);
+ throw new IceInternal.LocalExceptionWrapper(__ex, false);
}
}
finally
@@ -129,7 +129,7 @@ public class _ObjectDelM implements _ObjectDel
public String
ice_id(java.util.Map __context)
- throws IceInternal.NonRepeatable
+ throws IceInternal.LocalExceptionWrapper
{
IceInternal.Outgoing __og = __connection.getOutgoing(__reference, "ice_id", OperationMode.Nonmutating,
__context, __compress);
@@ -154,7 +154,7 @@ public class _ObjectDelM implements _ObjectDel
}
catch(LocalException __ex)
{
- throw new IceInternal.NonRepeatable(__ex);
+ throw new IceInternal.LocalExceptionWrapper(__ex, false);
}
}
finally
@@ -165,7 +165,7 @@ public class _ObjectDelM implements _ObjectDel
public boolean
ice_invoke(String operation, OperationMode mode, byte[] inParams, ByteSeqHolder outParams, java.util.Map __context)
- throws IceInternal.NonRepeatable
+ throws IceInternal.LocalExceptionWrapper
{
IceInternal.Outgoing __og = __connection.getOutgoing(__reference, operation, mode, __context, __compress);
try
@@ -196,7 +196,7 @@ public class _ObjectDelM implements _ObjectDel
}
catch(LocalException __ex)
{
- throw new IceInternal.NonRepeatable(__ex);
+ throw new IceInternal.LocalExceptionWrapper(__ex, false);
}
}
return ok;
diff --git a/java/src/IceInternal/FixedReference.java b/java/src/IceInternal/FixedReference.java
index 445fd725ca3..b3d77f7a5b2 100644
--- a/java/src/IceInternal/FixedReference.java
+++ b/java/src/IceInternal/FixedReference.java
@@ -174,6 +174,7 @@ public class FixedReference extends Reference
Ice.ConnectionI connection = filteredConns[0];
assert(connection != null);
+ connection.throwException(); // Throw in case our connection is already destroyed.
compress.value = connection.endpoint().compress();
return connection;
diff --git a/java/src/IceInternal/LocalExceptionWrapper.java b/java/src/IceInternal/LocalExceptionWrapper.java
new file mode 100644
index 00000000000..2d60f8d219a
--- /dev/null
+++ b/java/src/IceInternal/LocalExceptionWrapper.java
@@ -0,0 +1,49 @@
+// **********************************************************************
+//
+// Copyright (c) 2003-2006 ZeroC, Inc. All rights reserved.
+//
+// This copy of Ice is licensed to you under the terms described in the
+// ICE_LICENSE file included in this distribution.
+//
+// **********************************************************************
+
+package IceInternal;
+
+public class LocalExceptionWrapper extends Exception
+{
+ public
+ LocalExceptionWrapper(Ice.LocalException ex, boolean retry)
+ {
+ _ex = ex;
+ _retry = retry;
+ }
+
+ public
+ LocalExceptionWrapper(IceInternal.LocalExceptionWrapper ex)
+ {
+ _ex = ex.get();
+ _retry = ex._retry;
+ }
+
+ public Ice.LocalException
+ get()
+ {
+ return _ex;
+ }
+
+ //
+ // If true, always repeat the request. Don't take retry settings
+ // or "at-most-once" guarantees into account.
+ //
+ // If false, only repeat the request if the retry settings allow
+ // to do so, and if "at-most-once" does not need to be guaranteed.
+ //
+ public boolean
+ retry()
+ {
+ return _retry;
+ }
+
+ private Ice.LocalException _ex;
+ private boolean _retry;
+}
diff --git a/java/src/IceInternal/NonRepeatable.java b/java/src/IceInternal/NonRepeatable.java
deleted file mode 100644
index c82a8077ebb..00000000000
--- a/java/src/IceInternal/NonRepeatable.java
+++ /dev/null
@@ -1,27 +0,0 @@
-// **********************************************************************
-//
-// Copyright (c) 2003-2005 ZeroC, Inc. All rights reserved.
-//
-// This copy of Ice is licensed to you under the terms described in the
-// ICE_LICENSE file included in this distribution.
-//
-// **********************************************************************
-
-package IceInternal;
-
-public class NonRepeatable extends Exception
-{
- public
- NonRepeatable(Ice.LocalException ex)
- {
- _ex = ex;
- }
-
- public Ice.LocalException
- get()
- {
- return _ex;
- }
-
- private Ice.LocalException _ex;
-}
diff --git a/java/src/IceInternal/Outgoing.java b/java/src/IceInternal/Outgoing.java
index 6640129de61..c32f6055829 100644
--- a/java/src/IceInternal/Outgoing.java
+++ b/java/src/IceInternal/Outgoing.java
@@ -14,7 +14,7 @@ public final class Outgoing
public
Outgoing(Ice.ConnectionI connection, Reference ref, String operation, Ice.OperationMode mode,
java.util.Map context, boolean compress)
- throws NonRepeatable
+ throws LocalExceptionWrapper
{
_connection = connection;
_reference = ref;
@@ -31,7 +31,7 @@ public final class Outgoing
//
public void
reset(Reference ref, String operation, Ice.OperationMode mode, java.util.Map context, boolean compress)
- throws NonRepeatable
+ throws LocalExceptionWrapper
{
_reference = ref;
_state = StateUnsent;
@@ -51,7 +51,7 @@ public final class Outgoing
// Returns true if ok, false if user exception.
public boolean
invoke()
- throws NonRepeatable
+ throws LocalExceptionWrapper
{
assert(_state == StateUnsent);
@@ -165,11 +165,11 @@ public final class Outgoing
}
//
- // Throw the exception wrapped in a NonRepeatable, to
+ // Throw the exception wrapped in a LocalExceptionWrapper, to
// indicate that the request cannot be resent without
// potentially violating the "at-most-once" principle.
//
- throw new NonRepeatable(_exception);
+ throw new LocalExceptionWrapper(_exception, false);
}
if(_state == StateUserException)
@@ -216,7 +216,7 @@ public final class Outgoing
public void
abort(Ice.LocalException ex)
- throws NonRepeatable
+ throws LocalExceptionWrapper
{
assert(_state == StateUnsent);
@@ -236,7 +236,7 @@ public final class Outgoing
// be aborted, but all other requests in the batch as
// well.
//
- throw new NonRepeatable(ex);
+ throw new LocalExceptionWrapper(ex, false);
}
throw ex;
@@ -413,7 +413,7 @@ public final class Outgoing
private void
writeHeader(String operation, Ice.OperationMode mode, java.util.Map context)
- throws NonRepeatable
+ throws LocalExceptionWrapper
{
switch(_reference.getMode())
{
diff --git a/java/src/IceInternal/OutgoingAsync.java b/java/src/IceInternal/OutgoingAsync.java
index 15a1c158e16..f83b5cbc9ea 100644
--- a/java/src/IceInternal/OutgoingAsync.java
+++ b/java/src/IceInternal/OutgoingAsync.java
@@ -173,7 +173,7 @@ public abstract class OutgoingAsync
{
synchronized(_monitor)
{
- if(_reference != null)
+ if(__os != null) // Don't retry if cleanup() was already called.
{
boolean doRetry = false;
@@ -264,7 +264,7 @@ public abstract class OutgoingAsync
//
// We must first wait for other requests to finish.
//
- while(_reference != null)
+ while(__os != null)
{
try
{
@@ -279,10 +279,19 @@ public abstract class OutgoingAsync
// Can't call async via a oneway proxy.
//
((Ice.ObjectPrxHelperBase)prx).__checkTwowayOnly(operation);
+
+ Reference ref = ((Ice.ObjectPrxHelperBase)prx).__reference();
+
+ //
+ // Optimization: Don't update the connection if it is not
+ // necessary.
+ //
+ if(_connection == null || _reference == null || !_reference.equals(ref))
+ {
+ _connection = ref.getConnection(_compress);
+ }
- _reference = ((Ice.ObjectPrxHelperBase)prx).__reference();
- assert(_connection == null);
- _connection = _reference.getConnection(_compress);
+ _reference = ref;
_cnt = 0;
_mode = mode;
assert(__is == null);
@@ -394,6 +403,13 @@ public abstract class OutgoingAsync
//
return;
}
+ catch(LocalExceptionWrapper ex)
+ {
+ if(!ex.retry())
+ {
+ throw ex.get();
+ }
+ }
catch(Ice.LocalException ex)
{
ProxyFactory proxyFactory = _reference.getInstance().proxyFactory();
@@ -422,7 +438,7 @@ public abstract class OutgoingAsync
private final void
warning(java.lang.Exception ex)
{
- if(_reference != null) // Don't print anything if cleanup() was already called.
+ if(__os != null) // Don't print anything if cleanup() was already called.
{
if(_reference.getInstance().properties().getPropertyAsIntWithDefault("Ice.Warn.AMICallback", 1) > 0)
{
@@ -441,8 +457,6 @@ public abstract class OutgoingAsync
private final void
cleanup()
{
- _reference = null;
- _connection = null;
__is = null;
__os = null;
diff --git a/java/src/IceInternal/ProxyFactory.java b/java/src/IceInternal/ProxyFactory.java
index c3a8132395a..1a2e1731090 100644
--- a/java/src/IceInternal/ProxyFactory.java
+++ b/java/src/IceInternal/ProxyFactory.java
@@ -105,86 +105,77 @@ public final class ProxyFactory
throw ex;
}
- //
- // There is no point in retrying an operation that resulted in a
- // MarshalException. This must have been raised locally (because if
- // it happened in a server it would result in an UnknownLocalException
- // instead), which means there was a problem in this process that will
- // not change if we try again.
- //
- // The most likely cause for a MarshalException is exceeding the
- // maximum message size, which is represented by the the subclass
- // MemoryLimitException. For example, a client can attempt to send a
- // message that exceeds the maximum memory size, or accumulate enough
- // batch requests without flushing that the maximum size is reached.
- //
- // This latter case is especially problematic, because if we were to
- // retry a batch request after a MarshalException, we would in fact
- // silently discard the accumulated requests and allow new batch
- // requests to accumulate. If the subsequent batched requests do not
- // exceed the maximum message size, it appears to the client that all
- // of the batched requests were accepted, when in reality only the
- // last few are actually sent.
- //
- if(ex instanceof Ice.MarshalException)
- {
- throw ex;
- }
+ //
+ // There is no point in retrying an operation that resulted in a
+ // MarshalException. This must have been raised locally (because
+ // if it happened in a server it would result in an
+ // UnknownLocalException instead), which means there was a problem
+ // in this process that will not change if we try again.
+ //
+ // The most likely cause for a MarshalException is exceeding the
+ // maximum message size, which is represented by the the subclass
+ // MemoryLimitException. For example, a client can attempt to send
+ // a message that exceeds the maximum memory size, or accumulate
+ // enough batch requests without flushing that the maximum size is
+ // reached.
+ //
+ // This latter case is especially problematic, because if we were
+ // to retry a batch request after a MarshalException, we would in
+ // fact silently discard the accumulated requests and allow new
+ // batch requests to accumulate. If the subsequent batched
+ // requests do not exceed the maximum message size, it appears to
+ // the client that all of the batched requests were accepted, when
+ // in reality only the last few are actually sent.
+ //
+ if(ex instanceof Ice.MarshalException)
+ {
+ throw ex;
+ }
- ++cnt;
+ ++cnt;
+ assert(cnt > 0);
TraceLevels traceLevels = _instance.traceLevels();
Ice.Logger logger = _instance.logger();
- //
- // Instance components may be null if Communicator has been destroyed.
- //
- if(traceLevels != null && logger != null)
+ if(cnt > _retryIntervals.length)
{
- if(cnt > _retryIntervals.length)
- {
- if(traceLevels.retry >= 1)
- {
- String s = "cannot retry operation call because retry limit has been exceeded\n" + ex.toString();
- logger.trace(traceLevels.retryCat, s);
- }
- throw ex;
- }
-
if(traceLevels.retry >= 1)
{
- String s = "re-trying operation call";
- if(cnt > 0 && _retryIntervals[cnt - 1] > 0)
- {
- s += " in " + _retryIntervals[cnt - 1] + "ms";
- }
- s += " because of exception\n" + ex;
+ String s = "cannot retry operation call because retry limit has been exceeded\n" + ex.toString();
logger.trace(traceLevels.retryCat, s);
}
+ throw ex;
+ }
+
+ int interval = _retryIntervals[cnt - 1];
- if(cnt > 0)
+ if(traceLevels.retry >= 1)
+ {
+ String s = "re-trying operation call";
+ if(interval > 0)
{
- //
- // Sleep before retrying.
- //
- try
- {
- Thread.currentThread().sleep(_retryIntervals[cnt - 1]);
- }
- catch(InterruptedException ex1)
- {
- }
+ s += " in " + interval + "ms";
}
-
- return cnt;
+ s += " because of exception\n" + ex;
+ logger.trace(traceLevels.retryCat, s);
}
- else
+
+ if(cnt > 0)
{
//
- // Impossible to retry after Communicator has been destroyed.
+ // Sleep before retrying.
//
- throw ex;
+ try
+ {
+ Thread.currentThread().sleep(interval);
+ }
+ catch(InterruptedException ex1)
+ {
+ }
}
+
+ return cnt;
}
//
diff --git a/java/src/IceInternal/RoutableReference.java b/java/src/IceInternal/RoutableReference.java
index e17e6b873d7..b2085dc0859 100644
--- a/java/src/IceInternal/RoutableReference.java
+++ b/java/src/IceInternal/RoutableReference.java
@@ -237,15 +237,21 @@ public abstract class RoutableReference extends Reference
//
switch(getEndpointSelection().value())
{
- case Ice.EndpointSelectionType._Random:
- java.util.Collections.shuffle(endpoints);
- break;
- case Ice.EndpointSelectionType._Ordered:
- // Nothing to do.
- break;
- default:
- assert(false);
- break;
+ case Ice.EndpointSelectionType._Random:
+ {
+ java.util.Collections.shuffle(endpoints);
+ break;
+ }
+ case Ice.EndpointSelectionType._Ordered:
+ {
+ // Nothing to do.
+ break;
+ }
+ default:
+ {
+ assert(false);
+ break;
+ }
}
//