summaryrefslogtreecommitdiff
path: root/cpp/src/qpid/broker/SessionState.cpp
diff options
context:
space:
mode:
authorAndrew Stitcher <astitcher@apache.org>2009-07-30 14:06:49 +0000
committerAndrew Stitcher <astitcher@apache.org>2009-07-30 14:06:49 +0000
commit9c095c4cd694287151cc1fabcc274fd435944dee (patch)
treeaea55b408f4461f86cc2087629e71c21247ab392 /cpp/src/qpid/broker/SessionState.cpp
parent20dfc1f76b845a7d6826f9a27923827fd60ea0e9 (diff)
downloadqpid-python-9c095c4cd694287151cc1fabcc274fd435944dee.tar.gz
Change all broker users of broker::Timer to use sys::Timer
git-svn-id: https://svn.apache.org/repos/asf/qpid/trunk/qpid@799273 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'cpp/src/qpid/broker/SessionState.cpp')
-rw-r--r--cpp/src/qpid/broker/SessionState.cpp17
1 files changed, 8 insertions, 9 deletions
diff --git a/cpp/src/qpid/broker/SessionState.cpp b/cpp/src/qpid/broker/SessionState.cpp
index 1c8e3ffebc..d4e5cfaa67 100644
--- a/cpp/src/qpid/broker/SessionState.cpp
+++ b/cpp/src/qpid/broker/SessionState.cpp
@@ -25,7 +25,7 @@
#include "qpid/broker/SessionManager.h"
#include "qpid/broker/SessionHandler.h"
#include "qpid/broker/RateFlowcontrol.h"
-#include "qpid/broker/Timer.h"
+#include "qpid/sys/Timer.h"
#include "qpid/framing/AMQContentBody.h"
#include "qpid/framing/AMQHeaderBody.h"
#include "qpid/framing/AMQMethodBody.h"
@@ -49,6 +49,7 @@ using qpid::management::ManagementObject;
using qpid::management::Manageable;
using qpid::management::Args;
using qpid::sys::AbsTime;
+//using qpid::sys::Timer;
namespace _qmf = qmf::org::apache::qpid::broker;
SessionState::SessionState(
@@ -206,10 +207,10 @@ void SessionState::handleCommand(framing::AMQMethodBody* method, const SequenceN
}
}
-struct ScheduledCreditTask : public TimerTask {
- Timer& timer;
+struct ScheduledCreditTask : public sys::TimerTask {
+ sys::Timer& timer;
SessionState& sessionState;
- ScheduledCreditTask(const qpid::sys::Duration& d, Timer& t,
+ ScheduledCreditTask(const qpid::sys::Duration& d, sys::Timer& t,
SessionState& s) :
TimerTask(d),
timer(t),
@@ -218,15 +219,13 @@ struct ScheduledCreditTask : public TimerTask {
void fire() {
// This is the best we can currently do to avoid a destruction/fire race
- if (!isCancelled()) {
- sessionState.getConnection().requestIOProcessing(boost::bind(&ScheduledCreditTask::sendCredit, this));
- }
+ sessionState.getConnection().requestIOProcessing(boost::bind(&ScheduledCreditTask::sendCredit, this));
}
void sendCredit() {
if ( !sessionState.processSendCredit(0) ) {
QPID_LOG(warning, sessionState.getId() << ": Reschedule sending credit");
- reset();
+ setupNextFire();
timer.add(this);
}
}
@@ -269,7 +268,7 @@ void SessionState::handleContent(AMQFrame& frame, const SequenceNumber& id)
if (rateFlowcontrol && frame.getBof() && frame.getBos()) {
if ( !processSendCredit(1) ) {
QPID_LOG(debug, getId() << ": Schedule sending credit");
- Timer& timer = getBroker().getTimer();
+ sys::Timer& timer = getBroker().getTimer();
// Use heuristic for scheduled credit of time for 50 messages, but not longer than 500ms
sys::Duration d = std::min(sys::TIME_SEC * 50 / rateFlowcontrol->getRate(), 500 * sys::TIME_MSEC);
flowControlTimer = new ScheduledCreditTask(d, timer, *this);