summaryrefslogtreecommitdiff
path: root/cpp/src
diff options
context:
space:
mode:
authorMatthew Newhook <matthew@zeroc.com>2006-11-14 00:21:06 +0000
committerMatthew Newhook <matthew@zeroc.com>2006-11-14 00:21:06 +0000
commitb902465227fd20c9e9fe30cf251e2611c682f7ce (patch)
tree24055cded291dc6282b16f7fd34d85761b688780 /cpp/src
parentFix (diff)
downloadice-b902465227fd20c9e9fe30cf251e2611c682f7ce.tar.bz2
ice-b902465227fd20c9e9fe30cf251e2611c682f7ce.tar.xz
ice-b902465227fd20c9e9fe30cf251e2611c682f7ce.zip
http://bugzilla.zeroc.com/bugzilla/show_bug.cgi?id=1549
Diffstat (limited to 'cpp/src')
-rw-r--r--cpp/src/IceStorm/Subscriber.cpp17
-rw-r--r--cpp/src/IceStorm/SubscriberPool.cpp8
-rw-r--r--cpp/src/IceStorm/SubscriberPool.h1
3 files changed, 12 insertions, 14 deletions
diff --git a/cpp/src/IceStorm/Subscriber.cpp b/cpp/src/IceStorm/Subscriber.cpp
index fdf1385f5ef..1e93b7d250e 100644
--- a/cpp/src/IceStorm/Subscriber.cpp
+++ b/cpp/src/IceStorm/Subscriber.cpp
@@ -75,9 +75,7 @@ public:
if(state == Subscriber::QueueStateFlush)
{
- list<SubscriberPtr> l;
- l.push_back(_subscriber);
- _instance->subscriberPool()->flush(l);
+ _instance->subscriberPool()->flush(_subscriber);
}
return true;
}
@@ -454,7 +452,6 @@ SubscriberTwowayOrdered::flush()
void
SubscriberTwowayOrdered::response()
{
- EventPtr e;
{
IceUtil::Mutex::Lock sync(_mutex);
@@ -465,12 +462,8 @@ SubscriberTwowayOrdered::response()
_busy = false;
return;
}
-
- e = _events.front();
- _events.erase(_events.begin());
}
-
- _obj->ice_invoke_async(new TwowayOrderedInvokeI(this), e->op, e->mode, e->data, e->context);
+ _instance->subscriberPool()->flush(this);
}
namespace
@@ -614,7 +607,6 @@ SubscriberLink::flush()
void
SubscriberLink::response()
{
- EventSeq v;
{
IceUtil::Mutex::Lock sync(_mutex);
@@ -625,11 +617,8 @@ SubscriberLink::response()
_busy = false;
return;
}
-
- v.swap(_events);
}
-
- _obj->forward_async(new Topiclink_forwardI(this), v);
+ _instance->subscriberPool()->flush(this);
}
SubscriberPtr
diff --git a/cpp/src/IceStorm/SubscriberPool.cpp b/cpp/src/IceStorm/SubscriberPool.cpp
index 26d99dee299..4f1e568583c 100644
--- a/cpp/src/IceStorm/SubscriberPool.cpp
+++ b/cpp/src/IceStorm/SubscriberPool.cpp
@@ -206,6 +206,14 @@ SubscriberPool::flush(list<SubscriberPtr>& subscribers)
}
void
+SubscriberPool::flush(const SubscriberPtr& subscriber)
+{
+ Lock sync(*this);
+ _pending.push_back(subscriber);
+ notify();
+}
+
+void
SubscriberPool::add(const SubscriberPtr& subscriber)
{
Lock sync(*this);
diff --git a/cpp/src/IceStorm/SubscriberPool.h b/cpp/src/IceStorm/SubscriberPool.h
index a498c78e46e..372aa2917a3 100644
--- a/cpp/src/IceStorm/SubscriberPool.h
+++ b/cpp/src/IceStorm/SubscriberPool.h
@@ -63,6 +63,7 @@ public:
~SubscriberPool();
void flush(std::list<SubscriberPtr>&);
+ void flush(const SubscriberPtr&);
void add(const SubscriberPtr&);
void remove(const SubscriberPtr&);
void destroy();