summaryrefslogtreecommitdiff
path: root/cpp
diff options
context:
space:
mode:
Diffstat (limited to 'cpp')
-rw-r--r--cpp/CHANGES10
-rwxr-xr-xcpp/allTests.py1
-rw-r--r--cpp/include/Ice/Outgoing.h24
-rw-r--r--cpp/include/Ice/Proxy.h5
-rw-r--r--cpp/src/Ice/ConnectionI.cpp14
-rw-r--r--cpp/src/Ice/Outgoing.cpp31
-rw-r--r--cpp/src/Ice/OutgoingAsync.cpp8
-rw-r--r--cpp/src/Ice/Proxy.cpp56
-rw-r--r--cpp/src/Ice/ProxyFactory.cpp95
-rw-r--r--cpp/src/Ice/Reference.cpp111
-rw-r--r--cpp/src/slice2cpp/Gen.cpp10
-rw-r--r--cpp/test/Ice/Makefile3
-rw-r--r--cpp/test/Ice/retry/.depend7
-rw-r--r--cpp/test/Ice/retry/AllTests.cpp57
-rw-r--r--cpp/test/Ice/retry/Client.cpp69
-rw-r--r--cpp/test/Ice/retry/Makefile42
-rw-r--r--cpp/test/Ice/retry/Server.cpp58
-rw-r--r--cpp/test/Ice/retry/TestI.cpp26
-rw-r--r--cpp/test/Ice/retry/TestI.h21
-rw-r--r--cpp/test/Ice/retry/retryC.dsp157
-rw-r--r--cpp/test/Ice/retry/retryS.dsp161
21 files changed, 808 insertions, 158 deletions
diff --git a/cpp/CHANGES b/cpp/CHANGES
index 85bb57f652d..c93d8da7dc9 100644
--- a/cpp/CHANGES
+++ b/cpp/CHANGES
@@ -1,17 +1,23 @@
Changes since version 3.0.1
---------------------------
+- If several proxies share the same connection, and an operation call
+ on one of the proxies causes a failure and the shared connection to
+ be closed, then subsequent calls on the other proxies will try to
+ establish a new connection instead of throwing an exception, even if
+ retries are disabled.
+
- IcePatch2 now performs incremental reads of files during compression
and checksum calculation. Previously the entire file being processed
was read into memory.
-- If a proxy is not configured with the -h parameter, Ice will now
+- If a proxy is not configured with the -h parameter, Ice will now
attempt to connect using all local interfaces. The loopback
interface (127.0.0.1) will only be tried if it is the only local
interface present.
- Added the ability to specify alternate mappings for Slice sequences
- other than std::vector. Please see the Ice manual for more details.
+ other than std::vector. Please see the Ice manual for more details.
- Fixed a bug in slice2cpp that caused one-shot constructors for
classes to incorrectly initialize base classes for class hierarchies
diff --git a/cpp/allTests.py b/cpp/allTests.py
index d57d10dc358..c0a71b457da 100755
--- a/cpp/allTests.py
+++ b/cpp/allTests.py
@@ -73,6 +73,7 @@ tests = [ \
"Ice/stream", \
"Ice/hold", \
"Ice/custom", \
+ "Ice/retry", \
"IceSSL/configuration", \
"IceSSL/loadPEM", \
"IceSSL/certificateAndKeyParsing", \
diff --git a/cpp/include/Ice/Outgoing.h b/cpp/include/Ice/Outgoing.h
index 54ba12b0044..1e85d31a161 100644
--- a/cpp/include/Ice/Outgoing.h
+++ b/cpp/include/Ice/Outgoing.h
@@ -28,23 +28,33 @@ namespace IceInternal
{
//
-// An exception wrapper, which is used to indicate that an operation
-// that failed due to an exception is not repeatable if "at-most-once"
-// semantics must be guaranteed.
+// An exception wrapper, which is used for local exceptions that
+// require special retry considerations.
//
-class ICE_API NonRepeatable
+class ICE_API LocalExceptionWrapper
{
public:
- NonRepeatable(const NonRepeatable&);
- NonRepeatable(const Ice::LocalException&);
+ LocalExceptionWrapper(const Ice::LocalException&, bool);
+ LocalExceptionWrapper(const LocalExceptionWrapper&);
+
const Ice::LocalException* get() const;
+ //
+ // 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.
+ //
+ bool retry() const;
+
private:
- const NonRepeatable& operator=(const NonRepeatable&);
+ const LocalExceptionWrapper& operator=(const LocalExceptionWrapper&);
std::auto_ptr<Ice::LocalException> _ex;
+ bool _retry;
};
class ICE_API Outgoing : private IceUtil::noncopyable, public IceUtil::Monitor<IceUtil::Mutex >
diff --git a/cpp/include/Ice/Proxy.h b/cpp/include/Ice/Proxy.h
index ff73054f1e1..764660cde5d 100644
--- a/cpp/include/Ice/Proxy.h
+++ b/cpp/include/Ice/Proxy.h
@@ -50,6 +50,8 @@ ICE_API void decRef(::IceProxy::Ice::Router*);
ICE_API void incRef(::IceProxy::Ice::Locator*);
ICE_API void decRef(::IceProxy::Ice::Locator*);
+class LocalExceptionWrapper;
+
}
namespace Ice
@@ -155,7 +157,8 @@ public:
::IceInternal::ReferencePtr __reference() const;
void __copyFrom(const ::Ice::ObjectPrx&);
void __handleException(const ::Ice::LocalException&, int&);
- void __rethrowException(const ::Ice::LocalException&);
+ void __handleExceptionWrapper(const ::IceInternal::LocalExceptionWrapper&);
+ void __handleExceptionWrapperRelaxed(const ::IceInternal::LocalExceptionWrapper&, int&);
void __checkTwowayOnly(const char*) const;
void __checkTwowayOnly(const ::std::string&) const;
diff --git a/cpp/src/Ice/ConnectionI.cpp b/cpp/src/Ice/ConnectionI.cpp
index 593c5da9fb9..91c97d3ddc5 100644
--- a/cpp/src/Ice/ConnectionI.cpp
+++ b/cpp/src/Ice/ConnectionI.cpp
@@ -485,7 +485,12 @@ Ice::ConnectionI::sendRequest(BasicStream* os, Outgoing* out, bool compress)
if(_exception.get())
{
- _exception->ice_throw();
+ //
+ // If the exception is closed before we even have a chance
+ // to send our request, we always try to send the request
+ // again.
+ //
+ throw LocalExceptionWrapper(*_exception.get(), true);
}
assert(_state > StateNotValidated);
@@ -645,7 +650,12 @@ Ice::ConnectionI::sendAsyncRequest(BasicStream* os, const OutgoingAsyncPtr& out,
if(_exception.get())
{
- _exception->ice_throw();
+ //
+ // If the exception is closed before we even have a chance
+ // to send our request, we always try to send the request
+ // again.
+ //
+ throw LocalExceptionWrapper(*_exception.get(), true);
}
assert(_state > StateNotValidated);
diff --git a/cpp/src/Ice/Outgoing.cpp b/cpp/src/Ice/Outgoing.cpp
index 0a081181f0a..ebe39bd4f00 100644
--- a/cpp/src/Ice/Outgoing.cpp
+++ b/cpp/src/Ice/Outgoing.cpp
@@ -18,23 +18,31 @@ using namespace std;
using namespace Ice;
using namespace IceInternal;
-IceInternal::NonRepeatable::NonRepeatable(const NonRepeatable& ex)
+IceInternal::LocalExceptionWrapper::LocalExceptionWrapper(const LocalException& ex, bool r) :
+ _retry(r)
{
- _ex.reset(dynamic_cast<LocalException*>(ex.get()->ice_clone()));
+ _ex.reset(dynamic_cast<LocalException*>(ex.ice_clone()));
}
-IceInternal::NonRepeatable::NonRepeatable(const ::Ice::LocalException& ex)
+IceInternal::LocalExceptionWrapper::LocalExceptionWrapper(const LocalExceptionWrapper& ex) :
+ _retry(ex._retry)
{
- _ex.reset(dynamic_cast<LocalException*>(ex.ice_clone()));
+ _ex.reset(dynamic_cast<LocalException*>(ex.get()->ice_clone()));
}
-const ::Ice::LocalException*
-IceInternal::NonRepeatable::get() const
+const LocalException*
+IceInternal::LocalExceptionWrapper::get() const
{
assert(_ex.get());
return _ex.get();
}
+bool
+IceInternal::LocalExceptionWrapper::retry() const
+{
+ return _retry;
+}
+
IceInternal::Outgoing::Outgoing(ConnectionI* connection, Reference* ref, const string& operation,
OperationMode mode, const Context& context, bool compress) :
_connection(connection),
@@ -207,11 +215,12 @@ IceInternal::Outgoing::invoke()
}
//
- // Throw the exception wrapped in a NonRepeatable, to
- // indicate that the request cannot be resent without
- // potentially violating the "at-most-once" principle.
+ // Throw the exception wrapped in a
+ // LocalExceptionWrapper, to indicate that the request
+ // cannot be resent without potentially violating the
+ // "at-most-once" principle.
//
- throw NonRepeatable(*_exception.get());
+ throw LocalExceptionWrapper(*_exception.get(), false);
}
if(_state == StateUserException)
@@ -275,7 +284,7 @@ IceInternal::Outgoing::abort(const LocalException& ex)
// only the batch request that caused the problem will be
// aborted, but all other requests in the batch as well.
//
- throw NonRepeatable(ex);
+ throw LocalExceptionWrapper(ex, false);
}
ex.ice_throw();
diff --git a/cpp/src/Ice/OutgoingAsync.cpp b/cpp/src/Ice/OutgoingAsync.cpp
index c1dcb5f3871..6145e542267 100644
--- a/cpp/src/Ice/OutgoingAsync.cpp
+++ b/cpp/src/Ice/OutgoingAsync.cpp
@@ -18,6 +18,7 @@
#include <Ice/LocatorInfo.h>
#include <Ice/ProxyFactory.h>
#include <Ice/RouterInfo.h>
+#include <Ice/Outgoing.h> // For LocalExceptionWrapper.
using namespace std;
using namespace Ice;
@@ -373,6 +374,13 @@ IceInternal::OutgoingAsync::__send()
//
return;
}
+ catch(const LocalExceptionWrapper& ex)
+ {
+ if(!ex.retry())
+ {
+ ex.get()->ice_throw();
+ }
+ }
catch(const LocalException& ex)
{
ProxyFactoryPtr proxyFactory = _reference->getInstance()->proxyFactory();
diff --git a/cpp/src/Ice/Proxy.cpp b/cpp/src/Ice/Proxy.cpp
index b51fd80870a..f110b388dc7 100644
--- a/cpp/src/Ice/Proxy.cpp
+++ b/cpp/src/Ice/Proxy.cpp
@@ -163,9 +163,9 @@ IceProxy::Ice::Object::ice_isA(const string& __id, const Context& __context)
Handle< ::IceDelegate::Ice::Object> __del = __getDelegate();
return __del->ice_isA(__id, __context);
}
- catch(const NonRepeatable& __ex)
+ catch(const LocalExceptionWrapper& __ex)
{
- __handleException(*__ex.get(), __cnt);
+ __handleExceptionWrapperRelaxed(__ex, __cnt);
}
catch(const LocalException& __ex)
{
@@ -192,9 +192,9 @@ IceProxy::Ice::Object::ice_ping(const Context& __context)
__del->ice_ping(__context);
return;
}
- catch(const NonRepeatable& __ex)
+ catch(const LocalExceptionWrapper& __ex)
{
- __handleException(*__ex.get(), __cnt);
+ __handleExceptionWrapperRelaxed(__ex, __cnt);
}
catch(const LocalException& __ex)
{
@@ -221,9 +221,9 @@ IceProxy::Ice::Object::ice_ids(const Context& __context)
Handle< ::IceDelegate::Ice::Object> __del = __getDelegate();
return __del->ice_ids(__context);
}
- catch(const NonRepeatable& __ex)
+ catch(const LocalExceptionWrapper& __ex)
{
- __handleException(*__ex.get(), __cnt);
+ __handleExceptionWrapperRelaxed(__ex, __cnt);
}
catch(const LocalException& __ex)
{
@@ -250,9 +250,9 @@ IceProxy::Ice::Object::ice_id(const Context& __context)
Handle< ::IceDelegate::Ice::Object> __del = __getDelegate();
return __del->ice_id(__context);
}
- catch(const NonRepeatable& __ex)
+ catch(const LocalExceptionWrapper& __ex)
{
- __handleException(*__ex.get(), __cnt);
+ __handleExceptionWrapperRelaxed(__ex, __cnt);
}
catch(const LocalException& __ex)
{
@@ -285,16 +285,16 @@ IceProxy::Ice::Object::ice_invoke(const string& operation,
Handle< ::IceDelegate::Ice::Object> __del = __getDelegate();
return __del->ice_invoke(operation, mode, inParams, outParams, context);
}
- catch(const NonRepeatable& __ex)
+ catch(const LocalExceptionWrapper& __ex)
{
bool canRetry = mode == Nonmutating || mode == Idempotent;
if(canRetry)
{
- __handleException(*__ex.get(), __cnt);
+ __handleExceptionWrapperRelaxed(__ex, __cnt);
}
else
{
- __rethrowException(*__ex.get());
+ __handleExceptionWrapper(__ex);
}
}
catch(const LocalException& __ex)
@@ -818,17 +818,31 @@ IceProxy::Ice::Object::__handleException(const LocalException& ex, int& cnt)
}
void
-IceProxy::Ice::Object::__rethrowException(const LocalException& ex)
+IceProxy::Ice::Object::__handleExceptionWrapper(const LocalExceptionWrapper& ex)
{
- //
- // Only _delegate needs to be mutex protected here.
- //
{
IceUtil::Mutex::Lock sync(*this);
_delegate = 0;
}
- ex.ice_throw();
+ if(!ex.retry())
+ {
+ ex.get()->ice_throw();
+ }
+}
+
+void
+IceProxy::Ice::Object::__handleExceptionWrapperRelaxed(const LocalExceptionWrapper& ex, int& cnt)
+{
+ if(!ex.retry())
+ {
+ __handleException(*ex.get(), cnt);
+ }
+ else
+ {
+ IceUtil::Mutex::Lock sync(*this);
+ _delegate = 0;
+ }
}
//
@@ -993,7 +1007,7 @@ IceDelegateM::Ice::Object::ice_isA(const string& __id, const Context& __context)
}
catch(const ::Ice::LocalException& __ex)
{
- throw ::IceInternal::NonRepeatable(__ex);
+ throw ::IceInternal::LocalExceptionWrapper(__ex, false);
}
return __ret;
}
@@ -1021,7 +1035,7 @@ IceDelegateM::Ice::Object::ice_ping(const Context& __context)
}
catch(const ::Ice::LocalException& __ex)
{
- throw ::IceInternal::NonRepeatable(__ex);
+ throw ::IceInternal::LocalExceptionWrapper(__ex, false);
}
}
@@ -1050,7 +1064,7 @@ IceDelegateM::Ice::Object::ice_ids(const Context& __context)
}
catch(const ::Ice::LocalException& __ex)
{
- throw ::IceInternal::NonRepeatable(__ex);
+ throw ::IceInternal::LocalExceptionWrapper(__ex, false);
}
return __ret;
}
@@ -1080,7 +1094,7 @@ IceDelegateM::Ice::Object::ice_id(const Context& __context)
}
catch(const ::Ice::LocalException& __ex)
{
- throw ::IceInternal::NonRepeatable(__ex);
+ throw ::IceInternal::LocalExceptionWrapper(__ex, false);
}
return __ret;
}
@@ -1113,7 +1127,7 @@ IceDelegateM::Ice::Object::ice_invoke(const string& operation,
}
catch(const ::Ice::LocalException& __ex)
{
- throw ::IceInternal::NonRepeatable(__ex);
+ throw ::IceInternal::LocalExceptionWrapper(__ex, false);
}
}
return ok;
diff --git a/cpp/src/Ice/ProxyFactory.cpp b/cpp/src/Ice/ProxyFactory.cpp
index 0666f4b2777..b9352ae41c9 100644
--- a/cpp/src/Ice/ProxyFactory.cpp
+++ b/cpp/src/Ice/ProxyFactory.cpp
@@ -111,24 +111,25 @@ IceInternal::ProxyFactory::checkRetryAfterException(const LocalException& ex, co
//
// 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.
+ // 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.
+ // 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.
+ // 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(dynamic_cast<const MarshalException*>(&ex))
{
@@ -136,52 +137,40 @@ IceInternal::ProxyFactory::checkRetryAfterException(const LocalException& ex, co
}
++cnt;
+ assert(cnt > 0);
TraceLevelsPtr traceLevels = _instance->traceLevels();
LoggerPtr logger = _instance->logger();
- //
- // Instance components may be null if the communicator has been
- // destroyed.
- //
- if(traceLevels && logger)
+ if(cnt > static_cast<int>(_retryIntervals.size()))
{
- if(cnt > static_cast<int>(_retryIntervals.size()))
- {
- if(traceLevels->retry >= 1)
- {
- Trace out(logger, traceLevels->retryCat);
- out << "cannot retry operation call because retry limit has been exceeded\n" << ex;
- }
- ex.ice_throw();
- }
-
- if(traceLevels->retry >= 1)
- {
- Trace out(logger, traceLevels->retryCat);
- out << "re-trying operation call";
- if(cnt > 0 && _retryIntervals[cnt - 1] > 0)
- {
- out << " in " << _retryIntervals[cnt - 1] << "ms";
- }
- out << " because of exception\n" << ex;
- }
-
- if(cnt > 0)
- {
- //
- // Sleep before retrying.
- //
- IceUtil::ThreadControl::sleep(IceUtil::Time::milliSeconds(_retryIntervals[cnt - 1]));
- }
+ if(traceLevels->retry >= 1)
+ {
+ Trace out(logger, traceLevels->retryCat);
+ out << "cannot retry operation call because retry limit has been exceeded\n" << ex;
+ }
+ ex.ice_throw();
}
- else
+
+ int interval = _retryIntervals[cnt - 1];
+
+ if(traceLevels->retry >= 1)
{
- //
- // Impossible to retry after the communicator has been
- // destroyed.
- //
- ex.ice_throw();
+ Trace out(logger, traceLevels->retryCat);
+ out << "re-trying operation call";
+ if(interval > 0)
+ {
+ out << " in " << interval << "ms";
+ }
+ out << " because of exception\n" << ex;
+ }
+
+ if(interval > 0)
+ {
+ //
+ // Sleep before retrying.
+ //
+ IceUtil::ThreadControl::sleep(IceUtil::Time::milliSeconds(interval));
}
}
diff --git a/cpp/src/Ice/Reference.cpp b/cpp/src/Ice/Reference.cpp
index 0a84aced76c..1d0d1d410af 100644
--- a/cpp/src/Ice/Reference.cpp
+++ b/cpp/src/Ice/Reference.cpp
@@ -408,29 +408,29 @@ public:
};
IceInternal::Reference::Reference(const InstancePtr& inst, const CommunicatorPtr& com, const Identity& ident,
- const Context& ctx, const string& fs, Mode md)
- : _instance(inst),
- _communicator(com),
- _mode(md),
- _identity(ident),
- _context(ctx),
- _facet(fs),
- _cacheConnection(true),
- _endpointSelection(Random),
- _hashInitialized(false)
+ const Context& ctx, const string& fs, Mode md) :
+ _hashInitialized(false),
+ _instance(inst),
+ _communicator(com),
+ _mode(md),
+ _identity(ident),
+ _context(ctx),
+ _facet(fs),
+ _cacheConnection(true),
+ _endpointSelection(Random)
{
}
-IceInternal::Reference::Reference(const Reference& r)
- : _instance(r._instance),
- _communicator(r._communicator),
- _mode(r._mode),
- _identity(r._identity),
- _context(r._context),
- _facet(r._facet),
- _cacheConnection(r._cacheConnection),
- _endpointSelection(r._endpointSelection),
- _hashInitialized(false)
+IceInternal::Reference::Reference(const Reference& r) :
+ _hashInitialized(false),
+ _instance(r._instance),
+ _communicator(r._communicator),
+ _mode(r._mode),
+ _identity(r._identity),
+ _context(r._context),
+ _facet(r._facet),
+ _cacheConnection(r._cacheConnection),
+ _endpointSelection(r._endpointSelection)
{
}
@@ -439,9 +439,9 @@ void IceInternal::decRef(IceInternal::FixedReference* p) { p->__decRef(); }
IceInternal::FixedReference::FixedReference(const InstancePtr& inst, const CommunicatorPtr& com, const Identity& ident,
const Context& ctx, const string& fs, Mode md,
- const vector<ConnectionIPtr>& fixedConns)
- : Reference(inst, com, ident, ctx, fs, md),
- _fixedConnections(fixedConns)
+ const vector<ConnectionIPtr>& fixedConns) :
+ Reference(inst, com, ident, ctx, fs, md),
+ _fixedConnections(fixedConns)
{
}
@@ -626,9 +626,9 @@ IceInternal::FixedReference::clone() const
return new FixedReference(*this);
}
-IceInternal::FixedReference::FixedReference(const FixedReference& r)
- : Reference(r),
- _fixedConnections(r._fixedConnections)
+IceInternal::FixedReference::FixedReference(const FixedReference& r) :
+ Reference(r),
+ _fixedConnections(r._fixedConnections)
{
}
@@ -834,19 +834,19 @@ IceInternal::RoutableReference::operator<(const Reference& r) const
IceInternal::RoutableReference::RoutableReference(const InstancePtr& inst, const CommunicatorPtr& com,
const Identity& ident, const Context& ctx, const string& fs, Mode md,
- bool sec, const RouterInfoPtr& rtrInfo, bool collocationOpt)
- : Reference(inst, com, ident, ctx, fs, md),
- _secure(sec),
- _routerInfo(rtrInfo),
- _collocationOptimization(collocationOpt)
+ bool sec, const RouterInfoPtr& rtrInfo, bool collocationOpt) :
+ Reference(inst, com, ident, ctx, fs, md),
+ _secure(sec),
+ _routerInfo(rtrInfo),
+ _collocationOptimization(collocationOpt)
{
}
-IceInternal::RoutableReference::RoutableReference(const RoutableReference& r)
- : Reference(r),
- _secure(r._secure),
- _routerInfo(r._routerInfo),
- _collocationOptimization(r._collocationOptimization)
+IceInternal::RoutableReference::RoutableReference(const RoutableReference& r) :
+ Reference(r),
+ _secure(r._secure),
+ _routerInfo(r._routerInfo),
+ _collocationOptimization(r._collocationOptimization)
{
}
@@ -992,9 +992,9 @@ void IceInternal::decRef(IceInternal::DirectReference* p) { p->__decRef(); }
IceInternal::DirectReference::DirectReference(const InstancePtr& inst, const CommunicatorPtr& com,
const Identity& ident, const Context& ctx, const string& fs, Mode md,
bool sec, const vector<EndpointIPtr>& endpts,
- const RouterInfoPtr& rtrInfo, bool collocationOpt)
- : RoutableReference(inst, com, ident, ctx, fs, md, sec, rtrInfo, collocationOpt),
- _endpoints(endpts)
+ const RouterInfoPtr& rtrInfo, bool collocationOpt) :
+ RoutableReference(inst, com, ident, ctx, fs, md, sec, rtrInfo, collocationOpt),
+ _endpoints(endpts)
{
}
@@ -1223,9 +1223,9 @@ IceInternal::DirectReference::clone() const
return new DirectReference(*this);
}
-IceInternal::DirectReference::DirectReference(const DirectReference& r)
- : RoutableReference(r),
- _endpoints(r._endpoints)
+IceInternal::DirectReference::DirectReference(const DirectReference& r) :
+ RoutableReference(r),
+ _endpoints(r._endpoints)
{
}
@@ -1236,11 +1236,11 @@ IceInternal::IndirectReference::IndirectReference(const InstancePtr& inst, const
const Identity& ident, const Context& ctx, const string& fs, Mode md,
bool sec, const string& adptid, const RouterInfoPtr& rtrInfo,
const LocatorInfoPtr& locInfo, bool collocationOpt,
- int locatorCacheTimeout)
- : RoutableReference(inst, com, ident, ctx, fs, md, sec, rtrInfo, collocationOpt),
- _adapterId(adptid),
- _locatorInfo(locInfo),
- _locatorCacheTimeout(locatorCacheTimeout)
+ int locatorCacheTimeout) :
+ RoutableReference(inst, com, ident, ctx, fs, md, sec, rtrInfo, collocationOpt),
+ _adapterId(adptid),
+ _locatorInfo(locInfo),
+ _locatorCacheTimeout(locatorCacheTimeout)
{
}
@@ -1485,7 +1485,9 @@ IceInternal::IndirectReference::hash() const
return _hashValue;
}
RoutableReference::hash(); // Initializes _hashValue.
- for(string::const_iterator p = _adapterId.begin(); p != _adapterId.end(); ++p) // Add hash of adapter ID to base hash.
+
+ // Add hash of adapter ID to base hash.
+ for(string::const_iterator p = _adapterId.begin(); p != _adapterId.end(); ++p)
{
_hashValue = 5 * _hashValue + *p;
}
@@ -1570,12 +1572,11 @@ IceInternal::IndirectReference::clone() const
return new IndirectReference(*this);
}
-IceInternal::IndirectReference::IndirectReference(const IndirectReference& r)
- : RoutableReference(r),
- _adapterId(r._adapterId),
- _connectionId(r._connectionId),
- _locatorInfo(r._locatorInfo),
- _locatorCacheTimeout(r._locatorCacheTimeout)
+IceInternal::IndirectReference::IndirectReference(const IndirectReference& r) :
+ RoutableReference(r),
+ _adapterId(r._adapterId),
+ _connectionId(r._connectionId),
+ _locatorInfo(r._locatorInfo),
+ _locatorCacheTimeout(r._locatorCacheTimeout)
{
}
-
diff --git a/cpp/src/slice2cpp/Gen.cpp b/cpp/src/slice2cpp/Gen.cpp
index 96e87b88255..ddd70a20380 100644
--- a/cpp/src/slice2cpp/Gen.cpp
+++ b/cpp/src/slice2cpp/Gen.cpp
@@ -1767,15 +1767,15 @@ Slice::Gen::ProxyVisitor::visitOperation(const OperationPtr& p)
C << nl << "return;";
}
C << eb;
- C << nl << "catch(const ::IceInternal::NonRepeatable& __ex)";
+ C << nl << "catch(const ::IceInternal::LocalExceptionWrapper& __ex)";
C << sb;
if(p->mode() == Operation::Idempotent || p->mode() == Operation::Nonmutating)
{
- C << nl << "__handleException(*__ex.get(), __cnt);";
+ C << nl << "__handleExceptionWrapperRelaxed(__ex, __cnt);";
}
else
{
- C << nl << "__rethrowException(*__ex.get());";
+ C << nl << "__handleExceptionWrapper(__ex);";
}
C << eb;
C << nl << "catch(const ::Ice::LocalException& __ex)";
@@ -2165,7 +2165,7 @@ Slice::Gen::DelegateMVisitor::visitOperation(const OperationPtr& p)
C << eb;
C << nl << "catch(const ::Ice::LocalException& __ex)";
C << sb;
- C << nl << "throw ::IceInternal::NonRepeatable(__ex);";
+ C << nl << "throw ::IceInternal::LocalExceptionWrapper(__ex, false);";
C << eb;
C << eb;
}
@@ -2360,7 +2360,7 @@ Slice::Gen::DelegateDVisitor::visitOperation(const OperationPtr& p)
C << eb;
C << nl << "catch(const ::Ice::LocalException& __ex)";
C << sb;
- C << nl << "throw ::IceInternal::NonRepeatable(__ex);";
+ C << nl << "throw ::IceInternal::LocalExceptionWrapper(__ex, false);";
C << eb;
C << eb;
C << eb;
diff --git a/cpp/test/Ice/Makefile b/cpp/test/Ice/Makefile
index 9a992ac8cda..57790a44d97 100644
--- a/cpp/test/Ice/Makefile
+++ b/cpp/test/Ice/Makefile
@@ -25,7 +25,8 @@ SUBDIRS = operations \
stream \
hold \
custom \
- binding
+ binding \
+ retry
$(EVERYTHING)::
@for subdir in $(SUBDIRS); \
diff --git a/cpp/test/Ice/retry/.depend b/cpp/test/Ice/retry/.depend
new file mode 100644
index 00000000000..81da755d10c
--- /dev/null
+++ b/cpp/test/Ice/retry/.depend
@@ -0,0 +1,7 @@
+Test.o: Test.cpp Test.h ../../../include/Ice/LocalObjectF.h ../../../include/Ice/Handle.h ../../../include/IceUtil/Handle.h ../../../include/IceUtil/Exception.h ../../../include/IceUtil/Config.h ../../../include/Ice/Config.h ../../../include/Ice/ProxyHandle.h ../../../include/Ice/ProxyF.h ../../../include/Ice/ObjectF.h ../../../include/Ice/Exception.h ../../../include/Ice/LocalObject.h ../../../include/IceUtil/Shared.h ../../../include/Ice/Proxy.h ../../../include/IceUtil/Mutex.h ../../../include/IceUtil/Lock.h ../../../include/IceUtil/ThreadException.h ../../../include/Ice/ProxyFactoryF.h ../../../include/Ice/ConnectionIF.h ../../../include/Ice/EndpointIF.h ../../../include/Ice/Endpoint.h ../../../include/Ice/UndefSysMacros.h ../../../include/Ice/ObjectAdapterF.h ../../../include/Ice/ReferenceF.h ../../../include/Ice/OutgoingAsyncF.h ../../../include/Ice/Current.h ../../../include/Ice/ConnectionF.h ../../../include/Ice/Identity.h ../../../include/Ice/StreamF.h ../../../include/Ice/CommunicatorF.h ../../../include/Ice/Object.h ../../../include/Ice/GCShared.h ../../../include/Ice/GCRecMutex.h ../../../include/IceUtil/RecMutex.h ../../../include/Ice/IncomingAsyncF.h ../../../include/Ice/Outgoing.h ../../../include/IceUtil/Monitor.h ../../../include/IceUtil/Cond.h ../../../include/IceUtil/Time.h ../../../include/Ice/BasicStream.h ../../../include/Ice/InstanceF.h ../../../include/Ice/ObjectFactoryF.h ../../../include/Ice/Buffer.h ../../../include/IceUtil/AutoArray.h ../../../include/Ice/OutgoingAsync.h ../../../include/Ice/Incoming.h ../../../include/Ice/ServantLocatorF.h ../../../include/Ice/ServantManagerF.h ../../../include/Ice/Direct.h ../../../include/Ice/LocalException.h ../../../include/Ice/BuiltinSequences.h ../../../include/Ice/ObjectFactory.h ../../../include/IceUtil/Iterator.h
+Client.o: Client.cpp ../../../include/Ice/Ice.h ../../../include/Ice/GCRecMutex.h ../../../include/IceUtil/RecMutex.h ../../../include/IceUtil/Config.h ../../../include/IceUtil/Lock.h ../../../include/IceUtil/ThreadException.h ../../../include/IceUtil/Exception.h ../../../include/Ice/Config.h ../../../include/Ice/GCShared.h ../../../include/Ice/GC.h ../../../include/IceUtil/Thread.h ../../../include/IceUtil/Shared.h ../../../include/IceUtil/Handle.h ../../../include/IceUtil/Mutex.h ../../../include/IceUtil/Monitor.h ../../../include/IceUtil/Cond.h ../../../include/IceUtil/Time.h ../../../include/Ice/Initialize.h ../../../include/Ice/CommunicatorF.h ../../../include/Ice/LocalObjectF.h ../../../include/Ice/Handle.h ../../../include/Ice/ProxyHandle.h ../../../include/Ice/ProxyF.h ../../../include/Ice/ObjectF.h ../../../include/Ice/Exception.h ../../../include/Ice/LocalObject.h ../../../include/Ice/UndefSysMacros.h ../../../include/Ice/PropertiesF.h ../../../include/Ice/InstanceF.h ../../../include/Ice/LoggerF.h ../../../include/Ice/StreamF.h ../../../include/Ice/BuiltinSequences.h ../../../include/Ice/Proxy.h ../../../include/Ice/ProxyFactoryF.h ../../../include/Ice/ConnectionIF.h ../../../include/Ice/EndpointIF.h ../../../include/Ice/Endpoint.h ../../../include/Ice/ObjectAdapterF.h ../../../include/Ice/ReferenceF.h ../../../include/Ice/OutgoingAsyncF.h ../../../include/Ice/Current.h ../../../include/Ice/ConnectionF.h ../../../include/Ice/Identity.h ../../../include/Ice/LocalException.h ../../../include/Ice/Properties.h ../../../include/Ice/Logger.h ../../../include/Ice/LoggerUtil.h ../../../include/Ice/Stats.h ../../../include/Ice/Communicator.h ../../../include/Ice/StatsF.h ../../../include/Ice/ObjectFactoryF.h ../../../include/Ice/RouterF.h ../../../include/Ice/LocatorF.h ../../../include/Ice/PluginF.h ../../../include/Ice/ObjectFactory.h ../../../include/Ice/ObjectAdapter.h ../../../include/Ice/Object.h ../../../include/Ice/IncomingAsyncF.h ../../../include/Ice/Outgoing.h ../../../include/Ice/BasicStream.h ../../../include/Ice/Buffer.h ../../../include/IceUtil/AutoArray.h ../../../include/Ice/Incoming.h ../../../include/Ice/ServantLocatorF.h ../../../include/Ice/ServantManagerF.h ../../../include/Ice/IncomingAsync.h ../../../include/Ice/Direct.h ../../../include/Ice/UserExceptionFactory.h ../../../include/Ice/FactoryTable.h ../../../include/Ice/FactoryTableDef.h ../../../include/IceUtil/StaticMutex.h ../../../include/Ice/UserExceptionFactoryF.h ../../../include/Ice/FacetMap.h ../../../include/Ice/Locator.h ../../../include/Ice/ProcessF.h ../../../include/Ice/ServantLocator.h ../../../include/Ice/IdentityUtil.h ../../../include/Ice/OutgoingAsync.h ../../../include/Ice/Process.h ../../../include/Ice/Application.h ../../../include/Ice/Connection.h ../../../include/Ice/Functional.h ../../../include/IceUtil/Functional.h ../../../include/Ice/Stream.h ../../include/TestCommon.h Test.h
+AllTests.o: AllTests.cpp ../../../include/Ice/Ice.h ../../../include/Ice/GCRecMutex.h ../../../include/IceUtil/RecMutex.h ../../../include/IceUtil/Config.h ../../../include/IceUtil/Lock.h ../../../include/IceUtil/ThreadException.h ../../../include/IceUtil/Exception.h ../../../include/Ice/Config.h ../../../include/Ice/GCShared.h ../../../include/Ice/GC.h ../../../include/IceUtil/Thread.h ../../../include/IceUtil/Shared.h ../../../include/IceUtil/Handle.h ../../../include/IceUtil/Mutex.h ../../../include/IceUtil/Monitor.h ../../../include/IceUtil/Cond.h ../../../include/IceUtil/Time.h ../../../include/Ice/Initialize.h ../../../include/Ice/CommunicatorF.h ../../../include/Ice/LocalObjectF.h ../../../include/Ice/Handle.h ../../../include/Ice/ProxyHandle.h ../../../include/Ice/ProxyF.h ../../../include/Ice/ObjectF.h ../../../include/Ice/Exception.h ../../../include/Ice/LocalObject.h ../../../include/Ice/UndefSysMacros.h ../../../include/Ice/PropertiesF.h ../../../include/Ice/InstanceF.h ../../../include/Ice/LoggerF.h ../../../include/Ice/StreamF.h ../../../include/Ice/BuiltinSequences.h ../../../include/Ice/Proxy.h ../../../include/Ice/ProxyFactoryF.h ../../../include/Ice/ConnectionIF.h ../../../include/Ice/EndpointIF.h ../../../include/Ice/Endpoint.h ../../../include/Ice/ObjectAdapterF.h ../../../include/Ice/ReferenceF.h ../../../include/Ice/OutgoingAsyncF.h ../../../include/Ice/Current.h ../../../include/Ice/ConnectionF.h ../../../include/Ice/Identity.h ../../../include/Ice/LocalException.h ../../../include/Ice/Properties.h ../../../include/Ice/Logger.h ../../../include/Ice/LoggerUtil.h ../../../include/Ice/Stats.h ../../../include/Ice/Communicator.h ../../../include/Ice/StatsF.h ../../../include/Ice/ObjectFactoryF.h ../../../include/Ice/RouterF.h ../../../include/Ice/LocatorF.h ../../../include/Ice/PluginF.h ../../../include/Ice/ObjectFactory.h ../../../include/Ice/ObjectAdapter.h ../../../include/Ice/Object.h ../../../include/Ice/IncomingAsyncF.h ../../../include/Ice/Outgoing.h ../../../include/Ice/BasicStream.h ../../../include/Ice/Buffer.h ../../../include/IceUtil/AutoArray.h ../../../include/Ice/Incoming.h ../../../include/Ice/ServantLocatorF.h ../../../include/Ice/ServantManagerF.h ../../../include/Ice/IncomingAsync.h ../../../include/Ice/Direct.h ../../../include/Ice/UserExceptionFactory.h ../../../include/Ice/FactoryTable.h ../../../include/Ice/FactoryTableDef.h ../../../include/IceUtil/StaticMutex.h ../../../include/Ice/UserExceptionFactoryF.h ../../../include/Ice/FacetMap.h ../../../include/Ice/Locator.h ../../../include/Ice/ProcessF.h ../../../include/Ice/ServantLocator.h ../../../include/Ice/IdentityUtil.h ../../../include/Ice/OutgoingAsync.h ../../../include/Ice/Process.h ../../../include/Ice/Application.h ../../../include/Ice/Connection.h ../../../include/Ice/Functional.h ../../../include/IceUtil/Functional.h ../../../include/Ice/Stream.h ../../include/TestCommon.h Test.h
+Test.o: Test.cpp Test.h ../../../include/Ice/LocalObjectF.h ../../../include/Ice/Handle.h ../../../include/IceUtil/Handle.h ../../../include/IceUtil/Exception.h ../../../include/IceUtil/Config.h ../../../include/Ice/Config.h ../../../include/Ice/ProxyHandle.h ../../../include/Ice/ProxyF.h ../../../include/Ice/ObjectF.h ../../../include/Ice/Exception.h ../../../include/Ice/LocalObject.h ../../../include/IceUtil/Shared.h ../../../include/Ice/Proxy.h ../../../include/IceUtil/Mutex.h ../../../include/IceUtil/Lock.h ../../../include/IceUtil/ThreadException.h ../../../include/Ice/ProxyFactoryF.h ../../../include/Ice/ConnectionIF.h ../../../include/Ice/EndpointIF.h ../../../include/Ice/Endpoint.h ../../../include/Ice/UndefSysMacros.h ../../../include/Ice/ObjectAdapterF.h ../../../include/Ice/ReferenceF.h ../../../include/Ice/OutgoingAsyncF.h ../../../include/Ice/Current.h ../../../include/Ice/ConnectionF.h ../../../include/Ice/Identity.h ../../../include/Ice/StreamF.h ../../../include/Ice/CommunicatorF.h ../../../include/Ice/Object.h ../../../include/Ice/GCShared.h ../../../include/Ice/GCRecMutex.h ../../../include/IceUtil/RecMutex.h ../../../include/Ice/IncomingAsyncF.h ../../../include/Ice/Outgoing.h ../../../include/IceUtil/Monitor.h ../../../include/IceUtil/Cond.h ../../../include/IceUtil/Time.h ../../../include/Ice/BasicStream.h ../../../include/Ice/InstanceF.h ../../../include/Ice/ObjectFactoryF.h ../../../include/Ice/Buffer.h ../../../include/IceUtil/AutoArray.h ../../../include/Ice/OutgoingAsync.h ../../../include/Ice/Incoming.h ../../../include/Ice/ServantLocatorF.h ../../../include/Ice/ServantManagerF.h ../../../include/Ice/Direct.h ../../../include/Ice/LocalException.h ../../../include/Ice/BuiltinSequences.h ../../../include/Ice/ObjectFactory.h ../../../include/IceUtil/Iterator.h
+TestI.o: TestI.cpp ../../../include/Ice/Ice.h ../../../include/Ice/GCRecMutex.h ../../../include/IceUtil/RecMutex.h ../../../include/IceUtil/Config.h ../../../include/IceUtil/Lock.h ../../../include/IceUtil/ThreadException.h ../../../include/IceUtil/Exception.h ../../../include/Ice/Config.h ../../../include/Ice/GCShared.h ../../../include/Ice/GC.h ../../../include/IceUtil/Thread.h ../../../include/IceUtil/Shared.h ../../../include/IceUtil/Handle.h ../../../include/IceUtil/Mutex.h ../../../include/IceUtil/Monitor.h ../../../include/IceUtil/Cond.h ../../../include/IceUtil/Time.h ../../../include/Ice/Initialize.h ../../../include/Ice/CommunicatorF.h ../../../include/Ice/LocalObjectF.h ../../../include/Ice/Handle.h ../../../include/Ice/ProxyHandle.h ../../../include/Ice/ProxyF.h ../../../include/Ice/ObjectF.h ../../../include/Ice/Exception.h ../../../include/Ice/LocalObject.h ../../../include/Ice/UndefSysMacros.h ../../../include/Ice/PropertiesF.h ../../../include/Ice/InstanceF.h ../../../include/Ice/LoggerF.h ../../../include/Ice/StreamF.h ../../../include/Ice/BuiltinSequences.h ../../../include/Ice/Proxy.h ../../../include/Ice/ProxyFactoryF.h ../../../include/Ice/ConnectionIF.h ../../../include/Ice/EndpointIF.h ../../../include/Ice/Endpoint.h ../../../include/Ice/ObjectAdapterF.h ../../../include/Ice/ReferenceF.h ../../../include/Ice/OutgoingAsyncF.h ../../../include/Ice/Current.h ../../../include/Ice/ConnectionF.h ../../../include/Ice/Identity.h ../../../include/Ice/LocalException.h ../../../include/Ice/Properties.h ../../../include/Ice/Logger.h ../../../include/Ice/LoggerUtil.h ../../../include/Ice/Stats.h ../../../include/Ice/Communicator.h ../../../include/Ice/StatsF.h ../../../include/Ice/ObjectFactoryF.h ../../../include/Ice/RouterF.h ../../../include/Ice/LocatorF.h ../../../include/Ice/PluginF.h ../../../include/Ice/ObjectFactory.h ../../../include/Ice/ObjectAdapter.h ../../../include/Ice/Object.h ../../../include/Ice/IncomingAsyncF.h ../../../include/Ice/Outgoing.h ../../../include/Ice/BasicStream.h ../../../include/Ice/Buffer.h ../../../include/IceUtil/AutoArray.h ../../../include/Ice/Incoming.h ../../../include/Ice/ServantLocatorF.h ../../../include/Ice/ServantManagerF.h ../../../include/Ice/IncomingAsync.h ../../../include/Ice/Direct.h ../../../include/Ice/UserExceptionFactory.h ../../../include/Ice/FactoryTable.h ../../../include/Ice/FactoryTableDef.h ../../../include/IceUtil/StaticMutex.h ../../../include/Ice/UserExceptionFactoryF.h ../../../include/Ice/FacetMap.h ../../../include/Ice/Locator.h ../../../include/Ice/ProcessF.h ../../../include/Ice/ServantLocator.h ../../../include/Ice/IdentityUtil.h ../../../include/Ice/OutgoingAsync.h ../../../include/Ice/Process.h ../../../include/Ice/Application.h ../../../include/Ice/Connection.h ../../../include/Ice/Functional.h ../../../include/IceUtil/Functional.h ../../../include/Ice/Stream.h TestI.h Test.h
+Server.o: Server.cpp ../../../include/Ice/Ice.h ../../../include/Ice/GCRecMutex.h ../../../include/IceUtil/RecMutex.h ../../../include/IceUtil/Config.h ../../../include/IceUtil/Lock.h ../../../include/IceUtil/ThreadException.h ../../../include/IceUtil/Exception.h ../../../include/Ice/Config.h ../../../include/Ice/GCShared.h ../../../include/Ice/GC.h ../../../include/IceUtil/Thread.h ../../../include/IceUtil/Shared.h ../../../include/IceUtil/Handle.h ../../../include/IceUtil/Mutex.h ../../../include/IceUtil/Monitor.h ../../../include/IceUtil/Cond.h ../../../include/IceUtil/Time.h ../../../include/Ice/Initialize.h ../../../include/Ice/CommunicatorF.h ../../../include/Ice/LocalObjectF.h ../../../include/Ice/Handle.h ../../../include/Ice/ProxyHandle.h ../../../include/Ice/ProxyF.h ../../../include/Ice/ObjectF.h ../../../include/Ice/Exception.h ../../../include/Ice/LocalObject.h ../../../include/Ice/UndefSysMacros.h ../../../include/Ice/PropertiesF.h ../../../include/Ice/InstanceF.h ../../../include/Ice/LoggerF.h ../../../include/Ice/StreamF.h ../../../include/Ice/BuiltinSequences.h ../../../include/Ice/Proxy.h ../../../include/Ice/ProxyFactoryF.h ../../../include/Ice/ConnectionIF.h ../../../include/Ice/EndpointIF.h ../../../include/Ice/Endpoint.h ../../../include/Ice/ObjectAdapterF.h ../../../include/Ice/ReferenceF.h ../../../include/Ice/OutgoingAsyncF.h ../../../include/Ice/Current.h ../../../include/Ice/ConnectionF.h ../../../include/Ice/Identity.h ../../../include/Ice/LocalException.h ../../../include/Ice/Properties.h ../../../include/Ice/Logger.h ../../../include/Ice/LoggerUtil.h ../../../include/Ice/Stats.h ../../../include/Ice/Communicator.h ../../../include/Ice/StatsF.h ../../../include/Ice/ObjectFactoryF.h ../../../include/Ice/RouterF.h ../../../include/Ice/LocatorF.h ../../../include/Ice/PluginF.h ../../../include/Ice/ObjectFactory.h ../../../include/Ice/ObjectAdapter.h ../../../include/Ice/Object.h ../../../include/Ice/IncomingAsyncF.h ../../../include/Ice/Outgoing.h ../../../include/Ice/BasicStream.h ../../../include/Ice/Buffer.h ../../../include/IceUtil/AutoArray.h ../../../include/Ice/Incoming.h ../../../include/Ice/ServantLocatorF.h ../../../include/Ice/ServantManagerF.h ../../../include/Ice/IncomingAsync.h ../../../include/Ice/Direct.h ../../../include/Ice/UserExceptionFactory.h ../../../include/Ice/FactoryTable.h ../../../include/Ice/FactoryTableDef.h ../../../include/IceUtil/StaticMutex.h ../../../include/Ice/UserExceptionFactoryF.h ../../../include/Ice/FacetMap.h ../../../include/Ice/Locator.h ../../../include/Ice/ProcessF.h ../../../include/Ice/ServantLocator.h ../../../include/Ice/IdentityUtil.h ../../../include/Ice/OutgoingAsync.h ../../../include/Ice/Process.h ../../../include/Ice/Application.h ../../../include/Ice/Connection.h ../../../include/Ice/Functional.h ../../../include/IceUtil/Functional.h ../../../include/Ice/Stream.h TestI.h Test.h
+Test.cpp: Test.ice
diff --git a/cpp/test/Ice/retry/AllTests.cpp b/cpp/test/Ice/retry/AllTests.cpp
new file mode 100644
index 00000000000..fb55e27b299
--- /dev/null
+++ b/cpp/test/Ice/retry/AllTests.cpp
@@ -0,0 +1,57 @@
+// **********************************************************************
+//
+// 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.
+//
+// **********************************************************************
+
+#include <Ice/Ice.h>
+#include <TestCommon.h>
+#include <Test.h>
+
+using namespace std;
+using namespace Test;
+
+RetryPrx
+allTests(const Ice::CommunicatorPtr& communicator)
+{
+ cout << "testing stringToProxy... " << flush;
+ string ref = "retry:default -p 12010 -t 10000";
+ Ice::ObjectPrx base1 = communicator->stringToProxy(ref);
+ test(base1);
+ Ice::ObjectPrx base2 = communicator->stringToProxy(ref);
+ test(base2);
+ cout << "ok" << endl;
+
+ cout << "testing checked cast... " << flush;
+ RetryPrx retry1 = RetryPrx::checkedCast(base1);
+ test(retry1);
+ test(retry1 == base1);
+ RetryPrx retry2 = RetryPrx::checkedCast(base2);
+ test(retry2);
+ test(retry2 == base2);
+ cout << "ok" << endl;
+
+ cout << "calling regular operation with first proxy... ";
+ retry1->op(false);
+ cout << "ok" << endl;
+
+ cout << "calling operation to kill connection with second proxy... ";
+ try
+ {
+ retry2->op(true);
+ test(false);
+ }
+ catch(Ice::ConnectionLostException)
+ {
+ cout << "ok" << endl;
+ }
+
+ cout << "calling regular operation with first proxy again... ";
+ retry1->op(false);
+ cout << "ok" << endl;
+
+ return retry1;
+}
diff --git a/cpp/test/Ice/retry/Client.cpp b/cpp/test/Ice/retry/Client.cpp
new file mode 100644
index 00000000000..b2ba565994d
--- /dev/null
+++ b/cpp/test/Ice/retry/Client.cpp
@@ -0,0 +1,69 @@
+// **********************************************************************
+//
+// 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.
+//
+// **********************************************************************
+
+#include <Ice/Ice.h>
+#include <TestCommon.h>
+#include <Test.h>
+
+using namespace std;
+using namespace Test;
+
+int
+run(int argc, char* argv[], const Ice::CommunicatorPtr& communicator)
+{
+ RetryPrx allTests(const Ice::CommunicatorPtr&);
+ RetryPrx retry = allTests(communicator);
+ retry->shutdown();
+ return EXIT_SUCCESS;
+}
+
+int
+main(int argc, char* argv[])
+{
+ int status;
+ Ice::CommunicatorPtr communicator;
+
+ try
+ {
+ Ice::PropertiesPtr properties = Ice::getDefaultProperties(argc, argv);
+
+ //
+ // For this test, we want to disable retries.
+ //
+ properties->setProperty("Ice.RetryIntervals", "-1");
+
+ //
+ // This test kills connections, so we don't want warnings.
+ //
+ //properties->setProperty("Ice.Warn.Connections", "0");
+
+ communicator = Ice::initialize(argc, argv);
+ status = run(argc, argv, communicator);
+ }
+ catch(const Ice::Exception& ex)
+ {
+ cerr << ex << endl;
+ status = EXIT_FAILURE;
+ }
+
+ if(communicator)
+ {
+ try
+ {
+ communicator->destroy();
+ }
+ catch(const Ice::Exception& ex)
+ {
+ cerr << ex << endl;
+ status = EXIT_FAILURE;
+ }
+ }
+
+ return status;
+}
diff --git a/cpp/test/Ice/retry/Makefile b/cpp/test/Ice/retry/Makefile
new file mode 100644
index 00000000000..c977df9e97e
--- /dev/null
+++ b/cpp/test/Ice/retry/Makefile
@@ -0,0 +1,42 @@
+# **********************************************************************
+#
+# 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.
+#
+# **********************************************************************
+
+top_srcdir = ../../..
+
+CLIENT = client
+SERVER = server
+
+TARGETS = $(CLIENT) $(SERVER)
+
+COBJS = Test.o \
+ Client.o \
+ AllTests.o
+
+SOBJS = Test.o \
+ TestI.o \
+ Server.o
+
+SRCS = $(COBJS:.o=.cpp) \
+ $(SOBJS:.o=.cpp)
+
+SLICE_SRCS = Test.ice
+
+include $(top_srcdir)/config/Make.rules
+
+CPPFLAGS := -I. -I../../include $(CPPFLAGS)
+
+$(CLIENT): $(COBJS)
+ rm -f $@
+ $(CXX) $(LDFLAGS) -o $@ $(COBJS) $(LIBS)
+
+$(SERVER): $(SOBJS)
+ rm -f $@
+ $(CXX) $(LDFLAGS) -o $@ $(SOBJS) $(LIBS)
+
+include .depend
diff --git a/cpp/test/Ice/retry/Server.cpp b/cpp/test/Ice/retry/Server.cpp
new file mode 100644
index 00000000000..8db77aa2da4
--- /dev/null
+++ b/cpp/test/Ice/retry/Server.cpp
@@ -0,0 +1,58 @@
+// **********************************************************************
+//
+// 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.
+//
+// **********************************************************************
+
+#include <Ice/Ice.h>
+#include <TestI.h>
+
+using namespace std;
+
+int
+run(int argc, char* argv[], const Ice::CommunicatorPtr& communicator)
+{
+ communicator->getProperties()->setProperty("TestAdapter.Endpoints", "default -p 12010 -t 10000:udp");
+ Ice::ObjectAdapterPtr adapter = communicator->createObjectAdapter("TestAdapter");
+ Ice::ObjectPtr object = new RetryI;
+ adapter->add(object, Ice::stringToIdentity("retry"));
+ adapter->activate();
+ communicator->waitForShutdown();
+ return EXIT_SUCCESS;
+}
+
+int
+main(int argc, char* argv[])
+{
+ int status;
+ Ice::CommunicatorPtr communicator;
+
+ try
+ {
+ communicator = Ice::initialize(argc, argv);
+ status = run(argc, argv, communicator);
+ }
+ catch(const Ice::Exception& ex)
+ {
+ cerr << ex << endl;
+ status = EXIT_FAILURE;
+ }
+
+ if(communicator)
+ {
+ try
+ {
+ communicator->destroy();
+ }
+ catch(const Ice::Exception& ex)
+ {
+ cerr << ex << endl;
+ status = EXIT_FAILURE;
+ }
+ }
+
+ return status;
+}
diff --git a/cpp/test/Ice/retry/TestI.cpp b/cpp/test/Ice/retry/TestI.cpp
new file mode 100644
index 00000000000..d4f0d072074
--- /dev/null
+++ b/cpp/test/Ice/retry/TestI.cpp
@@ -0,0 +1,26 @@
+// **********************************************************************
+//
+// 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.
+//
+// **********************************************************************
+
+#include <Ice/Ice.h>
+#include <TestI.h>
+
+void
+RetryI::op(bool kill, const Ice::Current& current)
+{
+ if(kill)
+ {
+ current.con->close(true);
+ }
+}
+
+void
+RetryI::shutdown(const Ice::Current& current)
+{
+ current.adapter->getCommunicator()->shutdown();
+}
diff --git a/cpp/test/Ice/retry/TestI.h b/cpp/test/Ice/retry/TestI.h
new file mode 100644
index 00000000000..0114b2365fd
--- /dev/null
+++ b/cpp/test/Ice/retry/TestI.h
@@ -0,0 +1,21 @@
+// **********************************************************************
+//
+// 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.
+//
+// **********************************************************************
+
+#ifndef TEST_I_H
+#define TEST_I_H
+
+#include <Test.h>
+
+class RetryI : public Test::Retry
+{
+ virtual void op(bool, const Ice::Current&);
+ virtual void shutdown(const Ice::Current&);
+};
+
+#endif
diff --git a/cpp/test/Ice/retry/retryC.dsp b/cpp/test/Ice/retry/retryC.dsp
new file mode 100644
index 00000000000..25234220e12
--- /dev/null
+++ b/cpp/test/Ice/retry/retryC.dsp
@@ -0,0 +1,157 @@
+# Microsoft Developer Studio Project File - Name="retryC" - Package Owner=<4>
+# Microsoft Developer Studio Generated Build File, Format Version 6.00
+# ** DO NOT EDIT **
+
+# TARGTYPE "Win32 (x86) Console Application" 0x0103
+
+CFG=retryC - Win32 Debug
+!MESSAGE This is not a valid makefile. To build this project using NMAKE,
+!MESSAGE use the Export Makefile command and run
+!MESSAGE
+!MESSAGE NMAKE /f "retryC.mak".
+!MESSAGE
+!MESSAGE You can specify a configuration when running NMAKE
+!MESSAGE by defining the macro CFG on the command line. For example:
+!MESSAGE
+!MESSAGE NMAKE /f "retryC.mak" CFG="retryC - Win32 Debug"
+!MESSAGE
+!MESSAGE Possible choices for configuration are:
+!MESSAGE
+!MESSAGE "retryC - Win32 Release" (based on "Win32 (x86) Console Application")
+!MESSAGE "retryC - Win32 Debug" (based on "Win32 (x86) Console Application")
+!MESSAGE
+
+# Begin Project
+# PROP AllowPerConfigDependencies 0
+# PROP Scc_ProjName ""
+# PROP Scc_LocalPath ""
+CPP=cl.exe
+RSC=rc.exe
+
+!IF "$(CFG)" == "retryC - Win32 Release"
+
+# PROP BASE Use_MFC 0
+# PROP BASE Use_Debug_Libraries 0
+# PROP BASE Output_Dir "Release"
+# PROP BASE Intermediate_Dir "Release"
+# PROP BASE Target_Dir ""
+# PROP Use_MFC 0
+# PROP Use_Debug_Libraries 0
+# PROP Output_Dir "Release"
+# PROP Intermediate_Dir "Release"
+# PROP Ignore_Export_Lib 0
+# PROP Target_Dir ""
+# ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c
+# ADD CPP /nologo /MD /W3 /WX /GR /GX /O2 /I "." /I "../../../include" /I "../../include" /D "_CONSOLE" /D "NDEBUG" /D "WIN32_LEAN_AND_MEAN" /FD /c
+# SUBTRACT CPP /Z<none> /Fr /YX
+# ADD BASE RSC /l 0x409 /d "NDEBUG"
+# ADD RSC /l 0x409 /d "NDEBUG"
+BSC32=bscmake.exe
+# ADD BASE BSC32 /nologo
+# ADD BSC32 /nologo
+LINK32=link.exe
+# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /machine:I386
+# ADD LINK32 /nologo /subsystem:console /pdb:none /machine:I386 /out:"client.exe" /libpath:"../../../lib" /FIXED:no
+# SUBTRACT LINK32 /debug /nodefaultlib
+
+!ELSEIF "$(CFG)" == "retryC - Win32 Debug"
+
+# PROP BASE Use_MFC 0
+# PROP BASE Use_Debug_Libraries 1
+# PROP BASE Output_Dir "Debug"
+# PROP BASE Intermediate_Dir "Debug"
+# PROP BASE Target_Dir ""
+# PROP Use_MFC 0
+# PROP Use_Debug_Libraries 1
+# PROP Output_Dir "Debug"
+# PROP Intermediate_Dir "Debug"
+# PROP Ignore_Export_Lib 0
+# PROP Target_Dir ""
+# ADD BASE CPP /nologo /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /GZ /c
+# ADD CPP /nologo /MDd /W3 /WX /Gm /GR /GX /Zi /Od /I "." /I "../../../include" /I "../../include" /D "_CONSOLE" /D "_DEBUG" /D "WIN32_LEAN_AND_MEAN" /FD /GZ /c
+# SUBTRACT CPP /Fr /YX
+# ADD BASE RSC /l 0x409 /d "_DEBUG"
+# ADD RSC /l 0x409 /d "_DEBUG"
+BSC32=bscmake.exe
+# ADD BASE BSC32 /nologo
+# ADD BSC32 /nologo
+LINK32=link.exe
+# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept
+# ADD LINK32 /nologo /subsystem:console /debug /machine:I386 /out:"client.exe" /pdbtype:sept /libpath:"../../../lib" /FIXED:no
+# SUBTRACT LINK32 /pdb:none
+
+!ENDIF
+
+# Begin Target
+
+# Name "retryC - Win32 Release"
+# Name "retryC - Win32 Debug"
+# Begin Group "Source Files"
+
+# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat"
+# Begin Source File
+
+SOURCE=.\AllTests.cpp
+# End Source File
+# Begin Source File
+
+SOURCE=.\Client.cpp
+# End Source File
+# Begin Source File
+
+SOURCE=.\Test.cpp
+# End Source File
+# End Group
+# Begin Group "Header Files"
+
+# PROP Default_Filter "h;hpp;hxx;hm;inl"
+# Begin Source File
+
+SOURCE=.\Test.h
+# End Source File
+# End Group
+# Begin Group "Resource Files"
+
+# PROP Default_Filter "ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe"
+# Begin Source File
+
+SOURCE=.\Test.ice
+
+!IF "$(CFG)" == "retryC - Win32 Release"
+
+USERDEP__TEST_="..\..\..\bin\slice2cpp.exe" "..\..\..\lib\slice.lib"
+# Begin Custom Build
+InputPath=.\Test.ice
+
+BuildCmds= \
+ ..\..\..\bin\slice2cpp.exe Test.ice
+
+"Test.h" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
+ $(BuildCmds)
+
+"Test.cpp" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
+ $(BuildCmds)
+# End Custom Build
+
+!ELSEIF "$(CFG)" == "retryC - Win32 Debug"
+
+USERDEP__TEST_="..\..\..\bin\slice2cpp.exe" "..\..\..\lib\sliced.lib"
+# Begin Custom Build
+InputPath=.\Test.ice
+
+BuildCmds= \
+ ..\..\..\bin\slice2cpp.exe Test.ice
+
+"Test.h" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
+ $(BuildCmds)
+
+"Test.cpp" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
+ $(BuildCmds)
+# End Custom Build
+
+!ENDIF
+
+# End Source File
+# End Group
+# End Target
+# End Project
diff --git a/cpp/test/Ice/retry/retryS.dsp b/cpp/test/Ice/retry/retryS.dsp
new file mode 100644
index 00000000000..698aec516cd
--- /dev/null
+++ b/cpp/test/Ice/retry/retryS.dsp
@@ -0,0 +1,161 @@
+# Microsoft Developer Studio Project File - Name="retryS" - Package Owner=<4>
+# Microsoft Developer Studio Generated Build File, Format Version 6.00
+# ** DO NOT EDIT **
+
+# TARGTYPE "Win32 (x86) Console Application" 0x0103
+
+CFG=retryS - Win32 Debug
+!MESSAGE This is not a valid makefile. To build this project using NMAKE,
+!MESSAGE use the Export Makefile command and run
+!MESSAGE
+!MESSAGE NMAKE /f "retryS.mak".
+!MESSAGE
+!MESSAGE You can specify a configuration when running NMAKE
+!MESSAGE by defining the macro CFG on the command line. For example:
+!MESSAGE
+!MESSAGE NMAKE /f "retryS.mak" CFG="retryS - Win32 Debug"
+!MESSAGE
+!MESSAGE Possible choices for configuration are:
+!MESSAGE
+!MESSAGE "retryS - Win32 Release" (based on "Win32 (x86) Console Application")
+!MESSAGE "retryS - Win32 Debug" (based on "Win32 (x86) Console Application")
+!MESSAGE
+
+# Begin Project
+# PROP AllowPerConfigDependencies 0
+# PROP Scc_ProjName ""
+# PROP Scc_LocalPath ""
+CPP=cl.exe
+RSC=rc.exe
+
+!IF "$(CFG)" == "retryS - Win32 Release"
+
+# PROP BASE Use_MFC 0
+# PROP BASE Use_Debug_Libraries 0
+# PROP BASE Output_Dir "Release"
+# PROP BASE Intermediate_Dir "Release"
+# PROP BASE Target_Dir ""
+# PROP Use_MFC 0
+# PROP Use_Debug_Libraries 0
+# PROP Output_Dir "Release"
+# PROP Intermediate_Dir "Release"
+# PROP Ignore_Export_Lib 0
+# PROP Target_Dir ""
+# ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c
+# ADD CPP /nologo /MD /W3 /WX /GR /GX /O2 /I "." /I "../../../include" /I "../../include" /D "_CONSOLE" /D "NDEBUG" /D "WIN32_LEAN_AND_MEAN" /FD /c
+# SUBTRACT CPP /Z<none> /Fr /YX
+# ADD BASE RSC /l 0x409 /d "NDEBUG"
+# ADD RSC /l 0x409 /d "NDEBUG"
+BSC32=bscmake.exe
+# ADD BASE BSC32 /nologo
+# ADD BSC32 /nologo
+LINK32=link.exe
+# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /machine:I386
+# ADD LINK32 /nologo /subsystem:console /pdb:none /machine:I386 /out:"server.exe" /libpath:"../../../lib" /FIXED:no
+# SUBTRACT LINK32 /debug /nodefaultlib
+
+!ELSEIF "$(CFG)" == "retryS - Win32 Debug"
+
+# PROP BASE Use_MFC 0
+# PROP BASE Use_Debug_Libraries 1
+# PROP BASE Output_Dir "Debug"
+# PROP BASE Intermediate_Dir "Debug"
+# PROP BASE Target_Dir ""
+# PROP Use_MFC 0
+# PROP Use_Debug_Libraries 1
+# PROP Output_Dir "Debug"
+# PROP Intermediate_Dir "Debug"
+# PROP Ignore_Export_Lib 0
+# PROP Target_Dir ""
+# ADD BASE CPP /nologo /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /GZ /c
+# ADD CPP /nologo /MDd /W3 /WX /Gm /GR /GX /Zi /Od /I "." /I "../../../include" /I "../../include" /D "_CONSOLE" /D "_DEBUG" /D "WIN32_LEAN_AND_MEAN" /FD /GZ /c
+# SUBTRACT CPP /Fr /YX
+# ADD BASE RSC /l 0x409 /d "_DEBUG"
+# ADD RSC /l 0x409 /d "_DEBUG"
+BSC32=bscmake.exe
+# ADD BASE BSC32 /nologo
+# ADD BSC32 /nologo
+LINK32=link.exe
+# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept
+# ADD LINK32 /nologo /subsystem:console /debug /machine:I386 /out:"server.exe" /pdbtype:sept /libpath:"../../../lib" /FIXED:no
+# SUBTRACT LINK32 /pdb:none
+
+!ENDIF
+
+# Begin Target
+
+# Name "retryS - Win32 Release"
+# Name "retryS - Win32 Debug"
+# Begin Group "Source Files"
+
+# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat"
+# Begin Source File
+
+SOURCE=.\Server.cpp
+# End Source File
+# Begin Source File
+
+SOURCE=.\Test.cpp
+# End Source File
+# Begin Source File
+
+SOURCE=.\TestI.cpp
+# End Source File
+# End Group
+# Begin Group "Header Files"
+
+# PROP Default_Filter "h;hpp;hxx;hm;inl"
+# Begin Source File
+
+SOURCE=.\Test.h
+# End Source File
+# Begin Source File
+
+SOURCE=.\TestI.h
+# End Source File
+# End Group
+# Begin Group "Resource Files"
+
+# PROP Default_Filter "ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe"
+# Begin Source File
+
+SOURCE=.\Test.ice
+
+!IF "$(CFG)" == "retryS - Win32 Release"
+
+USERDEP__TEST_="..\..\..\bin\slice2cpp.exe" "..\..\..\lib\slice.lib"
+# Begin Custom Build
+InputPath=.\Test.ice
+
+BuildCmds= \
+ ..\..\..\bin\slice2cpp.exe Test.ice
+
+"Test.h" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
+ $(BuildCmds)
+
+"Test.cpp" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
+ $(BuildCmds)
+# End Custom Build
+
+!ELSEIF "$(CFG)" == "retryS - Win32 Debug"
+
+USERDEP__TEST_="..\..\..\bin\slice2cpp.exe" "..\..\..\lib\sliced.lib"
+# Begin Custom Build
+InputPath=.\Test.ice
+
+BuildCmds= \
+ ..\..\..\bin\slice2cpp.exe Test.ice
+
+"Test.h" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
+ $(BuildCmds)
+
+"Test.cpp" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
+ $(BuildCmds)
+# End Custom Build
+
+!ENDIF
+
+# End Source File
+# End Group
+# End Target
+# End Project