summaryrefslogtreecommitdiff
path: root/cpp/src/Ice/RetryQueue.h
diff options
context:
space:
mode:
authorBenoit Foucher <benoit@zeroc.com>2008-10-28 15:37:54 +0100
committerBenoit Foucher <benoit@zeroc.com>2008-10-28 15:37:54 +0100
commit4cf71ddedfbcb89f1f8892c87bc6df68f1086c0e (patch)
tree0eb73fac0730f0a7bb3046e9c3b2cba8a4185654 /cpp/src/Ice/RetryQueue.h
parentLocator improvements to improve scalability when receiving many requests (diff)
downloadice-4cf71ddedfbcb89f1f8892c87bc6df68f1086c0e.tar.bz2
ice-4cf71ddedfbcb89f1f8892c87bc6df68f1086c0e.tar.xz
ice-4cf71ddedfbcb89f1f8892c87bc6df68f1086c0e.zip
Fixed bug 3513 - AMI retry bug
Diffstat (limited to 'cpp/src/Ice/RetryQueue.h')
-rw-r--r--cpp/src/Ice/RetryQueue.h62
1 files changed, 62 insertions, 0 deletions
diff --git a/cpp/src/Ice/RetryQueue.h b/cpp/src/Ice/RetryQueue.h
new file mode 100644
index 00000000000..960b4a8d220
--- /dev/null
+++ b/cpp/src/Ice/RetryQueue.h
@@ -0,0 +1,62 @@
+// **********************************************************************
+//
+// Copyright (c) 2003-2008 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 ICE_RETRY_QUEUE_H
+#define ICE_RETRY_QUEUE_H
+
+#include <IceUtil/Shared.h>
+#include <IceUtil/Mutex.h>
+#include <IceUtil/Timer.h>
+#include <Ice/RetryQueueF.h>
+#include <Ice/OutgoingAsyncF.h>
+#include <Ice/InstanceF.h>
+
+namespace IceInternal
+{
+
+class RetryTask : public IceUtil::TimerTask
+{
+public:
+
+ RetryTask(const RetryQueuePtr&, const OutgoingAsyncPtr&);
+
+ virtual void runTimerTask();
+ void destroy();
+
+ bool operator<(const RetryTask&) const;
+
+private:
+
+ const RetryQueuePtr _queue;
+ const OutgoingAsyncPtr _outAsync;
+};
+typedef IceUtil::Handle<RetryTask> RetryTaskPtr;
+
+class RetryQueue : public IceUtil::Shared, public IceUtil::Mutex
+{
+public:
+
+ RetryQueue(const InstancePtr&);
+
+ void add(const OutgoingAsyncPtr&, int);
+ void destroy();
+
+private:
+
+ bool remove(const RetryTaskPtr&);
+ friend class RetryTask;
+
+ const InstancePtr _instance;
+ std::set<RetryTaskPtr> _requests;
+};
+
+}
+
+#endif
+