summaryrefslogtreecommitdiff
path: root/qpid/cpp/lib/broker/BrokerMessage.cpp
diff options
context:
space:
mode:
authorGordon Sim <gsim@apache.org>2006-12-05 13:14:38 +0000
committerGordon Sim <gsim@apache.org>2006-12-05 13:14:38 +0000
commit0c3d1cba3cbb8c5656bb2fbc8de393a5801fabdb (patch)
tree05cdf5b65d52e796e4ce5570aa07129bf69b2ca0 /qpid/cpp/lib/broker/BrokerMessage.cpp
parent25e43ff200982d174632fda44a7f20240e758250 (diff)
downloadqpid-python-0c3d1cba3cbb8c5656bb2fbc8de393a5801fabdb.tar.gz
Added queue policy class for controlling when message content should be released from memory.
git-svn-id: https://svn.apache.org/repos/asf/incubator/qpid/trunk@482639 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'qpid/cpp/lib/broker/BrokerMessage.cpp')
-rw-r--r--qpid/cpp/lib/broker/BrokerMessage.cpp6
1 files changed, 6 insertions, 0 deletions
diff --git a/qpid/cpp/lib/broker/BrokerMessage.cpp b/qpid/cpp/lib/broker/BrokerMessage.cpp
index 50bf319797..d30cd12bc3 100644
--- a/qpid/cpp/lib/broker/BrokerMessage.cpp
+++ b/qpid/cpp/lib/broker/BrokerMessage.cpp
@@ -32,6 +32,7 @@
using namespace boost;
using namespace qpid::broker;
using namespace qpid::framing;
+using namespace qpid::sys;
Message::Message(const ConnectionToken* const _publisher,
const string& _exchange, const string& _routingKey,
@@ -100,6 +101,7 @@ void Message::sendContent(OutputHandler* out, int channel, u_int32_t framesize){
AMQBody::shared_ptr headerBody = static_pointer_cast<AMQBody, AMQHeaderBody>(header);
out->send(new AMQFrame(channel, headerBody));
+ Mutex::ScopedLock locker(contentLock);
if (content.get()) content->send(out, channel, framesize);
}
@@ -173,6 +175,7 @@ void Message::encodeHeader(Buffer& buffer)
void Message::encodeContent(Buffer& buffer)
{
+ Mutex::ScopedLock locker(contentLock);
if (content.get()) content->encode(buffer);
}
@@ -183,6 +186,7 @@ u_int32_t Message::encodedSize()
u_int32_t Message::encodedContentSize()
{
+ Mutex::ScopedLock locker(contentLock);
return content.get() ? content->size() : 0;
}
@@ -200,6 +204,7 @@ u_int64_t Message::expectedContentSize()
void Message::releaseContent(MessageStore* store)
{
+ Mutex::ScopedLock locker(contentLock);
if (!content.get() || content->size() > 0) {
//set content to lazy loading mode (but only if there is stored content):
@@ -212,5 +217,6 @@ void Message::releaseContent(MessageStore* store)
void Message::setContent(std::auto_ptr<Content>& _content)
{
+ Mutex::ScopedLock locker(contentLock);
content = _content;
}