You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@qpid.apache.org by sh...@apache.org on 2009/04/23 23:06:39 UTC
svn commit: r768053 [1/3] - in /qpid/branches/cmake/qpid/cpp: ./
rubygen/framing.0-10/ src/ src/qpid/amqp_0_10/ src/qpid/broker/
src/qpid/client/ src/qpid/cluster/ src/qpid/framing/ src/qpid/sys/
src/qpid/sys/windows/ src/tests/ xml/
Author: shuston
Date: Thu Apr 23 21:06:35 2009
New Revision: 768053
URL: http://svn.apache.org/viewvc?rev=768053&view=rev
Log:
Merge in trunk changes from r758432:768028
Added:
qpid/branches/cmake/qpid/cpp/src/qpid/client/Completion.cpp
- copied unchanged from r768033, qpid/trunk/qpid/cpp/src/qpid/client/Completion.cpp
qpid/branches/cmake/qpid/cpp/src/qpid/client/CompletionImpl.h
- copied unchanged from r768033, qpid/trunk/qpid/cpp/src/qpid/client/CompletionImpl.h
qpid/branches/cmake/qpid/cpp/src/qpid/client/MessageImpl.cpp
- copied unchanged from r768033, qpid/trunk/qpid/cpp/src/qpid/client/MessageImpl.cpp
qpid/branches/cmake/qpid/cpp/src/qpid/client/MessageImpl.h
- copied unchanged from r768033, qpid/trunk/qpid/cpp/src/qpid/client/MessageImpl.h
qpid/branches/cmake/qpid/cpp/src/qpid/client/PrivateImpl.h
- copied unchanged from r768033, qpid/trunk/qpid/cpp/src/qpid/client/PrivateImpl.h
qpid/branches/cmake/qpid/cpp/src/qpid/client/PrivateImplPrivate.h
- copied unchanged from r768033, qpid/trunk/qpid/cpp/src/qpid/client/PrivateImplPrivate.h
qpid/branches/cmake/qpid/cpp/src/qpid/cluster/ErrorCheck.cpp
- copied unchanged from r768033, qpid/trunk/qpid/cpp/src/qpid/cluster/ErrorCheck.cpp
qpid/branches/cmake/qpid/cpp/src/qpid/cluster/ErrorCheck.h
- copied unchanged from r768033, qpid/trunk/qpid/cpp/src/qpid/cluster/ErrorCheck.h
qpid/branches/cmake/qpid/cpp/src/tests/ClientMessageTest.cpp
- copied unchanged from r768033, qpid/trunk/qpid/cpp/src/tests/ClientMessageTest.cpp
qpid/branches/cmake/qpid/cpp/src/tests/ClusterFailover.cpp
- copied unchanged from r768033, qpid/trunk/qpid/cpp/src/tests/ClusterFailover.cpp
qpid/branches/cmake/qpid/cpp/src/tests/PartialFailure.cpp
- copied unchanged from r768033, qpid/trunk/qpid/cpp/src/tests/PartialFailure.cpp
qpid/branches/cmake/qpid/cpp/src/tests/PollableCondition.cpp
- copied unchanged from r768033, qpid/trunk/qpid/cpp/src/tests/PollableCondition.cpp
qpid/branches/cmake/qpid/cpp/src/tests/test_store.cpp
- copied unchanged from r768033, qpid/trunk/qpid/cpp/src/tests/test_store.cpp
Removed:
qpid/branches/cmake/qpid/cpp/src/qpid/sys/LatencyMetric.cpp
qpid/branches/cmake/qpid/cpp/src/qpid/sys/LatencyMetric.h
qpid/branches/cmake/qpid/cpp/src/tests/BasicP2PTest.cpp
qpid/branches/cmake/qpid/cpp/src/tests/BasicP2PTest.h
qpid/branches/cmake/qpid/cpp/src/tests/BasicPubSubTest.cpp
qpid/branches/cmake/qpid/cpp/src/tests/BasicPubSubTest.h
qpid/branches/cmake/qpid/cpp/src/tests/SimpleTestCaseBase.cpp
qpid/branches/cmake/qpid/cpp/src/tests/SimpleTestCaseBase.h
qpid/branches/cmake/qpid/cpp/src/tests/TestCase.h
qpid/branches/cmake/qpid/cpp/src/tests/interop_runner.cpp
Modified:
qpid/branches/cmake/qpid/cpp/INSTALL
qpid/branches/cmake/qpid/cpp/rubygen/framing.0-10/Session.rb
qpid/branches/cmake/qpid/cpp/src/Makefile.am
qpid/branches/cmake/qpid/cpp/src/cluster.mk
qpid/branches/cmake/qpid/cpp/src/common.vcproj
qpid/branches/cmake/qpid/cpp/src/qpid/amqp_0_10/SessionHandler.cpp
qpid/branches/cmake/qpid/cpp/src/qpid/amqp_0_10/SessionHandler.h
qpid/branches/cmake/qpid/cpp/src/qpid/broker/Connection.cpp
qpid/branches/cmake/qpid/cpp/src/qpid/broker/Connection.h
qpid/branches/cmake/qpid/cpp/src/qpid/broker/ConnectionHandler.cpp
qpid/branches/cmake/qpid/cpp/src/qpid/broker/ExpiryPolicy.cpp
qpid/branches/cmake/qpid/cpp/src/qpid/broker/ExpiryPolicy.h
qpid/branches/cmake/qpid/cpp/src/qpid/broker/Message.cpp
qpid/branches/cmake/qpid/cpp/src/qpid/broker/SessionHandler.cpp
qpid/branches/cmake/qpid/cpp/src/qpid/broker/SessionHandler.h
qpid/branches/cmake/qpid/cpp/src/qpid/client/Completion.h
qpid/branches/cmake/qpid/cpp/src/qpid/client/Connection.cpp
qpid/branches/cmake/qpid/cpp/src/qpid/client/Connection.h
qpid/branches/cmake/qpid/cpp/src/qpid/client/ConnectionImpl.cpp
qpid/branches/cmake/qpid/cpp/src/qpid/client/Dispatcher.cpp
qpid/branches/cmake/qpid/cpp/src/qpid/client/Dispatcher.h
qpid/branches/cmake/qpid/cpp/src/qpid/client/FailoverListener.cpp
qpid/branches/cmake/qpid/cpp/src/qpid/client/FailoverListener.h
qpid/branches/cmake/qpid/cpp/src/qpid/client/Future.cpp
qpid/branches/cmake/qpid/cpp/src/qpid/client/Future.h
qpid/branches/cmake/qpid/cpp/src/qpid/client/Handle.h
qpid/branches/cmake/qpid/cpp/src/qpid/client/HandlePrivate.h
qpid/branches/cmake/qpid/cpp/src/qpid/client/LocalQueue.cpp
qpid/branches/cmake/qpid/cpp/src/qpid/client/Message.cpp
qpid/branches/cmake/qpid/cpp/src/qpid/client/Message.h
qpid/branches/cmake/qpid/cpp/src/qpid/client/SessionBase_0_10.cpp
qpid/branches/cmake/qpid/cpp/src/qpid/client/SessionBase_0_10.h
qpid/branches/cmake/qpid/cpp/src/qpid/client/Subscription.cpp
qpid/branches/cmake/qpid/cpp/src/qpid/client/SubscriptionImpl.cpp
qpid/branches/cmake/qpid/cpp/src/qpid/client/TypedResult.h
qpid/branches/cmake/qpid/cpp/src/qpid/cluster/Cluster.cpp
qpid/branches/cmake/qpid/cpp/src/qpid/cluster/Cluster.h
qpid/branches/cmake/qpid/cpp/src/qpid/cluster/ClusterMap.cpp
qpid/branches/cmake/qpid/cpp/src/qpid/cluster/ClusterMap.h
qpid/branches/cmake/qpid/cpp/src/qpid/cluster/Connection.cpp
qpid/branches/cmake/qpid/cpp/src/qpid/cluster/Connection.h
qpid/branches/cmake/qpid/cpp/src/qpid/cluster/Cpg.cpp
qpid/branches/cmake/qpid/cpp/src/qpid/cluster/Event.h
qpid/branches/cmake/qpid/cpp/src/qpid/cluster/EventFrame.cpp
qpid/branches/cmake/qpid/cpp/src/qpid/cluster/EventFrame.h
qpid/branches/cmake/qpid/cpp/src/qpid/cluster/ExpiryPolicy.cpp
qpid/branches/cmake/qpid/cpp/src/qpid/cluster/ExpiryPolicy.h
qpid/branches/cmake/qpid/cpp/src/qpid/cluster/LockedConnectionMap.h
qpid/branches/cmake/qpid/cpp/src/qpid/cluster/Multicaster.cpp
qpid/branches/cmake/qpid/cpp/src/qpid/cluster/Multicaster.h
qpid/branches/cmake/qpid/cpp/src/qpid/cluster/NoOpConnectionOutputHandler.h
qpid/branches/cmake/qpid/cpp/src/qpid/cluster/OutputInterceptor.cpp
qpid/branches/cmake/qpid/cpp/src/qpid/cluster/OutputInterceptor.h
qpid/branches/cmake/qpid/cpp/src/qpid/cluster/UpdateClient.cpp
qpid/branches/cmake/qpid/cpp/src/qpid/cluster/UpdateClient.h
qpid/branches/cmake/qpid/cpp/src/qpid/framing/AMQFrame.h
qpid/branches/cmake/qpid/cpp/src/qpid/sys/windows/IoHandlePrivate.h
qpid/branches/cmake/qpid/cpp/src/tests/AsyncCompletion.cpp
qpid/branches/cmake/qpid/cpp/src/tests/BrokerFixture.h
qpid/branches/cmake/qpid/cpp/src/tests/ClientSessionTest.cpp
qpid/branches/cmake/qpid/cpp/src/tests/ClusterFixture.cpp
qpid/branches/cmake/qpid/cpp/src/tests/ClusterFixture.h
qpid/branches/cmake/qpid/cpp/src/tests/ForkedBroker.cpp
qpid/branches/cmake/qpid/cpp/src/tests/ForkedBroker.h
qpid/branches/cmake/qpid/cpp/src/tests/Makefile.am
qpid/branches/cmake/qpid/cpp/src/tests/SocketProxy.h
qpid/branches/cmake/qpid/cpp/src/tests/XmlClientSessionTest.cpp
qpid/branches/cmake/qpid/cpp/src/tests/client_test.cpp
qpid/branches/cmake/qpid/cpp/src/tests/client_test.vcproj
qpid/branches/cmake/qpid/cpp/src/tests/cluster.mk
qpid/branches/cmake/qpid/cpp/src/tests/cluster_test.cpp
qpid/branches/cmake/qpid/cpp/src/tests/clustered_replication_test
qpid/branches/cmake/qpid/cpp/src/tests/consume.vcproj
qpid/branches/cmake/qpid/cpp/src/tests/declare_queues.cpp
qpid/branches/cmake/qpid/cpp/src/tests/echotest.vcproj
qpid/branches/cmake/qpid/cpp/src/tests/failover_soak.cpp
qpid/branches/cmake/qpid/cpp/src/tests/header_test.vcproj
qpid/branches/cmake/qpid/cpp/src/tests/latencytest.vcproj
qpid/branches/cmake/qpid/cpp/src/tests/perftest.vcproj
qpid/branches/cmake/qpid/cpp/src/tests/publish.vcproj
qpid/branches/cmake/qpid/cpp/src/tests/receiver.vcproj
qpid/branches/cmake/qpid/cpp/src/tests/replaying_sender.cpp
qpid/branches/cmake/qpid/cpp/src/tests/run_failover_soak
qpid/branches/cmake/qpid/cpp/src/tests/sender.vcproj
qpid/branches/cmake/qpid/cpp/src/tests/shlibtest.vcproj
qpid/branches/cmake/qpid/cpp/src/tests/start_cluster
qpid/branches/cmake/qpid/cpp/src/tests/tests.sln
qpid/branches/cmake/qpid/cpp/src/tests/topic_listener.vcproj
qpid/branches/cmake/qpid/cpp/src/tests/topic_publisher.vcproj
qpid/branches/cmake/qpid/cpp/src/tests/txjob.vcproj
qpid/branches/cmake/qpid/cpp/src/tests/txshift.vcproj
qpid/branches/cmake/qpid/cpp/src/tests/txtest.vcproj
qpid/branches/cmake/qpid/cpp/src/tests/unit_test.vcproj
qpid/branches/cmake/qpid/cpp/xml/cluster.xml
Modified: qpid/branches/cmake/qpid/cpp/INSTALL
URL: http://svn.apache.org/viewvc/qpid/branches/cmake/qpid/cpp/INSTALL?rev=768053&r1=768052&r2=768053&view=diff
==============================================================================
--- qpid/branches/cmake/qpid/cpp/INSTALL (original)
+++ qpid/branches/cmake/qpid/cpp/INSTALL Thu Apr 23 21:06:35 2009
@@ -104,6 +104,9 @@
For SASL and SSL, include
# yum install cyrus-sasl-devel
+For the XML Exchange, include:
+
+ # yum install xqilla-devel xerces-c-devel
Follow the manual installation instruction below for any packages not
available through your distributions packaging tool.
Modified: qpid/branches/cmake/qpid/cpp/rubygen/framing.0-10/Session.rb
URL: http://svn.apache.org/viewvc/qpid/branches/cmake/qpid/cpp/rubygen/framing.0-10/Session.rb?rev=768053&r1=768052&r2=768053&view=diff
==============================================================================
--- qpid/branches/cmake/qpid/cpp/rubygen/framing.0-10/Session.rb (original)
+++ qpid/branches/cmake/qpid/cpp/rubygen/framing.0-10/Session.rb Thu Apr 23 21:06:35 2009
@@ -77,9 +77,9 @@
class ContentField # For extra content parameters
def cppname() "content" end
- def signature() "const MethodContent& content" end
- def sig_default() signature+"="+"DefaultContent(std::string())" end
- def unpack() "p[arg::content|DefaultContent(std::string())]"; end
+ def signature() "const Message& content" end
+ def sig_default() signature+"="+"Message(std::string())" end
+ def unpack() "p[arg::content|Message(std::string())]"; end
def doc() "Message content"; end
end
@@ -160,6 +160,10 @@
cpp_file(@file) {
include @classname
include "qpid/framing/all_method_bodies.h"
+ include "qpid/client/SessionImpl.h"
+ include "qpid/client/MessageImpl.h"
+ include "qpid/client/PrivateImplPrivate.h"
+ include "qpid/client/CompletionImpl.h"
namespace(@namespace) {
genl "using namespace framing;"
session_methods(sync_default).each { |m|
@@ -171,8 +175,8 @@
genl "#{m.body_name} body(#{args});";
genl "body.setSync(sync);"
sendargs="body"
- sendargs << ", content" if m.content
- async_retval="#{m.return_type(true)}(impl->send(#{sendargs}), impl)"
+ sendargs << ", *privateImplGetPtr(content)" if m.content
+ async_retval="#{m.return_type(true)}(new CompletionImpl(impl->send(#{sendargs}), impl))"
if @async then
genl "return #{async_retval};"
else
Modified: qpid/branches/cmake/qpid/cpp/src/Makefile.am
URL: http://svn.apache.org/viewvc/qpid/branches/cmake/qpid/cpp/src/Makefile.am?rev=768053&r1=768052&r2=768053&view=diff
==============================================================================
--- qpid/branches/cmake/qpid/cpp/src/Makefile.am (original)
+++ qpid/branches/cmake/qpid/cpp/src/Makefile.am Thu Apr 23 21:06:35 2009
@@ -343,7 +343,6 @@
qpid/sys/AsynchIOHandler.cpp \
qpid/sys/Dispatcher.cpp \
qpid/sys/DispatchHandle.cpp \
- qpid/sys/LatencyMetric.cpp \
qpid/sys/Runnable.cpp \
qpid/sys/Shlib.cpp \
qpid/sys/Timer.cpp
@@ -437,21 +436,26 @@
qpid/client/Bounds.cpp \
qpid/client/Connection.cpp \
qpid/client/ConnectionHandler.cpp \
- qpid/client/ConnectionImpl.cpp \
+ qpid/client/ConnectionImpl.cpp \
qpid/client/ConnectionSettings.cpp \
- qpid/client/Connector.cpp \
+ qpid/client/Connector.cpp \
qpid/client/Demux.cpp \
qpid/client/Dispatcher.cpp \
- qpid/client/FailoverManager.cpp \
+ qpid/client/FailoverManager.cpp \
qpid/client/FailoverListener.h \
qpid/client/FailoverListener.cpp \
qpid/client/Future.cpp \
qpid/client/FutureCompletion.cpp \
+ qpid/client/Completion.cpp \
+ qpid/client/CompletionImpl.h \
qpid/client/FutureResult.cpp \
qpid/client/HandlePrivate.h \
+ qpid/client/PrivateImplPrivate.h \
qpid/client/LoadPlugins.cpp \
qpid/client/LocalQueue.cpp \
qpid/client/Message.cpp \
+ qpid/client/MessageImpl.cpp \
+ qpid/client/MessageImpl.h \
qpid/client/MessageListener.cpp \
qpid/client/MessageReplayTracker.cpp \
qpid/client/QueueOptions.cpp \
@@ -597,6 +601,7 @@
qpid/client/FutureCompletion.h \
qpid/client/FutureResult.h \
qpid/client/Handle.h \
+ qpid/client/PrivateImpl.h \
qpid/client/LocalQueue.h \
qpid/client/QueueOptions.h \
qpid/client/Message.h \
@@ -697,7 +702,6 @@
qpid/sys/FileSysDir.h \
qpid/sys/IntegerTypes.h \
qpid/sys/IOHandle.h \
- qpid/sys/LatencyMetric.h \
qpid/sys/LockFile.h \
qpid/sys/LockPtr.h \
qpid/sys/Monitor.h \
Modified: qpid/branches/cmake/qpid/cpp/src/cluster.mk
URL: http://svn.apache.org/viewvc/qpid/branches/cmake/qpid/cpp/src/cluster.mk?rev=768053&r1=768052&r2=768053&view=diff
==============================================================================
--- qpid/branches/cmake/qpid/cpp/src/cluster.mk (original)
+++ qpid/branches/cmake/qpid/cpp/src/cluster.mk Thu Apr 23 21:06:35 2009
@@ -56,6 +56,8 @@
qpid/cluster/Dispatchable.h \
qpid/cluster/UpdateClient.cpp \
qpid/cluster/UpdateClient.h \
+ qpid/cluster/ErrorCheck.cpp \
+ qpid/cluster/ErrorCheck.h \
qpid/cluster/Event.cpp \
qpid/cluster/Event.h \
qpid/cluster/EventFrame.h \
Modified: qpid/branches/cmake/qpid/cpp/src/common.vcproj
URL: http://svn.apache.org/viewvc/qpid/branches/cmake/qpid/cpp/src/common.vcproj?rev=768053&r1=768052&r2=768053&view=diff
==============================================================================
--- qpid/branches/cmake/qpid/cpp/src/common.vcproj (original)
+++ qpid/branches/cmake/qpid/cpp/src/common.vcproj Thu Apr 23 21:06:35 2009
@@ -456,6 +456,9 @@
RelativePath="gen\qpid\framing\ClusterConnectionTxStartBody.cpp">
</File>
<File
+ RelativePath="gen\qpid\framing\ClusterErrorCheckBody.cpp">
+ </File>
+ <File
RelativePath="gen\qpid\framing\ClusterMessageExpiredBody.cpp">
</File>
<File
@@ -972,9 +975,6 @@
RelativePath="qpid\sys\Dispatcher.cpp">
</File>
<File
- RelativePath="qpid\sys\LatencyMetric.cpp">
- </File>
- <File
RelativePath="qpid\sys\Runnable.cpp">
</File>
<File
@@ -1165,6 +1165,9 @@
RelativePath="gen\qpid\framing\ClusterConnectionTxStartBody.h">
</File>
<File
+ RelativePath="gen\qpid\framing\ClusterErrorCheckBody.h">
+ </File>
+ <File
RelativePath="gen\qpid\framing\ClusterMessageExpiredBody.h">
</File>
<File
@@ -1810,9 +1813,6 @@
RelativePath="qpid\sys\IOHandle.h">
</File>
<File
- RelativePath="qpid\sys\LatencyMetric.h">
- </File>
- <File
RelativePath="qpid\sys\LockFile.h">
</File>
<File
Modified: qpid/branches/cmake/qpid/cpp/src/qpid/amqp_0_10/SessionHandler.cpp
URL: http://svn.apache.org/viewvc/qpid/branches/cmake/qpid/cpp/src/qpid/amqp_0_10/SessionHandler.cpp?rev=768053&r1=768052&r2=768053&view=diff
==============================================================================
--- qpid/branches/cmake/qpid/cpp/src/qpid/amqp_0_10/SessionHandler.cpp (original)
+++ qpid/branches/cmake/qpid/cpp/src/qpid/amqp_0_10/SessionHandler.cpp Thu Apr 23 21:06:35 2009
@@ -88,6 +88,7 @@
}
catch(const SessionException& e) {
QPID_LOG(error, "Execution exception: " << e.what());
+ executionException(e.code, e.what()); // Let subclass handle this first.
framing::AMQP_AllProxy::Execution execution(channel);
AMQMethodBody* m = f.getMethod();
SequenceNumber commandId;
@@ -98,6 +99,7 @@
}
catch(const ChannelException& e){
QPID_LOG(error, "Channel exception: " << e.what());
+ channelException(e.code, e.what()); // Let subclass handle this first.
peer.detached(name, e.code);
}
catch(const ConnectionException& e) {
Modified: qpid/branches/cmake/qpid/cpp/src/qpid/amqp_0_10/SessionHandler.h
URL: http://svn.apache.org/viewvc/qpid/branches/cmake/qpid/cpp/src/qpid/amqp_0_10/SessionHandler.h?rev=768053&r1=768052&r2=768053&view=diff
==============================================================================
--- qpid/branches/cmake/qpid/cpp/src/qpid/amqp_0_10/SessionHandler.h (original)
+++ qpid/branches/cmake/qpid/cpp/src/qpid/amqp_0_10/SessionHandler.h Thu Apr 23 21:06:35 2009
@@ -87,8 +87,9 @@
QPID_COMMON_EXTERN virtual void invoke(const framing::AMQMethodBody& m);
virtual void setState(const std::string& sessionName, bool force) = 0;
- virtual void channelException(framing::session::DetachCode code, const std::string& msg) = 0;
virtual void connectionException(framing::connection::CloseCode code, const std::string& msg) = 0;
+ virtual void channelException(framing::session::DetachCode, const std::string& msg) = 0;
+ virtual void executionException(framing::execution::ErrorCode, const std::string& msg) = 0;
virtual void detaching() = 0;
// Notification of events
Modified: qpid/branches/cmake/qpid/cpp/src/qpid/broker/Connection.cpp
URL: http://svn.apache.org/viewvc/qpid/branches/cmake/qpid/cpp/src/qpid/broker/Connection.cpp?rev=768053&r1=768052&r2=768053&view=diff
==============================================================================
--- qpid/branches/cmake/qpid/cpp/src/qpid/broker/Connection.cpp (original)
+++ qpid/branches/cmake/qpid/cpp/src/qpid/broker/Connection.cpp Thu Apr 23 21:06:35 2009
@@ -57,7 +57,8 @@
mgmtObject(0),
links(broker_.getLinks()),
agent(0),
- timer(broker_.getTimer())
+ timer(broker_.getTimer()),
+ errorListener(0)
{
Manageable* parent = broker.GetVhostObject();
Modified: qpid/branches/cmake/qpid/cpp/src/qpid/broker/Connection.h
URL: http://svn.apache.org/viewvc/qpid/branches/cmake/qpid/cpp/src/qpid/broker/Connection.h?rev=768053&r1=768052&r2=768053&view=diff
==============================================================================
--- qpid/branches/cmake/qpid/cpp/src/qpid/broker/Connection.h (original)
+++ qpid/branches/cmake/qpid/cpp/src/qpid/broker/Connection.h Thu Apr 23 21:06:35 2009
@@ -66,6 +66,17 @@
public RefCounted
{
public:
+ /**
+ * Listener that can be registered with a Connection to be informed of errors.
+ */
+ class ErrorListener
+ {
+ public:
+ virtual ~ErrorListener() {}
+ virtual void sessionError(uint16_t channel, const std::string&) = 0;
+ virtual void connectionError(const std::string&) = 0;
+ };
+
Connection(sys::ConnectionOutputHandler* out, Broker& broker, const std::string& mgmtId, bool isLink = false, uint64_t objectId = 0);
~Connection ();
@@ -101,6 +112,9 @@
const std::string& getMgmtId() const { return mgmtId; }
management::ManagementAgent* getAgent() const { return agent; }
void setFederationLink(bool b);
+ /** Connection does not delete the listener. 0 resets. */
+ void setErrorListener(ErrorListener* l) { errorListener=l; }
+ ErrorListener* getErrorListener() { return errorListener; }
void setHeartbeatInterval(uint16_t heartbeat);
void sendHeartbeat();
@@ -112,6 +126,7 @@
void sendClose();
void setSecureConnection(SecureConnection* secured);
+
private:
typedef boost::ptr_map<framing::ChannelId, SessionHandler> ChannelMap;
typedef std::vector<Queue::shared_ptr>::iterator queue_iterator;
@@ -128,6 +143,8 @@
management::ManagementAgent* agent;
Timer& timer;
boost::intrusive_ptr<TimerTask> heartbeatTimer;
+ ErrorListener* errorListener;
+
public:
qmf::org::apache::qpid::broker::Connection* getMgmtObject() { return mgmtObject; }
};
Modified: qpid/branches/cmake/qpid/cpp/src/qpid/broker/ConnectionHandler.cpp
URL: http://svn.apache.org/viewvc/qpid/branches/cmake/qpid/cpp/src/qpid/broker/ConnectionHandler.cpp?rev=768053&r1=768052&r2=768053&view=diff
==============================================================================
--- qpid/branches/cmake/qpid/cpp/src/qpid/broker/ConnectionHandler.cpp (original)
+++ qpid/branches/cmake/qpid/cpp/src/qpid/broker/ConnectionHandler.cpp Thu Apr 23 21:06:35 2009
@@ -64,13 +64,16 @@
void ConnectionHandler::handle(framing::AMQFrame& frame)
{
AMQMethodBody* method=frame.getBody()->getMethod();
+ Connection::ErrorListener* errorListener = handler->connection.getErrorListener();
try{
if (!invoke(static_cast<AMQP_AllOperations::ConnectionHandler&>(*handler.get()), *method)) {
handler->connection.getChannel(frame.getChannel()).in(frame);
}
}catch(ConnectionException& e){
+ if (errorListener) errorListener->connectionError(e.what());
handler->proxy.close(e.code, e.what());
}catch(std::exception& e){
+ if (errorListener) errorListener->connectionError(e.what());
handler->proxy.close(541/*internal error*/, e.what());
}
}
Modified: qpid/branches/cmake/qpid/cpp/src/qpid/broker/ExpiryPolicy.cpp
URL: http://svn.apache.org/viewvc/qpid/branches/cmake/qpid/cpp/src/qpid/broker/ExpiryPolicy.cpp?rev=768053&r1=768052&r2=768053&view=diff
==============================================================================
--- qpid/branches/cmake/qpid/cpp/src/qpid/broker/ExpiryPolicy.cpp (original)
+++ qpid/branches/cmake/qpid/cpp/src/qpid/broker/ExpiryPolicy.cpp Thu Apr 23 21:06:35 2009
@@ -33,4 +33,6 @@
return m.getExpiration() < sys::AbsTime::now();
}
+void ExpiryPolicy::forget(Message&) {}
+
}} // namespace qpid::broker
Modified: qpid/branches/cmake/qpid/cpp/src/qpid/broker/ExpiryPolicy.h
URL: http://svn.apache.org/viewvc/qpid/branches/cmake/qpid/cpp/src/qpid/broker/ExpiryPolicy.h?rev=768053&r1=768052&r2=768053&view=diff
==============================================================================
--- qpid/branches/cmake/qpid/cpp/src/qpid/broker/ExpiryPolicy.h (original)
+++ qpid/branches/cmake/qpid/cpp/src/qpid/broker/ExpiryPolicy.h Thu Apr 23 21:06:35 2009
@@ -39,6 +39,7 @@
QPID_BROKER_EXTERN virtual ~ExpiryPolicy();
QPID_BROKER_EXTERN virtual void willExpire(Message&);
QPID_BROKER_EXTERN virtual bool hasExpired(Message&);
+ QPID_BROKER_EXTERN virtual void forget(Message&);
};
}} // namespace qpid::broker
Modified: qpid/branches/cmake/qpid/cpp/src/qpid/broker/Message.cpp
URL: http://svn.apache.org/viewvc/qpid/branches/cmake/qpid/cpp/src/qpid/broker/Message.cpp?rev=768053&r1=768052&r2=768053&view=diff
==============================================================================
--- qpid/branches/cmake/qpid/cpp/src/qpid/broker/Message.cpp (original)
+++ qpid/branches/cmake/qpid/cpp/src/qpid/broker/Message.cpp Thu Apr 23 21:06:35 2009
@@ -53,6 +53,8 @@
Message::~Message()
{
+ if (expiryPolicy)
+ expiryPolicy->forget(*this);
}
void Message::forcePersistent()
@@ -334,7 +336,7 @@
void Message::setExpiryPolicy(const boost::intrusive_ptr<ExpiryPolicy>& e) {
expiryPolicy = e;
- if (expiryPolicy)
+ if (expiryPolicy)
expiryPolicy->willExpire(*this);
}
Modified: qpid/branches/cmake/qpid/cpp/src/qpid/broker/SessionHandler.cpp
URL: http://svn.apache.org/viewvc/qpid/branches/cmake/qpid/cpp/src/qpid/broker/SessionHandler.cpp?rev=768053&r1=768052&r2=768053&view=diff
==============================================================================
--- qpid/branches/cmake/qpid/cpp/src/qpid/broker/SessionHandler.cpp (original)
+++ qpid/branches/cmake/qpid/cpp/src/qpid/broker/SessionHandler.cpp Thu Apr 23 21:06:35 2009
@@ -45,14 +45,20 @@
MethodId methodId(AMQMethodBody* m) { return m ? m->amqpClassId() : 0; }
} // namespace
-void SessionHandler::channelException(framing::session::DetachCode, const std::string&) {
- handleDetach();
-}
-
void SessionHandler::connectionException(framing::connection::CloseCode code, const std::string& msg) {
+ // NOTE: must tell the error listener _before_ calling connection.close()
+ if (connection.getErrorListener()) connection.getErrorListener()->connectionError(msg);
connection.close(code, msg);
}
+void SessionHandler::channelException(framing::session::DetachCode, const std::string& msg) {
+ if (connection.getErrorListener()) connection.getErrorListener()->sessionError(getChannel(), msg);
+}
+
+void SessionHandler::executionException(framing::execution::ErrorCode, const std::string& msg) {
+ if (connection.getErrorListener()) connection.getErrorListener()->sessionError(getChannel(), msg);
+}
+
ConnectionState& SessionHandler::getConnection() { return connection; }
const ConnectionState& SessionHandler::getConnection() const { return connection; }
Modified: qpid/branches/cmake/qpid/cpp/src/qpid/broker/SessionHandler.h
URL: http://svn.apache.org/viewvc/qpid/branches/cmake/qpid/cpp/src/qpid/broker/SessionHandler.h?rev=768053&r1=768052&r2=768053&view=diff
==============================================================================
--- qpid/branches/cmake/qpid/cpp/src/qpid/broker/SessionHandler.h (original)
+++ qpid/branches/cmake/qpid/cpp/src/qpid/broker/SessionHandler.h Thu Apr 23 21:06:35 2009
@@ -73,8 +73,9 @@
virtual void setState(const std::string& sessionName, bool force);
virtual qpid::SessionState* getState();
virtual framing::FrameHandler* getInHandler();
- virtual void channelException(framing::session::DetachCode code, const std::string& msg);
virtual void connectionException(framing::connection::CloseCode code, const std::string& msg);
+ virtual void channelException(framing::session::DetachCode, const std::string& msg);
+ virtual void executionException(framing::execution::ErrorCode, const std::string& msg);
virtual void detaching();
virtual void readyToSend();
Modified: qpid/branches/cmake/qpid/cpp/src/qpid/client/Completion.h
URL: http://svn.apache.org/viewvc/qpid/branches/cmake/qpid/cpp/src/qpid/client/Completion.h?rev=768053&r1=768052&r2=768053&view=diff
==============================================================================
--- qpid/branches/cmake/qpid/cpp/src/qpid/client/Completion.h (original)
+++ qpid/branches/cmake/qpid/cpp/src/qpid/client/Completion.h Thu Apr 23 21:06:35 2009
@@ -22,13 +22,14 @@
#ifndef _Completion_
#define _Completion_
-#include <boost/shared_ptr.hpp>
-#include "Future.h"
-#include "SessionImpl.h"
+#include "Handle.h"
+#include <string>
namespace qpid {
namespace client {
+class CompletionImpl;
+
/**
* Asynchronous commands that do not return a result will return a
* Completion. You can use the completion to wait for that specific
@@ -38,32 +39,26 @@
*
*\ingroup clientapi
*/
-class Completion
+class Completion : public Handle<CompletionImpl>
{
-protected:
- Future future;
- shared_ptr<SessionImpl> session;
-
public:
///@internal
- Completion() {}
-
- ///@internal
- Completion(Future f, shared_ptr<SessionImpl> s) : future(f), session(s) {}
+ QPID_CLIENT_EXTERN Completion(CompletionImpl* =0);
+ QPID_CLIENT_EXTERN ~Completion();
+ QPID_CLIENT_EXTERN Completion(const Completion&);
+ QPID_CLIENT_EXTERN Completion& operator=(const Completion&);
/** Wait for the asynchronous command that returned this
*Completion to complete.
*
- *@exception If the command returns an error, get() throws an exception.
+ *@exception If the command returns an error.
*/
- void wait()
- {
- future.wait(*session);
- }
-
- bool isComplete() {
- return future.isComplete(*session);
- }
+ QPID_CLIENT_EXTERN void wait();
+
+ QPID_CLIENT_EXTERN bool isComplete();
+
+ protected:
+ QPID_CLIENT_EXTERN std::string getResult();
};
}}
Modified: qpid/branches/cmake/qpid/cpp/src/qpid/client/Connection.cpp
URL: http://svn.apache.org/viewvc/qpid/branches/cmake/qpid/cpp/src/qpid/client/Connection.cpp?rev=768053&r1=768052&r2=768053&view=diff
==============================================================================
--- qpid/branches/cmake/qpid/cpp/src/qpid/client/Connection.cpp (original)
+++ qpid/branches/cmake/qpid/cpp/src/qpid/client/Connection.cpp Thu Apr 23 21:06:35 2009
@@ -19,6 +19,7 @@
*
*/
#include "Connection.h"
+#include "ConnectionImpl.h"
#include "ConnectionSettings.h"
#include "Message.h"
#include "SessionImpl.h"
Modified: qpid/branches/cmake/qpid/cpp/src/qpid/client/Connection.h
URL: http://svn.apache.org/viewvc/qpid/branches/cmake/qpid/cpp/src/qpid/client/Connection.h?rev=768053&r1=768052&r2=768053&view=diff
==============================================================================
--- qpid/branches/cmake/qpid/cpp/src/qpid/client/Connection.h (original)
+++ qpid/branches/cmake/qpid/cpp/src/qpid/client/Connection.h Thu Apr 23 21:06:35 2009
@@ -25,6 +25,7 @@
#include <string>
#include "qpid/client/Session.h"
#include "qpid/client/ClientImportExport.h"
+#include "qpid/client/ConnectionSettings.h"
namespace qpid {
@@ -32,7 +33,6 @@
namespace client {
-struct ConnectionSettings;
class ConnectionImpl;
/**
Modified: qpid/branches/cmake/qpid/cpp/src/qpid/client/ConnectionImpl.cpp
URL: http://svn.apache.org/viewvc/qpid/branches/cmake/qpid/cpp/src/qpid/client/ConnectionImpl.cpp?rev=768053&r1=768052&r2=768053&view=diff
==============================================================================
--- qpid/branches/cmake/qpid/cpp/src/qpid/client/ConnectionImpl.cpp (original)
+++ qpid/branches/cmake/qpid/cpp/src/qpid/client/ConnectionImpl.cpp Thu Apr 23 21:06:35 2009
@@ -111,9 +111,11 @@
Mutex::ScopedLock l(lock);
s = sessions[frame.getChannel()].lock();
}
- if (!s)
- throw NotAttachedException(QPID_MSG("Invalid channel: " << frame.getChannel()));
- s->in(frame);
+ if (!s) {
+ QPID_LOG(info, "Dropping frame received on invalid channel: " << frame);
+ } else {
+ s->in(frame);
+ }
}
bool ConnectionImpl::isOpen() const
Modified: qpid/branches/cmake/qpid/cpp/src/qpid/client/Dispatcher.cpp
URL: http://svn.apache.org/viewvc/qpid/branches/cmake/qpid/cpp/src/qpid/client/Dispatcher.cpp?rev=768053&r1=768052&r2=768053&view=diff
==============================================================================
--- qpid/branches/cmake/qpid/cpp/src/qpid/client/Dispatcher.cpp (original)
+++ qpid/branches/cmake/qpid/cpp/src/qpid/client/Dispatcher.cpp Thu Apr 23 21:06:35 2009
@@ -26,6 +26,7 @@
#include "qpid/log/Statement.h"
#include "qpid/sys/BlockingQueue.h"
#include "Message.h"
+#include "MessageImpl.h"
#include <boost/state_saver.hpp>
@@ -49,6 +50,9 @@
session.getExecution().getDemux().get(q);
}
+Dispatcher::~Dispatcher() {}
+
+
void Dispatcher::start()
{
worker = Thread(this);
@@ -71,7 +75,7 @@
Mutex::ScopedUnlock u(lock);
FrameSet::shared_ptr content = queue->pop();
if (content->isA<MessageTransferBody>()) {
- Message msg(*content);
+ Message msg(new MessageImpl(*content));
boost::intrusive_ptr<SubscriptionImpl> listener = find(msg.getDestination());
if (!listener) {
QPID_LOG(error, "No listener found for destination " << msg.getDestination());
Modified: qpid/branches/cmake/qpid/cpp/src/qpid/client/Dispatcher.h
URL: http://svn.apache.org/viewvc/qpid/branches/cmake/qpid/cpp/src/qpid/client/Dispatcher.h?rev=768053&r1=768052&r2=768053&view=diff
==============================================================================
--- qpid/branches/cmake/qpid/cpp/src/qpid/client/Dispatcher.h (original)
+++ qpid/branches/cmake/qpid/cpp/src/qpid/client/Dispatcher.h Thu Apr 23 21:06:35 2009
@@ -30,7 +30,6 @@
#include "qpid/sys/Runnable.h"
#include "qpid/sys/Thread.h"
#include "MessageListener.h"
-#include "SubscriptionImpl.h"
namespace qpid {
namespace client {
@@ -61,6 +60,7 @@
public:
Dispatcher(const Session& session, const std::string& queue = "");
+ ~Dispatcher();
void start();
void wait();
Modified: qpid/branches/cmake/qpid/cpp/src/qpid/client/FailoverListener.cpp
URL: http://svn.apache.org/viewvc/qpid/branches/cmake/qpid/cpp/src/qpid/client/FailoverListener.cpp?rev=768053&r1=768052&r2=768053&view=diff
==============================================================================
--- qpid/branches/cmake/qpid/cpp/src/qpid/client/FailoverListener.cpp (original)
+++ qpid/branches/cmake/qpid/cpp/src/qpid/client/FailoverListener.cpp Thu Apr 23 21:06:35 2009
@@ -20,6 +20,9 @@
*/
#include "FailoverListener.h"
#include "SessionBase_0_10Access.h"
+#include "qpid/client/SessionImpl.h"
+#include "qpid/client/ConnectionImpl.h"
+#include "qpid/client/SubscriptionImpl.h"
#include "qpid/client/SubscriptionManager.h"
#include "qpid/framing/Uuid.h"
#include "qpid/log/Statement.h"
Modified: qpid/branches/cmake/qpid/cpp/src/qpid/client/FailoverListener.h
URL: http://svn.apache.org/viewvc/qpid/branches/cmake/qpid/cpp/src/qpid/client/FailoverListener.h?rev=768053&r1=768052&r2=768053&view=diff
==============================================================================
--- qpid/branches/cmake/qpid/cpp/src/qpid/client/FailoverListener.h (original)
+++ qpid/branches/cmake/qpid/cpp/src/qpid/client/FailoverListener.h Thu Apr 23 21:06:35 2009
@@ -33,6 +33,7 @@
namespace client {
class SubscriptionManager;
+class ConnectionImpl;
/**
* @internal Listen for failover updates from the amq.failover exchange.
Modified: qpid/branches/cmake/qpid/cpp/src/qpid/client/Future.cpp
URL: http://svn.apache.org/viewvc/qpid/branches/cmake/qpid/cpp/src/qpid/client/Future.cpp?rev=768053&r1=768052&r2=768053&view=diff
==============================================================================
--- qpid/branches/cmake/qpid/cpp/src/qpid/client/Future.cpp (original)
+++ qpid/branches/cmake/qpid/cpp/src/qpid/client/Future.cpp Thu Apr 23 21:06:35 2009
@@ -20,6 +20,7 @@
*/
#include "Future.h"
+#include "SessionImpl.h"
namespace qpid {
namespace client {
Modified: qpid/branches/cmake/qpid/cpp/src/qpid/client/Future.h
URL: http://svn.apache.org/viewvc/qpid/branches/cmake/qpid/cpp/src/qpid/client/Future.h?rev=768053&r1=768052&r2=768053&view=diff
==============================================================================
--- qpid/branches/cmake/qpid/cpp/src/qpid/client/Future.h (original)
+++ qpid/branches/cmake/qpid/cpp/src/qpid/client/Future.h Thu Apr 23 21:06:35 2009
@@ -26,17 +26,15 @@
#include <boost/shared_ptr.hpp>
#include "qpid/Exception.h"
#include "qpid/framing/SequenceNumber.h"
-#include "qpid/framing/StructHelper.h"
#include "FutureCompletion.h"
#include "FutureResult.h"
-#include "SessionImpl.h"
#include "ClientImportExport.h"
namespace qpid {
namespace client {
/**@internal */
-class Future : private framing::StructHelper
+class Future
{
framing::SequenceNumber command;
boost::shared_ptr<FutureResult> result;
@@ -46,13 +44,9 @@
Future() : complete(false) {}
Future(const framing::SequenceNumber& id) : command(id), complete(false) {}
- template <class T> void decodeResult(T& value, SessionImpl& session)
- {
- if (result) {
- decode(value, result->getResult(session));
- } else {
- throw Exception("Result not expected");
- }
+ std::string getResult(SessionImpl& session) {
+ if (result) return result->getResult(session);
+ else throw Exception("Result not expected");
}
QPID_CLIENT_EXTERN void wait(SessionImpl& session);
Modified: qpid/branches/cmake/qpid/cpp/src/qpid/client/Handle.h
URL: http://svn.apache.org/viewvc/qpid/branches/cmake/qpid/cpp/src/qpid/client/Handle.h?rev=768053&r1=768052&r2=768053&view=diff
==============================================================================
--- qpid/branches/cmake/qpid/cpp/src/qpid/client/Handle.h (original)
+++ qpid/branches/cmake/qpid/cpp/src/qpid/client/Handle.h Thu Apr 23 21:06:35 2009
@@ -30,9 +30,11 @@
template <class T> class HandlePrivate;
/**
- * A handle is like a pointer: it points to some underlying object.
+ * A handle is like a pointer: it points to some implementation object.
+ * Copying the handle does not copy the object.
+ *
* Handles can be null, like a 0 pointer. Use isValid(), isNull() or the
- * implicit conversion to bool to test for a null handle.
+ * conversion to bool to test for a null handle.
*/
template <class T> class Handle {
public:
@@ -46,8 +48,11 @@
/**@return true if handle is null. It is an error to call any function on a null handle. */
QPID_CLIENT_EXTERN bool isNull() const { return !impl; }
+ /** Conversion to bool supports idiom if (handle) { handle->... } */
QPID_CLIENT_EXTERN operator bool() const { return impl; }
- QPID_CLIENT_EXTERN bool operator !() const { return impl; }
+
+ /** Operator ! supports idiom if (!handle) { do_if_handle_is_null(); } */
+ QPID_CLIENT_EXTERN bool operator !() const { return !impl; }
QPID_CLIENT_EXTERN void swap(Handle<T>&);
Modified: qpid/branches/cmake/qpid/cpp/src/qpid/client/HandlePrivate.h
URL: http://svn.apache.org/viewvc/qpid/branches/cmake/qpid/cpp/src/qpid/client/HandlePrivate.h?rev=768053&r1=768052&r2=768053&view=diff
==============================================================================
--- qpid/branches/cmake/qpid/cpp/src/qpid/client/HandlePrivate.h (original)
+++ qpid/branches/cmake/qpid/cpp/src/qpid/client/HandlePrivate.h Thu Apr 23 21:06:35 2009
@@ -21,14 +21,16 @@
* under the License.
*
*/
+#include "Handle.h"
+#include "qpid/RefCounted.h"
#include <algorithm>
+#include <boost/intrusive_ptr.hpp>
namespace qpid {
namespace client {
/** @file
- * Private implementation of handle, include in .cpp file of handle
- * subclasses _after_ including the declaration of class T.
+ * Implementation of handle, include in .cpp file of handle subclasses.
* T can be any class that can be used with boost::intrusive_ptr.
*/
@@ -52,9 +54,13 @@
template <class T>
class HandlePrivate {
public:
- static boost::intrusive_ptr<T> get(Handle<T>& h) { return boost::intrusive_ptr<T>(h.impl); }
+ static boost::intrusive_ptr<T> get(const Handle<T>& h) { return boost::intrusive_ptr<T>(h.impl); }
+ static void set(Handle<T>& h, const boost::intrusive_ptr<T>& p) { Handle<T>(p.get()).swap(h); }
};
+template<class T> boost::intrusive_ptr<T> handleGetPtr(Handle<T>& h) { return HandlePrivate<T>::get(h); }
+template<class T> boost::intrusive_ptr<const T> handleGetPtr(const Handle<T>& h) { return HandlePrivate<T>::get(h); }
+template<class T> void handleSetPtr(Handle<T>& h, const boost::intrusive_ptr<T>& p) { HandlePrivate<T>::set(h, p); }
}} // namespace qpid::client
Modified: qpid/branches/cmake/qpid/cpp/src/qpid/client/LocalQueue.cpp
URL: http://svn.apache.org/viewvc/qpid/branches/cmake/qpid/cpp/src/qpid/client/LocalQueue.cpp?rev=768053&r1=768052&r2=768053&view=diff
==============================================================================
--- qpid/branches/cmake/qpid/cpp/src/qpid/client/LocalQueue.cpp (original)
+++ qpid/branches/cmake/qpid/cpp/src/qpid/client/LocalQueue.cpp Thu Apr 23 21:06:35 2009
@@ -19,11 +19,14 @@
*
*/
#include "LocalQueue.h"
+#include "MessageImpl.h"
#include "qpid/Exception.h"
#include "qpid/framing/FrameSet.h"
+#include "qpid/framing/MessageTransferBody.h"
#include "qpid/framing/reply_exceptions.h"
#include "HandlePrivate.h"
#include "SubscriptionImpl.h"
+#include "CompletionImpl.h"
namespace qpid {
namespace client {
@@ -49,7 +52,7 @@
bool ok = queue->pop(content, timeout);
if (!ok) return false;
if (content->isA<MessageTransferBody>()) {
- result = Message(*content);
+ result = Message(new MessageImpl(*content));
boost::intrusive_ptr<SubscriptionImpl> si = HandlePrivate<SubscriptionImpl>::get(subscription);
assert(si);
if (si) si->received(result);
Modified: qpid/branches/cmake/qpid/cpp/src/qpid/client/Message.cpp
URL: http://svn.apache.org/viewvc/qpid/branches/cmake/qpid/cpp/src/qpid/client/Message.cpp?rev=768053&r1=768052&r2=768053&view=diff
==============================================================================
--- qpid/branches/cmake/qpid/cpp/src/qpid/client/Message.cpp (original)
+++ qpid/branches/cmake/qpid/cpp/src/qpid/client/Message.cpp Thu Apr 23 21:06:35 2009
@@ -20,52 +20,37 @@
*/
#include "Message.h"
+#include "PrivateImplPrivate.h"
+#include "MessageImpl.h"
namespace qpid {
namespace client {
-Message::Message(const std::string& data, const std::string& routingKey) : TransferContent(data, routingKey) {}
+template class PrivateImpl<MessageImpl>;
-std::string Message::getDestination() const
-{
- return method.getDestination();
-}
-
-bool Message::isRedelivered() const
-{
- return hasDeliveryProperties() && getDeliveryProperties().getRedelivered();
-}
-
-void Message::setRedelivered(bool redelivered)
-{
- getDeliveryProperties().setRedelivered(redelivered);
-}
-
-framing::FieldTable& Message::getHeaders()
-{
- return getMessageProperties().getApplicationHeaders();
-}
-
-const framing::FieldTable& Message::getHeaders() const
-{
- return getMessageProperties().getApplicationHeaders();
-}
-
-const framing::MessageTransferBody& Message::getMethod() const
-{
- return method;
-}
-
-const framing::SequenceNumber& Message::getId() const
-{
- return id;
-}
-
-/**@internal for incoming messages */
-Message::Message(const framing::FrameSet& frameset) :
- method(*frameset.as<framing::MessageTransferBody>()), id(frameset.getId())
-{
- populate(frameset);
-}
+Message::Message(const std::string& data, const std::string& routingKey) : PrivateImpl<MessageImpl>(new MessageImpl(data, routingKey)) {}
+Message::Message(MessageImpl* i) : PrivateImpl<MessageImpl>(i) {}
+Message::~Message() {}
+
+std::string Message::getDestination() const { return impl->getDestination(); }
+bool Message::isRedelivered() const { return impl->isRedelivered(); }
+void Message::setRedelivered(bool redelivered) { impl->setRedelivered(redelivered); }
+framing::FieldTable& Message::getHeaders() { return impl->getHeaders(); }
+const framing::FieldTable& Message::getHeaders() const { return impl->getHeaders(); }
+const framing::SequenceNumber& Message::getId() const { return impl->getId(); }
+
+void Message::setData(const std::string& s) { impl->setData(s); }
+const std::string& Message::getData() const { return impl->getData(); }
+std::string& Message::getData() { return impl->getData(); }
+
+void Message::appendData(const std::string& s) { impl->appendData(s); }
+
+bool Message::hasMessageProperties() const { return impl->hasMessageProperties(); }
+framing::MessageProperties& Message::getMessageProperties() { return impl->getMessageProperties(); }
+const framing::MessageProperties& Message::getMessageProperties() const { return impl->getMessageProperties(); }
+
+bool Message::hasDeliveryProperties() const { return impl->hasDeliveryProperties(); }
+framing::DeliveryProperties& Message::getDeliveryProperties() { return impl->getDeliveryProperties(); }
+const framing::DeliveryProperties& Message::getDeliveryProperties() const { return impl->getDeliveryProperties(); }
}}
Modified: qpid/branches/cmake/qpid/cpp/src/qpid/client/Message.h
URL: http://svn.apache.org/viewvc/qpid/branches/cmake/qpid/cpp/src/qpid/client/Message.h?rev=768053&r1=768052&r2=768053&view=diff
==============================================================================
--- qpid/branches/cmake/qpid/cpp/src/qpid/client/Message.h (original)
+++ qpid/branches/cmake/qpid/cpp/src/qpid/client/Message.h Thu Apr 23 21:06:35 2009
@@ -1,5 +1,5 @@
-#ifndef _client_Message_h
-#define _client_Message_h
+#ifndef QPID_CLIENT_MESSAGE_H
+#define QPID_CLIENT_MESSAGE_H
/*
*
@@ -21,15 +21,24 @@
* under the License.
*
*/
-#include <string>
-#include "qpid/client/Session.h"
-#include "qpid/framing/MessageTransferBody.h"
-#include "qpid/framing/TransferContent.h"
+
+#include "qpid/client/PrivateImpl.h"
#include "qpid/client/ClientImportExport.h"
+#include "qpid/framing/MessageProperties.h"
+#include "qpid/framing/DeliveryProperties.h"
+#include <string>
namespace qpid {
+
+namespace framing {
+class FieldTable;
+class SequenceNumber; // FIXME aconway 2009-04-17: remove with getID?
+}
+
namespace client {
+class MessageImpl;
+
/**
* A message sent to or received from the broker.
*
@@ -104,8 +113,7 @@
*
*
*/
-
-class Message : public framing::TransferContent
+class Message : public PrivateImpl<MessageImpl>
{
public:
/** Create a Message.
@@ -115,6 +123,23 @@
QPID_CLIENT_EXTERN Message(const std::string& data=std::string(),
const std::string& routingKey=std::string());
+ QPID_CLIENT_EXTERN ~Message();
+
+ QPID_CLIENT_EXTERN void setData(const std::string&);
+ QPID_CLIENT_EXTERN const std::string& getData() const;
+ QPID_CLIENT_EXTERN std::string& getData();
+
+ QPID_CLIENT_EXTERN void appendData(const std::string&);
+
+ QPID_CLIENT_EXTERN bool hasMessageProperties() const;
+ QPID_CLIENT_EXTERN framing::MessageProperties& getMessageProperties();
+ QPID_CLIENT_EXTERN const framing::MessageProperties& getMessageProperties() const;
+
+ QPID_CLIENT_EXTERN bool hasDeliveryProperties() const;
+ QPID_CLIENT_EXTERN framing::DeliveryProperties& getDeliveryProperties();
+ QPID_CLIENT_EXTERN const framing::DeliveryProperties& getDeliveryProperties() const;
+
+
/** The destination of messages sent to the broker is the exchange
* name. The destination of messages received from the broker is
* the delivery tag identifyig the local subscription (often this
@@ -133,20 +158,14 @@
/** Get a non-modifyable reference to the message headers. */
QPID_CLIENT_EXTERN const framing::FieldTable& getHeaders() const;
- ///@internal
- QPID_CLIENT_EXTERN const framing::MessageTransferBody& getMethod() const;
+ // FIXME aconway 2009-04-17: does this need to be in public API?
///@internal
QPID_CLIENT_EXTERN const framing::SequenceNumber& getId() const;
- /**@internal for incoming messages */
- QPID_CLIENT_EXTERN Message(const framing::FrameSet& frameset);
-
-private:
- //method and id are only set for received messages:
- framing::MessageTransferBody method;
- framing::SequenceNumber id;
+ ///@internal
+ Message(MessageImpl*);
};
}}
-#endif /*!_client_Message_h*/
+#endif /*!QPID_CLIENT_MESSAGE_H*/
Modified: qpid/branches/cmake/qpid/cpp/src/qpid/client/SessionBase_0_10.cpp
URL: http://svn.apache.org/viewvc/qpid/branches/cmake/qpid/cpp/src/qpid/client/SessionBase_0_10.cpp?rev=768053&r1=768052&r2=768053&view=diff
==============================================================================
--- qpid/branches/cmake/qpid/cpp/src/qpid/client/SessionBase_0_10.cpp (original)
+++ qpid/branches/cmake/qpid/cpp/src/qpid/client/SessionBase_0_10.cpp Thu Apr 23 21:06:35 2009
@@ -20,6 +20,8 @@
*/
#include "SessionBase_0_10.h"
#include "Connection.h"
+#include "qpid/client/SessionImpl.h"
+#include "qpid/client/Future.h"
#include "qpid/framing/all_method_bodies.h"
namespace qpid {
Modified: qpid/branches/cmake/qpid/cpp/src/qpid/client/SessionBase_0_10.h
URL: http://svn.apache.org/viewvc/qpid/branches/cmake/qpid/cpp/src/qpid/client/SessionBase_0_10.h?rev=768053&r1=768052&r2=768053&view=diff
==============================================================================
--- qpid/branches/cmake/qpid/cpp/src/qpid/client/SessionBase_0_10.h (original)
+++ qpid/branches/cmake/qpid/cpp/src/qpid/client/SessionBase_0_10.h Thu Apr 23 21:06:35 2009
@@ -23,14 +23,11 @@
*/
#include "qpid/SessionId.h"
+#include "qpid/client/SessionImpl.h"
#include "qpid/framing/amqp_structs.h"
-#include "qpid/framing/ProtocolVersion.h"
-#include "qpid/framing/MethodContent.h"
-#include "qpid/framing/TransferContent.h"
+#include "qpid/client/Message.h"
#include "qpid/client/Completion.h"
-#include "qpid/client/ConnectionImpl.h"
#include "qpid/client/Execution.h"
-#include "qpid/client/SessionImpl.h"
#include "qpid/client/TypedResult.h"
#include "qpid/shared_ptr.h"
#include "qpid/client/ClientImportExport.h"
@@ -44,7 +41,6 @@
using std::string;
using framing::Content;
using framing::FieldTable;
-using framing::MethodContent;
using framing::SequenceNumber;
using framing::SequenceSet;
using framing::SequenceNumberSet;
@@ -62,8 +58,6 @@
*/
class SessionBase_0_10 {
public:
-
- typedef framing::TransferContent DefaultContent;
///@internal
QPID_CLIENT_EXTERN SessionBase_0_10();
Modified: qpid/branches/cmake/qpid/cpp/src/qpid/client/Subscription.cpp
URL: http://svn.apache.org/viewvc/qpid/branches/cmake/qpid/cpp/src/qpid/client/Subscription.cpp?rev=768053&r1=768052&r2=768053&view=diff
==============================================================================
--- qpid/branches/cmake/qpid/cpp/src/qpid/client/Subscription.cpp (original)
+++ qpid/branches/cmake/qpid/cpp/src/qpid/client/Subscription.cpp Thu Apr 23 21:06:35 2009
@@ -21,6 +21,7 @@
#include "Subscription.h"
#include "SubscriptionImpl.h"
+#include "CompletionImpl.h"
#include "HandlePrivate.h"
#include "qpid/framing/enum.h"
Modified: qpid/branches/cmake/qpid/cpp/src/qpid/client/SubscriptionImpl.cpp
URL: http://svn.apache.org/viewvc/qpid/branches/cmake/qpid/cpp/src/qpid/client/SubscriptionImpl.cpp?rev=768053&r1=768052&r2=768053&view=diff
==============================================================================
--- qpid/branches/cmake/qpid/cpp/src/qpid/client/SubscriptionImpl.cpp (original)
+++ qpid/branches/cmake/qpid/cpp/src/qpid/client/SubscriptionImpl.cpp Thu Apr 23 21:06:35 2009
@@ -20,8 +20,12 @@
*/
#include "SubscriptionImpl.h"
+#include "MessageImpl.h"
+#include "CompletionImpl.h"
#include "SubscriptionManager.h"
#include "SubscriptionSettings.h"
+#include "HandlePrivate.h"
+#include "PrivateImplPrivate.h"
namespace qpid {
namespace client {
@@ -114,9 +118,9 @@
void SubscriptionImpl::received(Message& m) {
Mutex::ScopedLock l(lock);
- if (m.getMethod().getAcquireMode() == ACQUIRE_MODE_NOT_ACQUIRED)
+ if (privateImplGetPtr(m)->getMethod().getAcquireMode() == ACQUIRE_MODE_NOT_ACQUIRED)
unacquired.add(m.getId());
- else if (m.getMethod().getAcceptMode() == ACCEPT_MODE_EXPLICIT)
+ else if (privateImplGetPtr(m)->getMethod().getAcceptMode() == ACCEPT_MODE_EXPLICIT)
unaccepted.add(m.getId());
if (listener) {
Modified: qpid/branches/cmake/qpid/cpp/src/qpid/client/TypedResult.h
URL: http://svn.apache.org/viewvc/qpid/branches/cmake/qpid/cpp/src/qpid/client/TypedResult.h?rev=768053&r1=768052&r2=768053&view=diff
==============================================================================
--- qpid/branches/cmake/qpid/cpp/src/qpid/client/TypedResult.h (original)
+++ qpid/branches/cmake/qpid/cpp/src/qpid/client/TypedResult.h Thu Apr 23 21:06:35 2009
@@ -23,6 +23,7 @@
#define _TypedResult_
#include "Completion.h"
+#include "qpid/framing/StructHelper.h"
namespace qpid {
namespace client {
@@ -39,7 +40,7 @@
public:
///@internal
- TypedResult(Future f, shared_ptr<SessionImpl> s) : Completion(f, s), decoded(false) {}
+ TypedResult(CompletionImpl* c) : Completion(c), decoded(false) {}
/**
* Wait for the asynchronous command that returned this TypedResult to complete
@@ -49,13 +50,12 @@
*@exception If the command returns an error, get() throws an exception.
*
*/
- T& get()
- {
+ T& get() {
if (!decoded) {
- future.decodeResult(result, *session);
+ framing::StructHelper helper;
+ helper.decode(result, getResult());
decoded = true;
}
-
return result;
}
};
Modified: qpid/branches/cmake/qpid/cpp/src/qpid/cluster/Cluster.cpp
URL: http://svn.apache.org/viewvc/qpid/branches/cmake/qpid/cpp/src/qpid/cluster/Cluster.cpp?rev=768053&r1=768052&r2=768053&view=diff
==============================================================================
--- qpid/branches/cmake/qpid/cpp/src/qpid/cluster/Cluster.cpp (original)
+++ qpid/branches/cmake/qpid/cpp/src/qpid/cluster/Cluster.cpp Thu Apr 23 21:06:35 2009
@@ -36,6 +36,7 @@
#include "qpid/framing/ClusterConfigChangeBody.h"
#include "qpid/framing/ClusterConnectionDeliverCloseBody.h"
#include "qpid/framing/ClusterConnectionDeliverDoOutputBody.h"
+#include "qpid/framing/ClusterErrorCheckBody.h"
#include "qpid/framing/ClusterReadyBody.h"
#include "qpid/framing/ClusterShutdownBody.h"
#include "qpid/framing/ClusterUpdateOfferBody.h"
@@ -46,7 +47,6 @@
#include "qpid/management/ManagementBroker.h"
#include "qpid/memory.h"
#include "qpid/shared_ptr.h"
-#include "qpid/sys/LatencyMetric.h"
#include "qpid/sys/Thread.h"
#include <boost/bind.hpp>
@@ -63,6 +63,7 @@
using namespace qpid::sys;
using namespace std;
using namespace qpid::cluster;
+using namespace qpid::framing::cluster;
using qpid::management::ManagementAgent;
using qpid::management::ManagementObject;
using qpid::management::Manageable;
@@ -77,9 +78,10 @@
void updateRequest(const std::string& url) { cluster.updateRequest(member, url, l); }
void ready(const std::string& url) { cluster.ready(member, url, l); }
- void configChange(const std::string& addresses) { cluster.configChange(member, addresses, l); }
+ void configChange(const std::string& current) { cluster.configChange(member, current, l); }
void updateOffer(uint64_t updatee, const Uuid& id) { cluster.updateOffer(member, updatee, id, l); }
void messageExpired(uint64_t id) { cluster.messageExpired(member, id, l); }
+ void errorCheck(uint8_t type, uint64_t seq) { cluster.errorCheck(member, type, seq, l); }
void shutdown() { cluster.shutdown(member, l); }
bool invoke(AMQBody& body) { return framing::invoke(*this, body).wasHandled(); }
@@ -112,7 +114,8 @@
discarding(true),
state(INIT),
lastSize(0),
- lastBroker(false)
+ lastBroker(false),
+ error(*this)
{
mAgent = ManagementAgent::Singleton::getInstance();
if (mAgent != 0){
@@ -195,14 +198,19 @@
leave(l);
}
+#define LEAVE_TRY(STMT) try { STMT; } \
+ catch (const std::exception& e) { \
+ QPID_LOG(warning, *this << " error leaving cluster: " << e.what()); \
+ } do {} while(0)
+
void Cluster::leave(Lock&) {
if (state != LEFT) {
state = LEFT;
QPID_LOG(notice, *this << " leaving cluster " << name);
- try { broker.shutdown(); }
- catch (const std::exception& e) {
- QPID_LOG(critical, *this << " error during broker shutdown: " << e.what());
- }
+ // Finalize connections now now to avoid problems later in destructor.
+ LEAVE_TRY(localConnections.clear());
+ LEAVE_TRY(connections.clear());
+ LEAVE_TRY(broker.shutdown());
}
}
@@ -218,8 +226,6 @@
MemberId from(nodeid, pid);
framing::Buffer buf(static_cast<char*>(msg), msg_len);
Event e(Event::decodeCopy(from, buf));
- if (from == self) // Record self-deliveries for flow control.
- mcast.selfDeliver(e);
deliverEvent(e);
}
@@ -254,10 +260,22 @@
QPID_LOG(trace, *this << " DROP: " << e);
}
+void Cluster::flagError(Connection& connection, ErrorCheck::ErrorType type) {
+ Mutex::ScopedLock l(lock);
+ error.error(connection, type, map.getFrameSeq(), map.getMembers());
+}
+
// Handler for deliverFrameQueue.
// This thread executes the main logic.
void Cluster::deliveredFrame(const EventFrame& e) {
Mutex::ScopedLock l(lock);
+ // Process each frame through the error checker.
+ error.delivered(e);
+ while (error.canProcess()) // There is a frame ready to process.
+ processFrame(error.getNext(), l);
+}
+
+void Cluster::processFrame(const EventFrame& e, Lock& l) {
if (e.isCluster()) {
QPID_LOG(trace, *this << " DLVR: " << e);
ClusterDispatcher dispatch(*this, e.connectionId.getMember(), l);
@@ -265,7 +283,8 @@
throw Exception(QPID_MSG("Invalid cluster control"));
}
else if (state >= CATCHUP) {
- QPID_LOG(trace, *this << " DLVR: " << e);
+ map.incrementFrameSeq();
+ QPID_LOG(trace, *this << " DLVR " << map.getFrameSeq() << ": " << e);
ConnectionPtr connection = getConnection(e.connectionId, l);
if (connection)
connection->deliveredFrame(e);
@@ -316,11 +335,11 @@
for (const cpg_address* p = a.addrs; p < a.addrs+a.count; ++p) {
const char* reasonString;
switch (p->reason) {
- case CPG_REASON_JOIN: reasonString = " (joined) "; break;
- case CPG_REASON_LEAVE: reasonString = " (left) "; break;
- case CPG_REASON_NODEDOWN: reasonString = " (node-down) "; break;
- case CPG_REASON_NODEUP: reasonString = " (node-up) "; break;
- case CPG_REASON_PROCDOWN: reasonString = " (process-down) "; break;
+ case CPG_REASON_JOIN: reasonString = "(joined) "; break;
+ case CPG_REASON_LEAVE: reasonString = "(left) "; break;
+ case CPG_REASON_NODEDOWN: reasonString = "(node-down) "; break;
+ case CPG_REASON_NODEUP: reasonString = "(node-up) "; break;
+ case CPG_REASON_PROCDOWN: reasonString = "(process-down) "; break;
default: reasonString = " ";
}
qpid::cluster::MemberId member(*p);
@@ -342,8 +361,8 @@
broker.setRecovery(nCurrent == 1);
initialized = true;
}
- QPID_LOG(debug, *this << " config change: " << AddrList(current, nCurrent)
- << AddrList(left, nLeft, "( ", ")"));
+ QPID_LOG(debug, *this << " config change: " << AddrList(current, nCurrent)
+ << AddrList(left, nLeft, "left: "));
std::string addresses;
for (cpg_address* p = current; p < current+nCurrent; ++p)
addresses.append(MemberId(*p).str());
@@ -357,8 +376,8 @@
broker.getQueueEvents().enable();
}
-void Cluster::configChange(const MemberId&, const std::string& addresses, Lock& l) {
- bool memberChange = map.configChange(addresses);
+void Cluster::configChange(const MemberId&, const std::string& current, Lock& l) {
+ bool memberChange = map.configChange(current);
if (state == LEFT) return;
if (!map.isAlive(self)) { // Final config change.
@@ -589,19 +608,24 @@
mgmtObject->set_memberIDs(idstr);
}
- // Erase connections belonging to members that have left the cluster.
+ // Close connections belonging to members that have left the cluster.
ConnectionMap::iterator i = connections.begin();
while (i != connections.end()) {
ConnectionMap::iterator j = i++;
MemberId m = j->second->getId().getMember();
if (m != self && !map.isMember(m))
- connections.erase(j);
+ j->second->deliverClose();
}
}
std::ostream& operator<<(std::ostream& o, const Cluster& cluster) {
- static const char* STATE[] = { "INIT", "JOINER", "UPDATEE", "CATCHUP", "READY", "OFFER", "UPDATER", "LEFT" };
- return o << cluster.self << "(" << STATE[cluster.state] << ")";
+ static const char* STATE[] = {
+ "INIT", "JOINER", "UPDATEE", "CATCHUP", "READY", "OFFER", "UPDATER", "LEFT"
+ };
+ assert(sizeof(STATE)/sizeof(*STATE) == Cluster::LEFT+1);
+ o << cluster.self << "(" << STATE[cluster.state];
+ if (cluster.error.isUnresolved()) o << "/error";
+ return o << ")";
}
MemberId Cluster::getId() const {
@@ -635,4 +659,13 @@
expiryPolicy->deliverExpire(id);
}
+void Cluster::errorCheck(const MemberId& , uint8_t type, uint64_t frameSeq, Lock&) {
+ // If we receive an errorCheck here, it's because we have processed past the point
+ // of the error so respond with ERROR_TYPE_NONE
+ assert(map.getFrameSeq() >= frameSeq);
+ if (type != framing::cluster::ERROR_TYPE_NONE) // Don't respond if its already NONE.
+ mcast.mcastControl(
+ ClusterErrorCheckBody(ProtocolVersion(), framing::cluster::ERROR_TYPE_NONE, frameSeq), self);
+}
+
}} // namespace qpid::cluster
Modified: qpid/branches/cmake/qpid/cpp/src/qpid/cluster/Cluster.h
URL: http://svn.apache.org/viewvc/qpid/branches/cmake/qpid/cpp/src/qpid/cluster/Cluster.h?rev=768053&r1=768052&r2=768053&view=diff
==============================================================================
--- qpid/branches/cmake/qpid/cpp/src/qpid/cluster/Cluster.h (original)
+++ qpid/branches/cmake/qpid/cpp/src/qpid/cluster/Cluster.h Thu Apr 23 21:06:35 2009
@@ -23,6 +23,7 @@
#include "ClusterSettings.h"
#include "Cpg.h"
#include "Decoder.h"
+#include "ErrorCheck.h"
#include "Event.h"
#include "EventFrame.h"
#include "ExpiryPolicy.h"
@@ -105,6 +106,10 @@
void deliverFrame(const EventFrame&);
+ // Called in deliverFrame thread to indicate an error from the broker.
+ void flagError(Connection&, ErrorCheck::ErrorType);
+ void connectionError();
+
// Called only during update by Connection::shadowReady
Decoder& getDecoder() { return decoder; }
@@ -132,13 +137,15 @@
// == Called in deliverFrameQueue thread
void deliveredFrame(const EventFrame&);
+ void processFrame(const EventFrame&, Lock&);
// Cluster controls implement XML methods from cluster.xml.
void updateRequest(const MemberId&, const std::string&, Lock&);
void updateOffer(const MemberId& updater, uint64_t updatee, const framing::Uuid&, Lock&);
void ready(const MemberId&, const std::string&, Lock&);
- void configChange(const MemberId&, const std::string& addresses, Lock& l);
+ void configChange(const MemberId&, const std::string& current, Lock& l);
void messageExpired(const MemberId&, uint64_t, Lock& l);
+ void errorCheck(const MemberId&, uint8_t, uint64_t, Lock&);
void shutdown(const MemberId&, Lock&);
// Helper functions
@@ -216,11 +223,13 @@
Decoder decoder;
bool discarding;
+
// Remaining members are protected by lock.
- // FIXME aconway 2009-03-06: Most of these members are also only used in
+
+ // TODO aconway 2009-03-06: Most of these members are also only used in
// deliverFrameQueue thread or during stall. Review and separate members
// that require a lock, drop lock when not needed.
- //
+
mutable sys::Monitor lock;
@@ -243,7 +252,7 @@
bool lastBroker;
sys::Thread updateThread;
boost::optional<ClusterMap> updatedMap;
-
+ ErrorCheck error;
friend std::ostream& operator<<(std::ostream&, const Cluster&);
friend class ClusterDispatcher;
Modified: qpid/branches/cmake/qpid/cpp/src/qpid/cluster/ClusterMap.cpp
URL: http://svn.apache.org/viewvc/qpid/branches/cmake/qpid/cpp/src/qpid/cluster/ClusterMap.cpp?rev=768053&r1=768052&r2=768053&view=diff
==============================================================================
--- qpid/branches/cmake/qpid/cpp/src/qpid/cluster/ClusterMap.cpp (original)
+++ qpid/branches/cmake/qpid/cpp/src/qpid/cluster/ClusterMap.cpp Thu Apr 23 21:06:35 2009
@@ -33,6 +33,13 @@
namespace cluster {
+ClusterMap::Set ClusterMap::decode(const std::string& s) {
+ Set set;
+ for (std::string::const_iterator i = s.begin(); i < s.end(); i += 8)
+ set.insert(MemberId(std::string(i, i+8)));
+ return set;
+}
+
namespace {
void addFieldTableValue(FieldTable::ValueMap::value_type vt, ClusterMap::Map& map, ClusterMap::Set& set) {
@@ -54,9 +61,9 @@
}
-ClusterMap::ClusterMap() {}
+ClusterMap::ClusterMap() : frameSeq(0) {}
-ClusterMap::ClusterMap(const MemberId& id, const Url& url , bool isMember) {
+ClusterMap::ClusterMap(const MemberId& id, const Url& url , bool isMember) : frameSeq(0) {
alive.insert(id);
if (isMember)
members[id] = url;
@@ -64,7 +71,9 @@
joiners[id] = url;
}
-ClusterMap::ClusterMap(const FieldTable& joinersFt, const FieldTable& membersFt) {
+ClusterMap::ClusterMap(const FieldTable& joinersFt, const FieldTable& membersFt, uint64_t frameSeq_)
+ : frameSeq(frameSeq_)
+{
std::for_each(joinersFt.begin(), joinersFt.end(), boost::bind(&addFieldTableValue, _1, boost::ref(joiners), boost::ref(alive)));
std::for_each(membersFt.begin(), membersFt.end(), boost::bind(&addFieldTableValue, _1, boost::ref(members), boost::ref(alive)));
}
@@ -78,22 +87,7 @@
}
b.getMembers().clear();
std::for_each(members.begin(), members.end(), boost::bind(&insertFieldTableFromMapValue, boost::ref(b.getMembers()), _1));
-}
-
-bool ClusterMap::configChange(
- cpg_address *current, int nCurrent,
- cpg_address *left, int nLeft,
- cpg_address */*joined*/, int /*nJoined*/)
-{
- cpg_address* a;
- bool memberChange=false;
- for (a = left; a != left+nLeft; ++a) {
- memberChange = memberChange || members.erase(*a);
- joiners.erase(*a);
- }
- alive.clear();
- std::copy(current, current+nCurrent, std::inserter(alive, alive.end()));
- return memberChange;
+ b.setFrameSeq(frameSeq);
}
Url ClusterMap::getUrl(const Map& map, const MemberId& id) {
@@ -123,8 +117,13 @@
return urls;
}
-ClusterMap::Set ClusterMap::getAlive() const {
- return alive;
+ClusterMap::Set ClusterMap::getAlive() const { return alive; }
+
+ClusterMap::Set ClusterMap::getMembers() const {
+ Set s;
+ std::transform(members.begin(), members.end(), std::inserter(s, s.begin()),
+ boost::bind(&Map::value_type::first, _1));
+ return s;
}
std::ostream& operator<<(std::ostream& o, const ClusterMap::Map& m) {
@@ -158,7 +157,7 @@
bool ClusterMap::configChange(const std::string& addresses) {
bool memberChange = false;
- Set update;
+ Set update = decode(addresses);
for (std::string::const_iterator i = addresses.begin(); i < addresses.end(); i += 8)
update.insert(MemberId(std::string(i, i+8)));
Set removed;
Modified: qpid/branches/cmake/qpid/cpp/src/qpid/cluster/ClusterMap.h
URL: http://svn.apache.org/viewvc/qpid/branches/cmake/qpid/cpp/src/qpid/cluster/ClusterMap.h?rev=768053&r1=768052&r2=768053&view=diff
==============================================================================
--- qpid/branches/cmake/qpid/cpp/src/qpid/cluster/ClusterMap.h (original)
+++ qpid/branches/cmake/qpid/cpp/src/qpid/cluster/ClusterMap.h Thu Apr 23 21:06:35 2009
@@ -38,26 +38,26 @@
namespace qpid {
namespace cluster {
+typedef std::set<MemberId> MemberSet;
+
/**
- * Map of established cluster members and joiners waiting for an update.
+ * Map of established cluster members and joiners waiting for an update,
+ * along with other cluster state that must be updated.
*/
class ClusterMap {
public:
typedef std::map<MemberId, Url> Map;
typedef std::set<MemberId> Set;
+ static Set decode(const std::string&);
+
ClusterMap();
ClusterMap(const MemberId& id, const Url& url, bool isReady);
- ClusterMap(const framing::FieldTable& urls, const framing::FieldTable& states);
+ ClusterMap(const framing::FieldTable& joiners, const framing::FieldTable& members, uint64_t frameSeq);
/** Update from config change.
*@return true if member set changed.
*/
- bool configChange(
- cpg_address *current, int nCurrent,
- cpg_address *left, int nLeft,
- cpg_address *joined, int nJoined);
-
bool configChange(const std::string& addresses);
bool isJoiner(const MemberId& id) const { return joiners.find(id) != joiners.end(); }
@@ -78,6 +78,7 @@
std::vector<std::string> memberIds() const;
std::vector<Url> memberUrls() const;
Set getAlive() const;
+ Set getMembers() const;
bool updateRequest(const MemberId& id, const std::string& url);
/** Return non-empty Url if accepted */
@@ -90,11 +91,16 @@
* Utility method to return intersection of two member sets
*/
static Set intersection(const Set& a, const Set& b);
+
+ uint64_t getFrameSeq() { return frameSeq; }
+ uint64_t incrementFrameSeq() { return ++frameSeq; }
+
private:
Url getUrl(const Map& map, const MemberId& id);
Map joiners, members;
Set alive;
+ uint64_t frameSeq;
friend std::ostream& operator<<(std::ostream&, const Map&);
friend std::ostream& operator<<(std::ostream&, const ClusterMap&);
Modified: qpid/branches/cmake/qpid/cpp/src/qpid/cluster/Connection.cpp
URL: http://svn.apache.org/viewvc/qpid/branches/cmake/qpid/cpp/src/qpid/cluster/Connection.cpp?rev=768053&r1=768052&r2=768053&view=diff
==============================================================================
--- qpid/branches/cmake/qpid/cpp/src/qpid/cluster/Connection.cpp (original)
+++ qpid/branches/cmake/qpid/cpp/src/qpid/cluster/Connection.cpp Thu Apr 23 21:06:35 2009
@@ -39,8 +39,6 @@
#include "qpid/framing/ConnectionCloseBody.h"
#include "qpid/framing/ConnectionCloseOkBody.h"
#include "qpid/log/Statement.h"
-#include "qpid/sys/LatencyMetric.h"
-#include "qpid/sys/AtomicValue.h"
#include <boost/current_function.hpp>
@@ -56,8 +54,16 @@
namespace cluster {
using namespace framing;
+using namespace framing::cluster;
+
+qpid::sys::AtomicValue<uint64_t> Connection::catchUpId(0x5000000000000000LL);
+
+Connection::NullFrameHandler Connection::nullFrameHandler;
+
+struct NullFrameHandler : public framing::FrameHandler {
+ void handle(framing::AMQFrame&) {}
+};
-NoOpConnectionOutputHandler Connection::discardHandler;
namespace {
sys::AtomicValue<uint64_t> idCounter;
@@ -89,6 +95,8 @@
connection.setClusterOrderOutput(nullFrameHandler); // Passive, discard cluster-order frames
connection.setClientThrottling(false); // Disable client throttling, done by active node.
}
+ if (!isCatchUp())
+ connection.setErrorListener(this);
}
void Connection::giveReadCredit(int credit) {
@@ -97,6 +105,7 @@
}
Connection::~Connection() {
+ connection.setErrorListener(0);
QPID_LOG(debug, cluster << " deleted connection: " << *this);
}
@@ -126,7 +135,7 @@
cluster.addShadowConnection(this);
AMQFrame ok((ConnectionCloseOkBody()));
connection.getOutput().send(ok);
- output.closeOutput(discardHandler);
+ output.closeOutput();
catchUp = false;
}
else
@@ -156,8 +165,8 @@
{
if (f.type == DATA) // incoming data frames to broker::Connection
connection.received(const_cast<AMQFrame&>(f.frame));
- else { // frame control, send frame via SessionState
- broker::SessionState* ss = connection.getChannel(f.frame.getChannel()).getSession();
+ else { // frame control, send frame via SessionState
+ broker::SessionState* ss = connection.getChannel(currentChannel).getSession();
if (ss) ss->out(const_cast<AMQFrame&>(f.frame));
}
}
@@ -180,7 +189,7 @@
// This was a local replicated connection. Multicast a deliver
// closed and process any outstanding frames from the cluster
// until self-delivery of deliver-close.
- output.closeOutput(discardHandler);
+ output.closeOutput();
cluster.getMulticast().mcastControl(ClusterConnectionDeliverCloseBody(), self);
}
}
@@ -275,13 +284,14 @@
QPID_LOG(debug, cluster << " catch-up connection " << *this << " becomes shadow " << shadowId);
self = shadowId;
connection.setUserId(username);
- // OK to use decoder here because we are stalled for update.
+ // OK to use decoder here because cluster is stalled for update.
cluster.getDecoder().get(self).setFragment(fragment.data(), fragment.size());
+ connection.setErrorListener(this);
}
-void Connection::membership(const FieldTable& joiners, const FieldTable& members) {
+void Connection::membership(const FieldTable& joiners, const FieldTable& members, uint64_t frameSeq) {
QPID_LOG(debug, cluster << " incoming update complete on connection " << *this);
- cluster.updateInDone(ClusterMap(joiners, members));
+ cluster.updateInDone(ClusterMap(joiners, members, frameSeq));
self.second = 0; // Mark this as completed update connection.
}
@@ -305,7 +315,9 @@
}
broker::QueuedMessage Connection::getUpdateMessage() {
- broker::QueuedMessage m = findQueue(UpdateClient::UPDATE)->get();
+ shared_ptr<broker::Queue> updateq = findQueue(UpdateClient::UPDATE);
+ assert(!updateq->isDurable());
+ broker::QueuedMessage m = updateq->get();
if (!m.payload) throw Exception(QPID_MSG(cluster << " empty update queue"));
return m;
}
@@ -342,15 +354,15 @@
// If the message was unacked, the newbie broker must place
// it in its messageStore.
- if ( m.payload && m.payload->isPersistent() && !completed && !ended && !accepted && !cancelled )
+ if ( m.payload && m.payload->isPersistent() && acquired && !ended)
queue->enqueue ( 0, m.payload );
}
void Connection::queuePosition(const string& qname, const SequenceNumber& position) {
- shared_ptr<broker::Queue> q = cluster.getBroker().getQueues().find(qname);
- if (!q) throw InvalidArgumentException(QPID_MSG("Invalid queue name " << qname));
- q->setPosition(position);
-}
+ shared_ptr<broker::Queue> q = cluster.getBroker().getQueues().find(qname);
+ if (!q) throw InvalidArgumentException(QPID_MSG("Invalid queue name " << qname));
+ q->setPosition(position);
+ }
void Connection::expiryId(uint64_t id) {
cluster.getExpiryPolicy().setId(id);
@@ -407,7 +419,14 @@
QPID_LOG(debug, cluster << " decoded queue " << q->getName());
}
-qpid::sys::AtomicValue<uint64_t> Connection::catchUpId(0x5000000000000000LL);
+void Connection::sessionError(uint16_t , const std::string& ) {
+ cluster.flagError(*this, ERROR_TYPE_SESSION);
+
+}
+
+void Connection::connectionError(const std::string& ) {
+ cluster.flagError(*this, ERROR_TYPE_CONNECTION);
+}
}} // namespace qpid::cluster
Modified: qpid/branches/cmake/qpid/cpp/src/qpid/cluster/Connection.h
URL: http://svn.apache.org/viewvc/qpid/branches/cmake/qpid/cpp/src/qpid/cluster/Connection.h?rev=768053&r1=768052&r2=768053&view=diff
==============================================================================
--- qpid/branches/cmake/qpid/cpp/src/qpid/cluster/Connection.h (original)
+++ qpid/branches/cmake/qpid/cpp/src/qpid/cluster/Connection.h Thu Apr 23 21:06:35 2009
@@ -25,7 +25,6 @@
#include "types.h"
#include "WriteEstimate.h"
#include "OutputInterceptor.h"
-#include "NoOpConnectionOutputHandler.h"
#include "EventFrame.h"
#include "McastFrameHandler.h"
@@ -58,7 +57,8 @@
class Connection :
public RefCounted,
public sys::ConnectionInputHandler,
- public framing::AMQP_AllOperations::ClusterConnectionHandler
+ public framing::AMQP_AllOperations::ClusterConnectionHandler,
+ private broker::Connection::ErrorListener
{
public:
@@ -120,7 +120,7 @@
void shadowReady(uint64_t memberId, uint64_t connectionId, const std::string& username, const std::string& fragment);
- void membership(const framing::FieldTable&, const framing::FieldTable&);
+ void membership(const framing::FieldTable&, const framing::FieldTable&, uint64_t frameSeq);
void deliveryRecord(const std::string& queue,
const framing::SequenceNumber& position,
@@ -151,14 +151,22 @@
void giveReadCredit(int credit);
+ void deliverClose();
+
private:
struct NullFrameHandler : public framing::FrameHandler {
void handle(framing::AMQFrame&) {}
};
+
+ static NullFrameHandler nullFrameHandler;
+
+ // Error listener functions
+ void connectionError(const std::string&);
+ void sessionError(uint16_t channel, const std::string&);
+
void init();
bool checkUnsupported(const framing::AMQBody& body);
- void deliverClose();
void deliverDoOutput(uint32_t requested);
void sendDoOutput();
@@ -167,8 +175,6 @@
broker::SemanticState& semanticState();
broker::QueuedMessage getUpdateMessage();
- static NoOpConnectionOutputHandler discardHandler;
-
Cluster& cluster;
ConnectionId self;
bool catchUp;
@@ -181,7 +187,6 @@
boost::shared_ptr<broker::TxBuffer> txBuffer;
bool expectProtocolHeader;
McastFrameHandler mcastFrameHandler;
- NullFrameHandler nullFrameHandler;
static qpid::sys::AtomicValue<uint64_t> catchUpId;
Modified: qpid/branches/cmake/qpid/cpp/src/qpid/cluster/Cpg.cpp
URL: http://svn.apache.org/viewvc/qpid/branches/cmake/qpid/cpp/src/qpid/cluster/Cpg.cpp?rev=768053&r1=768052&r2=768053&view=diff
==============================================================================
--- qpid/branches/cmake/qpid/cpp/src/qpid/cluster/Cpg.cpp (original)
+++ qpid/branches/cmake/qpid/cpp/src/qpid/cluster/Cpg.cpp Thu Apr 23 21:06:35 2009
@@ -75,11 +75,14 @@
::memset(&callbacks, sizeof(callbacks), 0);
callbacks.cpg_deliver_fn = &globalDeliver;
callbacks.cpg_confchg_fn = &globalConfigChange;
+
+ QPID_LOG(info, "Initializing CPG");
cpg_error_t err = cpg_initialize(&handle, &callbacks);
- if (err == CPG_ERR_TRY_AGAIN) {
- QPID_LOG(notice, "Waiting for CPG initialization.");
- while (CPG_ERR_TRY_AGAIN == (err = cpg_initialize(&handle, &callbacks)))
- sys::sleep(5);
+ int retries = 6;
+ while (err == CPG_ERR_TRY_AGAIN && --retries) {
+ QPID_LOG(notice, "Re-trying CPG initialization.");
+ sys::sleep(5);
+ err = cpg_initialize(&handle, &callbacks);
}
check(err, "Failed to initialize CPG.");
check(cpg_context_set(handle, this), "Cannot set CPG context");
@@ -87,7 +90,6 @@
// windows then this needs to be refactored into
// qpid::sys::<platform>
IOHandle::impl->fd = getFd();
- QPID_LOG(debug, "Initialized CPG handle 0x" << std::hex << handle);
}
Cpg::~Cpg() {
Modified: qpid/branches/cmake/qpid/cpp/src/qpid/cluster/Event.h
URL: http://svn.apache.org/viewvc/qpid/branches/cmake/qpid/cpp/src/qpid/cluster/Event.h?rev=768053&r1=768052&r2=768053&view=diff
==============================================================================
--- qpid/branches/cmake/qpid/cpp/src/qpid/cluster/Event.h (original)
+++ qpid/branches/cmake/qpid/cpp/src/qpid/cluster/Event.h Thu Apr 23 21:06:35 2009
@@ -25,7 +25,6 @@
#include "types.h"
#include "qpid/RefCountedBuffer.h"
#include "qpid/framing/AMQFrame.h"
-#include "qpid/sys/LatencyMetric.h"
#include <sys/uio.h> // For iovec
#include <iosfwd>
@@ -42,7 +41,7 @@
namespace cluster {
/** Header data for a multicast event */
-class EventHeader : public ::qpid::sys::LatencyMetricTimestamp {
+class EventHeader {
public:
EventHeader(EventType t=DATA, const ConnectionId& c=ConnectionId(), size_t size=0);
void decode(const MemberId& m, framing::Buffer&);
Modified: qpid/branches/cmake/qpid/cpp/src/qpid/cluster/EventFrame.cpp
URL: http://svn.apache.org/viewvc/qpid/branches/cmake/qpid/cpp/src/qpid/cluster/EventFrame.cpp?rev=768053&r1=768052&r2=768053&view=diff
==============================================================================
--- qpid/branches/cmake/qpid/cpp/src/qpid/cluster/EventFrame.cpp (original)
+++ qpid/branches/cmake/qpid/cpp/src/qpid/cluster/EventFrame.cpp Thu Apr 23 21:06:35 2009
@@ -28,9 +28,7 @@
EventFrame::EventFrame(const EventHeader& e, const framing::AMQFrame& f, int rc)
: connectionId(e.getConnectionId()), frame(f), readCredit(rc), type(e.getType())
-{
- QPID_LATENCY_INIT(frame);
-}
+{}
std::ostream& operator<<(std::ostream& o, const EventFrame& e) {
if (e.frame.getBody()) o << e.frame;
Modified: qpid/branches/cmake/qpid/cpp/src/qpid/cluster/EventFrame.h
URL: http://svn.apache.org/viewvc/qpid/branches/cmake/qpid/cpp/src/qpid/cluster/EventFrame.h?rev=768053&r1=768052&r2=768053&view=diff
==============================================================================
--- qpid/branches/cmake/qpid/cpp/src/qpid/cluster/EventFrame.h (original)
+++ qpid/branches/cmake/qpid/cpp/src/qpid/cluster/EventFrame.h Thu Apr 23 21:06:35 2009
@@ -25,7 +25,6 @@
#include "types.h"
#include "Event.h"
#include "qpid/framing/AMQFrame.h"
-#include "qpid/sys/LatencyMetric.h"
#include <boost/intrusive_ptr.hpp>
#include <iosfwd>
@@ -45,6 +44,7 @@
bool isCluster() const { return connectionId.getNumber() == 0; }
bool isConnection() const { return connectionId.getNumber() != 0; }
bool isLastInEvent() const { return readCredit; }
+ MemberId getMemberId() const { return connectionId.getMember(); }
ConnectionId connectionId;
Modified: qpid/branches/cmake/qpid/cpp/src/qpid/cluster/ExpiryPolicy.cpp
URL: http://svn.apache.org/viewvc/qpid/branches/cmake/qpid/cpp/src/qpid/cluster/ExpiryPolicy.cpp?rev=768053&r1=768052&r2=768053&view=diff
==============================================================================
--- qpid/branches/cmake/qpid/cpp/src/qpid/cluster/ExpiryPolicy.cpp (original)
+++ qpid/branches/cmake/qpid/cpp/src/qpid/cluster/ExpiryPolicy.cpp Thu Apr 23 21:06:35 2009
@@ -50,6 +50,13 @@
timer.add(new ExpiryTask(this, id, m.getExpiration()));
}
+void ExpiryPolicy::forget(broker::Message& m) {
+ MessageIdMap::iterator i = unexpiredByMessage.find(&m);
+ assert(i != unexpiredByMessage.end());
+ unexpiredById.erase(i->second);
+ unexpiredByMessage.erase(i);
+}
+
bool ExpiryPolicy::hasExpired(broker::Message& m) {
return unexpiredByMessage.find(&m) == unexpiredByMessage.end();
}
Modified: qpid/branches/cmake/qpid/cpp/src/qpid/cluster/ExpiryPolicy.h
URL: http://svn.apache.org/viewvc/qpid/branches/cmake/qpid/cpp/src/qpid/cluster/ExpiryPolicy.h?rev=768053&r1=768052&r2=768053&view=diff
==============================================================================
--- qpid/branches/cmake/qpid/cpp/src/qpid/cluster/ExpiryPolicy.h (original)
+++ qpid/branches/cmake/qpid/cpp/src/qpid/cluster/ExpiryPolicy.h Thu Apr 23 21:06:35 2009
@@ -49,8 +49,8 @@
ExpiryPolicy(Multicaster&, const MemberId&, broker::Timer&);
void willExpire(broker::Message&);
-
bool hasExpired(broker::Message&);
+ void forget(broker::Message&);
// Send expiration notice to cluster.
void sendExpire(uint64_t);
Modified: qpid/branches/cmake/qpid/cpp/src/qpid/cluster/LockedConnectionMap.h
URL: http://svn.apache.org/viewvc/qpid/branches/cmake/qpid/cpp/src/qpid/cluster/LockedConnectionMap.h?rev=768053&r1=768052&r2=768053&view=diff
==============================================================================
--- qpid/branches/cmake/qpid/cpp/src/qpid/cluster/LockedConnectionMap.h (original)
+++ qpid/branches/cmake/qpid/cpp/src/qpid/cluster/LockedConnectionMap.h Thu Apr 23 21:06:35 2009
@@ -52,6 +52,8 @@
return 0;
}
+ void clear() { sys::Mutex::ScopedLock l(lock); map.clear(); }
+
private:
typedef std::map<ConnectionId, ConnectionPtr> Map;
mutable sys::Mutex lock;
Modified: qpid/branches/cmake/qpid/cpp/src/qpid/cluster/Multicaster.cpp
URL: http://svn.apache.org/viewvc/qpid/branches/cmake/qpid/cpp/src/qpid/cluster/Multicaster.cpp?rev=768053&r1=768052&r2=768053&view=diff
==============================================================================
--- qpid/branches/cmake/qpid/cpp/src/qpid/cluster/Multicaster.cpp (original)
+++ qpid/branches/cmake/qpid/cpp/src/qpid/cluster/Multicaster.cpp Thu Apr 23 21:06:35 2009
@@ -22,7 +22,6 @@
#include "Multicaster.h"
#include "Cpg.h"
#include "qpid/log/Statement.h"
-#include "qpid/sys/LatencyMetric.h"
#include "qpid/framing/AMQBody.h"
#include "qpid/framing/AMQFrame.h"
@@ -64,7 +63,6 @@
return;
}
}
- QPID_LATENCY_INIT(e);
queue.push(e);
}
@@ -73,7 +71,6 @@
try {
PollableEventQueue::Queue::iterator i = values.begin();
while( i != values.end()) {
- QPID_LATENCY_RECORD("mcast send queue", *i);
iovec iov = i->toIovec();
if (!cpg.mcast(&iov, 1)) {
// cpg didn't send because of CPG flow control.
@@ -97,9 +94,4 @@
holdingQueue.clear();
}
-void Multicaster::selfDeliver(const Event& e) {
- sys::Mutex::ScopedLock l(lock);
- QPID_LATENCY_RECORD("cpg self deliver", e);
-}
-
}} // namespace qpid::cluster
Modified: qpid/branches/cmake/qpid/cpp/src/qpid/cluster/Multicaster.h
URL: http://svn.apache.org/viewvc/qpid/branches/cmake/qpid/cpp/src/qpid/cluster/Multicaster.h?rev=768053&r1=768052&r2=768053&view=diff
==============================================================================
--- qpid/branches/cmake/qpid/cpp/src/qpid/cluster/Multicaster.h (original)
+++ qpid/branches/cmake/qpid/cpp/src/qpid/cluster/Multicaster.h Thu Apr 23 21:06:35 2009
@@ -55,8 +55,6 @@
void mcast(const Event& e);
/** End holding mode, held events are mcast */
void release();
- /** Call when events are self-delivered to manage flow control. */
- void selfDeliver(const Event&);
private:
typedef sys::PollableQueue<Event> PollableEventQueue;
Modified: qpid/branches/cmake/qpid/cpp/src/qpid/cluster/NoOpConnectionOutputHandler.h
URL: http://svn.apache.org/viewvc/qpid/branches/cmake/qpid/cpp/src/qpid/cluster/NoOpConnectionOutputHandler.h?rev=768053&r1=768052&r2=768053&view=diff
==============================================================================
--- qpid/branches/cmake/qpid/cpp/src/qpid/cluster/NoOpConnectionOutputHandler.h (original)
+++ qpid/branches/cmake/qpid/cpp/src/qpid/cluster/NoOpConnectionOutputHandler.h Thu Apr 23 21:06:35 2009
@@ -30,8 +30,7 @@
namespace cluster {
/**
- * Output handler for frames sent to noop connections.
- * Simply discards frames.
+ * Output handler shadow connections, simply discards frames.
*/
class NoOpConnectionOutputHandler : public sys::ConnectionOutputHandler
{
Modified: qpid/branches/cmake/qpid/cpp/src/qpid/cluster/OutputInterceptor.cpp
URL: http://svn.apache.org/viewvc/qpid/branches/cmake/qpid/cpp/src/qpid/cluster/OutputInterceptor.cpp?rev=768053&r1=768052&r2=768053&view=diff
==============================================================================
--- qpid/branches/cmake/qpid/cpp/src/qpid/cluster/OutputInterceptor.cpp (original)
+++ qpid/branches/cmake/qpid/cpp/src/qpid/cluster/OutputInterceptor.cpp Thu Apr 23 21:06:35 2009
@@ -32,8 +32,9 @@
using namespace framing;
-OutputInterceptor::OutputInterceptor(
- cluster::Connection& p, sys::ConnectionOutputHandler& h)
+NoOpConnectionOutputHandler OutputInterceptor::discardHandler;
+
+OutputInterceptor::OutputInterceptor(Connection& p, sys::ConnectionOutputHandler& h)
: parent(p), closing(false), next(&h), sent(),
writeEstimate(p.getCluster().getWriteEstimate()),
moreOutput(), doingOutput()
@@ -47,7 +48,6 @@
}
if (!parent.isCatchUp())
sent += f.encodedSize();
- QPID_LATENCY_RECORD("up to write queue", f);
}
void OutputInterceptor::activateOutput() {
@@ -98,7 +98,6 @@
// Send a doOutput request if one is not already in flight.
void OutputInterceptor::sendDoOutput() {
if (!parent.isLocal()) return;
- QPID_LATENCY_INIT(*this);
doingOutput = true;
size_t request = writeEstimate.sending(getBuffered());
@@ -111,10 +110,10 @@
QPID_LOG(trace, parent << "Send doOutput request for " << request);
}
-void OutputInterceptor::closeOutput(sys::ConnectionOutputHandler& h) {
+void OutputInterceptor::closeOutput() {
sys::Mutex::ScopedLock l(lock);
closing = true;
- next = &h;
+ next = &discardHandler;
}
void OutputInterceptor::close() {
Modified: qpid/branches/cmake/qpid/cpp/src/qpid/cluster/OutputInterceptor.h
URL: http://svn.apache.org/viewvc/qpid/branches/cmake/qpid/cpp/src/qpid/cluster/OutputInterceptor.h?rev=768053&r1=768052&r2=768053&view=diff
==============================================================================
--- qpid/branches/cmake/qpid/cpp/src/qpid/cluster/OutputInterceptor.h (original)
+++ qpid/branches/cmake/qpid/cpp/src/qpid/cluster/OutputInterceptor.h Thu Apr 23 21:06:35 2009
@@ -23,9 +23,9 @@
*/
#include "WriteEstimate.h"
+#include "NoOpConnectionOutputHandler.h"
#include "qpid/sys/ConnectionOutputHandler.h"
#include "qpid/broker/ConnectionFactory.h"
-#include "qpid/sys/LatencyMetric.h"
#include <boost/function.hpp>
namespace qpid {
@@ -37,7 +37,7 @@
/**
* Interceptor for connection OutputHandler, manages outgoing message replication.
*/
-class OutputInterceptor : public sys::ConnectionOutputHandler, sys::LatencyMetricTimestamp {
+class OutputInterceptor : public sys::ConnectionOutputHandler {
public:
OutputInterceptor(cluster::Connection& p, sys::ConnectionOutputHandler& h);
@@ -53,7 +53,7 @@
// Intercept doOutput requests on Connection.
bool doOutput();
- void closeOutput(sys::ConnectionOutputHandler& h);
+ void closeOutput();
cluster::Connection& parent;
@@ -70,6 +70,7 @@
WriteEstimate writeEstimate;
bool moreOutput;
bool doingOutput;
+ static NoOpConnectionOutputHandler discardHandler;
};
}} // namespace qpid::cluster
---------------------------------------------------------------------
Apache Qpid - AMQP Messaging Implementation
Project: http://qpid.apache.org
Use/Interact: mailto:commits-subscribe@qpid.apache.org