summaryrefslogtreecommitdiff
path: root/cpp/src
diff options
context:
space:
mode:
Diffstat (limited to 'cpp/src')
-rw-r--r--cpp/src/Ice/OutgoingAsync.cpp54
-rw-r--r--cpp/src/Ice/RetryQueue.cpp17
-rw-r--r--cpp/src/Ice/RetryQueue.h18
-rw-r--r--cpp/src/slice2java/Gen.cpp4
4 files changed, 67 insertions, 26 deletions
diff --git a/cpp/src/Ice/OutgoingAsync.cpp b/cpp/src/Ice/OutgoingAsync.cpp
index cd3442113f8..c03cdd5a441 100644
--- a/cpp/src/Ice/OutgoingAsync.cpp
+++ b/cpp/src/Ice/OutgoingAsync.cpp
@@ -618,6 +618,26 @@ IceInternal::OutgoingAsync::__finished(const Ice::Exception& exc)
}
void
+IceInternal::OutgoingAsync::__processRetry(bool destroyed)
+{
+ if(destroyed)
+ {
+ __invokeExceptionAsync(CommunicatorDestroyedException(__FILE__, __LINE__));
+ }
+ else
+ {
+ try
+ {
+ __invoke(false);
+ }
+ catch(const Ice::LocalException& ex)
+ {
+ __invokeExceptionAsync(ex);
+ }
+ }
+}
+
+void
IceInternal::OutgoingAsync::__invokeExceptionAsync(const Ice::Exception& ex)
{
if((_state & Done) == 0 && _handler)
@@ -986,6 +1006,12 @@ IceInternal::BatchOutgoingAsync::__finished(const Ice::Exception& exc)
__invokeException(exc);
}
+void
+IceInternal::BatchOutgoingAsync::__processRetry(bool destroyed)
+{
+ // Does not support retry
+}
+
IceInternal::ProxyBatchOutgoingAsync::ProxyBatchOutgoingAsync(const Ice::ObjectPrx& proxy,
const std::string& operation,
const CallbackBasePtr& delegate,
@@ -1208,13 +1234,15 @@ IceInternal::CommunicatorBatchOutgoingAsync::check(bool userThread)
}
}
-IceInternal::GetConnectionOutgoingAsync::GetConnectionOutgoingAsync(const Ice::ObjectPrx& proxy,
+IceInternal::GetConnectionOutgoingAsync::GetConnectionOutgoingAsync(const Ice::ObjectPrx& prx,
const std::string& operation,
const CallbackBasePtr& delegate,
const Ice::LocalObjectPtr& cookie) :
- OutgoingAsync(proxy, operation, delegate, cookie)
+ AsyncResult(prx->ice_getCommunicator(), prx->__reference()->getInstance(), operation, delegate, cookie),
+ _proxy(prx),
+ _cnt(0)
{
- _observer.attach(proxy.get(), operation, 0);
+ _observer.attach(prx.get(), operation, 0);
}
void
@@ -1285,6 +1313,26 @@ IceInternal::GetConnectionOutgoingAsync::__finished(const Ice::Exception& exc)
}
void
+IceInternal::GetConnectionOutgoingAsync::__processRetry(bool destroyed)
+{
+ if(destroyed)
+ {
+ __invokeExceptionAsync(CommunicatorDestroyedException(__FILE__, __LINE__));
+ }
+ else
+ {
+ try
+ {
+ __invoke();
+ }
+ catch(const Ice::LocalException& ex)
+ {
+ __invokeExceptionAsync(ex);
+ }
+ }
+}
+
+void
IceInternal::GetConnectionOutgoingAsync::handleException(const Ice::Exception& exc)
{
try
diff --git a/cpp/src/Ice/RetryQueue.cpp b/cpp/src/Ice/RetryQueue.cpp
index e10c09b1396..730b15ba73d 100644
--- a/cpp/src/Ice/RetryQueue.cpp
+++ b/cpp/src/Ice/RetryQueue.cpp
@@ -18,7 +18,7 @@ using namespace IceInternal;
IceUtil::Shared* IceInternal::upCast(RetryQueue* p) { return p; }
-IceInternal::RetryTask::RetryTask(const RetryQueuePtr& queue, const OutgoingAsyncPtr& outAsync) :
+IceInternal::RetryTask::RetryTask(const RetryQueuePtr& queue, const OutgoingAsyncMessageCallbackPtr& outAsync) :
_queue(queue), _outAsync(outAsync)
{
}
@@ -28,21 +28,14 @@ IceInternal::RetryTask::runTimerTask()
{
if(_queue->remove(this))
{
- try
- {
- _outAsync->__invoke(false);
- }
- catch(const Ice::LocalException& ex)
- {
- _outAsync->__invokeExceptionAsync(ex);
- }
+ _outAsync->__processRetry(false);
}
}
void
IceInternal::RetryTask::destroy()
{
- _outAsync->__invokeExceptionAsync(CommunicatorDestroyedException(__FILE__, __LINE__));
+ _outAsync->__processRetry(true);
}
bool
@@ -56,7 +49,7 @@ IceInternal::RetryQueue::RetryQueue(const InstancePtr& instance) : _instance(ins
}
void
-IceInternal::RetryQueue::add(const OutgoingAsyncPtr& out, int interval)
+IceInternal::RetryQueue::add(const OutgoingAsyncMessageCallbackPtr& out, int interval)
{
Lock sync(*this);
RetryTaskPtr task = new RetryTask(this, out);
@@ -66,7 +59,7 @@ IceInternal::RetryQueue::add(const OutgoingAsyncPtr& out, int interval)
}
catch(const IceUtil::IllegalArgumentException&) // Expected if the communicator destroyed the timer.
{
- throw CommunicatorDestroyedException(__FILE__, __LINE__);
+ throw CommunicatorDestroyedException(__FILE__, __LINE__);
}
_requests.insert(task);
}
diff --git a/cpp/src/Ice/RetryQueue.h b/cpp/src/Ice/RetryQueue.h
index 2270363c841..4339a7765b2 100644
--- a/cpp/src/Ice/RetryQueue.h
+++ b/cpp/src/Ice/RetryQueue.h
@@ -23,18 +23,18 @@ namespace IceInternal
class RetryTask : public IceUtil::TimerTask
{
public:
-
- RetryTask(const RetryQueuePtr&, const OutgoingAsyncPtr&);
-
+
+ RetryTask(const RetryQueuePtr&, const OutgoingAsyncMessageCallbackPtr&);
+
virtual void runTimerTask();
void destroy();
-
+
bool operator<(const RetryTask&) const;
-
+
private:
-
+
const RetryQueuePtr _queue;
- const OutgoingAsyncPtr _outAsync;
+ const OutgoingAsyncMessageCallbackPtr _outAsync;
};
typedef IceUtil::Handle<RetryTask> RetryTaskPtr;
@@ -43,8 +43,8 @@ class RetryQueue : public IceUtil::Shared, public IceUtil::Mutex
public:
RetryQueue(const InstancePtr&);
-
- void add(const OutgoingAsyncPtr&, int);
+
+ void add(const OutgoingAsyncMessageCallbackPtr&, int);
void destroy();
private:
diff --git a/cpp/src/slice2java/Gen.cpp b/cpp/src/slice2java/Gen.cpp
index 9de67726eb9..9889c96a214 100644
--- a/cpp/src/slice2java/Gen.cpp
+++ b/cpp/src/slice2java/Gen.cpp
@@ -4740,8 +4740,8 @@ Slice::Gen::HelperVisitor::visitClassDefStart(const ClassDefPtr& p)
out << sb;
if(op->returnsData())
{
- out << nl << "IceInternal.AsyncResultI __result = (IceInternal.AsyncResultI)__iresult;";
- out << nl << "IceInternal.AsyncResultI.check(__result, this, __" << op->name() << "_name);";
+ out << nl << "IceInternal.OutgoingAsyncBase __result = (IceInternal.OutgoingAsyncBase)__iresult;";
+ out << nl << "IceInternal.OutgoingAsyncBase.check(__result, this, __" << op->name() << "_name);";
out << nl << "try";
out << sb;