You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@qpid.apache.org by kp...@apache.org on 2012/07/16 15:54:13 UTC
svn commit: r1362039 [1/2] - in /qpid/branches/asyncstore/cpp/src: ./
qpid/asyncStore/ qpid/broker/ tests/ tests/storePerftools/asyncPerf/
Author: kpvdr
Date: Mon Jul 16 13:54:11 2012
New Revision: 1362039
URL: http://svn.apache.org/viewvc?rev=1362039&view=rev
Log:
QPID-3858: Refactor to tidy up several class design issues
Added:
qpid/branches/asyncstore/cpp/src/asyncstore.cmake
qpid/branches/asyncstore/cpp/src/qpid/asyncStore/AsyncStoreHandle.h
qpid/branches/asyncstore/cpp/src/qpid/broker/Handle.h
qpid/branches/asyncstore/cpp/src/qpid/broker/PrivateImplRef.h
qpid/branches/asyncstore/cpp/src/tests/asyncstore.cmake
qpid/branches/asyncstore/cpp/src/tests/storePerftools/asyncPerf/PersistableQueuedMessage.cpp
qpid/branches/asyncstore/cpp/src/tests/storePerftools/asyncPerf/PersistableQueuedMessage.h
Removed:
qpid/branches/asyncstore/cpp/src/qpid/broker/IdHandle.cpp
qpid/branches/asyncstore/cpp/src/qpid/broker/IdHandle.h
Modified:
qpid/branches/asyncstore/cpp/src/CMakeLists.txt
qpid/branches/asyncstore/cpp/src/qpid/asyncStore/AsyncOperation.cpp
qpid/branches/asyncstore/cpp/src/qpid/asyncStore/AsyncOperation.h
qpid/branches/asyncstore/cpp/src/qpid/asyncStore/AsyncStoreImpl.cpp
qpid/branches/asyncstore/cpp/src/qpid/asyncStore/AsyncStoreImpl.h
qpid/branches/asyncstore/cpp/src/qpid/asyncStore/AsyncStoreOptions.h
qpid/branches/asyncstore/cpp/src/qpid/asyncStore/ConfigHandleImpl.cpp
qpid/branches/asyncstore/cpp/src/qpid/asyncStore/EnqueueHandleImpl.cpp
qpid/branches/asyncstore/cpp/src/qpid/asyncStore/EnqueueHandleImpl.h
qpid/branches/asyncstore/cpp/src/qpid/asyncStore/EventHandleImpl.cpp
qpid/branches/asyncstore/cpp/src/qpid/asyncStore/EventHandleImpl.h
qpid/branches/asyncstore/cpp/src/qpid/asyncStore/MessageHandleImpl.cpp
qpid/branches/asyncstore/cpp/src/qpid/asyncStore/MessageHandleImpl.h
qpid/branches/asyncstore/cpp/src/qpid/asyncStore/OperationQueue.cpp
qpid/branches/asyncstore/cpp/src/qpid/asyncStore/OperationQueue.h
qpid/branches/asyncstore/cpp/src/qpid/asyncStore/Plugin.cpp
qpid/branches/asyncstore/cpp/src/qpid/asyncStore/Plugin.h
qpid/branches/asyncstore/cpp/src/qpid/asyncStore/QueueHandleImpl.cpp
qpid/branches/asyncstore/cpp/src/qpid/asyncStore/RunState.h
qpid/branches/asyncstore/cpp/src/qpid/asyncStore/TxnHandleImpl.cpp
qpid/branches/asyncstore/cpp/src/qpid/broker/AsyncResultHandle.cpp
qpid/branches/asyncstore/cpp/src/qpid/broker/AsyncResultHandle.h
qpid/branches/asyncstore/cpp/src/qpid/broker/AsyncResultQueueImpl.cpp
qpid/branches/asyncstore/cpp/src/qpid/broker/AsyncStore.h
qpid/branches/asyncstore/cpp/src/qpid/broker/ConfigHandle.cpp
qpid/branches/asyncstore/cpp/src/qpid/broker/ConfigHandle.h
qpid/branches/asyncstore/cpp/src/qpid/broker/EnqueueHandle.cpp
qpid/branches/asyncstore/cpp/src/qpid/broker/EnqueueHandle.h
qpid/branches/asyncstore/cpp/src/qpid/broker/EventHandle.cpp
qpid/branches/asyncstore/cpp/src/qpid/broker/EventHandle.h
qpid/branches/asyncstore/cpp/src/qpid/broker/MessageHandle.cpp
qpid/branches/asyncstore/cpp/src/qpid/broker/MessageHandle.h
qpid/branches/asyncstore/cpp/src/qpid/broker/QueueHandle.cpp
qpid/branches/asyncstore/cpp/src/qpid/broker/QueueHandle.h
qpid/branches/asyncstore/cpp/src/qpid/broker/TxnAsyncContext.cpp
qpid/branches/asyncstore/cpp/src/qpid/broker/TxnAsyncContext.h
qpid/branches/asyncstore/cpp/src/qpid/broker/TxnBuffer.cpp
qpid/branches/asyncstore/cpp/src/qpid/broker/TxnBuffer.h
qpid/branches/asyncstore/cpp/src/qpid/broker/TxnHandle.cpp
qpid/branches/asyncstore/cpp/src/qpid/broker/TxnHandle.h
qpid/branches/asyncstore/cpp/src/tests/CMakeLists.txt
qpid/branches/asyncstore/cpp/src/tests/storePerftools/asyncPerf/DeliveryRecord.cpp
qpid/branches/asyncstore/cpp/src/tests/storePerftools/asyncPerf/DeliveryRecord.h
qpid/branches/asyncstore/cpp/src/tests/storePerftools/asyncPerf/MessageDeque.cpp
qpid/branches/asyncstore/cpp/src/tests/storePerftools/asyncPerf/MessageDeque.h
qpid/branches/asyncstore/cpp/src/tests/storePerftools/asyncPerf/Messages.h
qpid/branches/asyncstore/cpp/src/tests/storePerftools/asyncPerf/PerfTest.cpp
qpid/branches/asyncstore/cpp/src/tests/storePerftools/asyncPerf/PerfTest.h
qpid/branches/asyncstore/cpp/src/tests/storePerftools/asyncPerf/QueueAsyncContext.h
qpid/branches/asyncstore/cpp/src/tests/storePerftools/asyncPerf/QueuedMessage.cpp
qpid/branches/asyncstore/cpp/src/tests/storePerftools/asyncPerf/QueuedMessage.h
qpid/branches/asyncstore/cpp/src/tests/storePerftools/asyncPerf/SimpleMessage.cpp
qpid/branches/asyncstore/cpp/src/tests/storePerftools/asyncPerf/SimpleMessage.h
qpid/branches/asyncstore/cpp/src/tests/storePerftools/asyncPerf/SimpleQueue.cpp
qpid/branches/asyncstore/cpp/src/tests/storePerftools/asyncPerf/SimpleQueue.h
qpid/branches/asyncstore/cpp/src/tests/storePerftools/asyncPerf/TxnAccept.cpp
qpid/branches/asyncstore/cpp/src/tests/storePerftools/asyncPerf/TxnPublish.cpp
Modified: qpid/branches/asyncstore/cpp/src/CMakeLists.txt
URL: http://svn.apache.org/viewvc/qpid/branches/asyncstore/cpp/src/CMakeLists.txt?rev=1362039&r1=1362038&r2=1362039&view=diff
==============================================================================
--- qpid/branches/asyncstore/cpp/src/CMakeLists.txt (original)
+++ qpid/branches/asyncstore/cpp/src/CMakeLists.txt Mon Jul 16 13:54:11 2012
@@ -666,6 +666,9 @@ include (rdma.cmake)
# Check for optional SSL support requirements
include (ssl.cmake)
+# Check for optional async store build requirements
+#include (asyncstore.cmake)
+
# Check for syslog capabilities not present on all systems
check_symbol_exists (LOG_AUTHPRIV "sys/syslog.h" HAVE_LOG_AUTHPRIV)
check_symbol_exists (LOG_FTP "sys/syslog.h" HAVE_LOG_FTP)
@@ -1147,6 +1150,13 @@ set (qpidbroker_SOURCES
qpid/management/ManagementDirectExchange.cpp
qpid/management/ManagementTopicExchange.cpp
qpid/sys/TCPIOPlugin.cpp
+# New async store objects and new versions of broker objects
+# qpid/broker/AsyncResultHandle.cpp
+# qpid/broker/AsyncResultHandleImpl.cpp
+# qpid/broker/IdHandle.cpp
+# qpid/broker/TxnAsyncContext.cpp
+# qpid/broker/TxnBuffer.cpp
+# qpid/broker/TxnHandle.cpp
)
add_msvc_version (qpidbroker library dll)
add_library (qpidbroker SHARED ${qpidbroker_SOURCES})
@@ -1459,71 +1469,12 @@ if (UNIX)
COMPONENT ${QPID_COMPONENT_COMMON})
endif (UNIX)
-
# Async Store support
-
-# Journal 2 source files
-set (jrnl2_SOURCES
- qpid/asyncStore/jrnl2/AsyncJournal.cpp
- qpid/asyncStore/jrnl2/DataOpState.cpp
- qpid/asyncStore/jrnl2/DataToken.cpp
- qpid/asyncStore/jrnl2/DataWrComplState.cpp
- qpid/asyncStore/jrnl2/DequeueHeader.cpp
- qpid/asyncStore/jrnl2/EnqueueHeader.cpp
- qpid/asyncStore/jrnl2/EventHeader.cpp
- qpid/asyncStore/jrnl2/FileHeader.cpp
- qpid/asyncStore/jrnl2/JournalDirectory.cpp
- qpid/asyncStore/jrnl2/JournalError.cpp
- qpid/asyncStore/jrnl2/JournalParameters.cpp
- qpid/asyncStore/jrnl2/JournalRunState.cpp
- qpid/asyncStore/jrnl2/RecordHeader.cpp
- qpid/asyncStore/jrnl2/RecordTail.cpp
- qpid/asyncStore/jrnl2/ScopedLock.cpp
- qpid/asyncStore/jrnl2/Streamable.cpp
- qpid/asyncStore/jrnl2/TransactionHeader.cpp
-)
-
-# AsyncStore source files
-set (asyncStore_SOURCES
- qpid/asyncStore/AsyncOperation.cpp
- qpid/asyncStore/AsyncStoreImpl.cpp
- qpid/asyncStore/AsyncStoreOptions.cpp
- qpid/asyncStore/ConfigHandleImpl.cpp
- qpid/asyncStore/EnqueueHandleImpl.cpp
- qpid/asyncStore/EventHandleImpl.cpp
- qpid/asyncStore/MessageHandleImpl.cpp
- qpid/asyncStore/OperationQueue.cpp
- qpid/asyncStore/Plugin.cpp
- qpid/asyncStore/QueueHandleImpl.cpp
- qpid/asyncStore/RunState.cpp
- qpid/asyncStore/TxnHandleImpl.cpp
- qpid/broker/AsyncResultHandle.cpp
- qpid/broker/AsyncResultHandleImpl.cpp
- qpid/broker/AsyncResultQueueImpl.cpp
- qpid/broker/ConfigHandle.cpp
- qpid/broker/EnqueueHandle.cpp
- qpid/broker/EventHandle.cpp
- qpid/broker/IdHandle.cpp
- qpid/broker/MessageHandle.cpp
- qpid/broker/QueueHandle.cpp
- qpid/broker/TxnAsyncContext.cpp
- qpid/broker/TxnBuffer.cpp
- qpid/broker/TxnHandle.cpp
-)
-
-if (UNIX)
- add_library (asyncStore MODULE
- ${jrnl2_SOURCES}
- ${asyncStore_SOURCES}
- )
- set_target_properties (asyncStore PROPERTIES
- PREFIX ""
- OUTPUT_NAME asyncStore
- SOVERSION ${asyncStore_version}
- )
- target_link_libraries (asyncStore
- aio
- rt
- uuid
- )
-endif (UNIX)
+# -------------------
+# NOTE: Currently this must be included AFTER the "add_subdirectory(tests)"
+# line (a few lines above) to work - otherwise cmake complains of linking
+# to lib of type MODULE_LIBRARY (the fact that position of include makes a
+# difference might be a possible CMake bug?). The link issue is being
+# corrected separately, and when it is, this can be moved up to the location
+# of the other module includes.
+include (asyncstore.cmake)
Added: qpid/branches/asyncstore/cpp/src/asyncstore.cmake
URL: http://svn.apache.org/viewvc/qpid/branches/asyncstore/cpp/src/asyncstore.cmake?rev=1362039&view=auto
==============================================================================
--- qpid/branches/asyncstore/cpp/src/asyncstore.cmake (added)
+++ qpid/branches/asyncstore/cpp/src/asyncstore.cmake Mon Jul 16 13:54:11 2012
@@ -0,0 +1,86 @@
+#
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements. See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership. The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License. You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied. See the License for the
+# specific language governing permissions and limitations
+# under the License.
+#
+#
+# Async store library CMake fragment, to be included in CMakeLists.txt
+#
+
+# Journal 2 source files
+set (jrnl2_SOURCES
+ qpid/asyncStore/jrnl2/AsyncJournal.cpp
+ qpid/asyncStore/jrnl2/DataOpState.cpp
+ qpid/asyncStore/jrnl2/DataToken.cpp
+ qpid/asyncStore/jrnl2/DataWrComplState.cpp
+ qpid/asyncStore/jrnl2/DequeueHeader.cpp
+ qpid/asyncStore/jrnl2/EnqueueHeader.cpp
+ qpid/asyncStore/jrnl2/EventHeader.cpp
+ qpid/asyncStore/jrnl2/FileHeader.cpp
+ qpid/asyncStore/jrnl2/JournalDirectory.cpp
+ qpid/asyncStore/jrnl2/JournalError.cpp
+ qpid/asyncStore/jrnl2/JournalParameters.cpp
+ qpid/asyncStore/jrnl2/JournalRunState.cpp
+ qpid/asyncStore/jrnl2/RecordHeader.cpp
+ qpid/asyncStore/jrnl2/RecordTail.cpp
+ qpid/asyncStore/jrnl2/ScopedLock.cpp
+ qpid/asyncStore/jrnl2/Streamable.cpp
+ qpid/asyncStore/jrnl2/TransactionHeader.cpp
+)
+
+# AsyncStore source files
+set (asyncStore_SOURCES
+ qpid/asyncStore/AsyncOperation.cpp
+ qpid/asyncStore/AsyncStoreImpl.cpp
+ qpid/asyncStore/AsyncStoreOptions.cpp
+ qpid/asyncStore/ConfigHandleImpl.cpp
+ qpid/asyncStore/EnqueueHandleImpl.cpp
+ qpid/asyncStore/EventHandleImpl.cpp
+ qpid/asyncStore/MessageHandleImpl.cpp
+ qpid/asyncStore/OperationQueue.cpp
+ qpid/asyncStore/Plugin.cpp
+ qpid/asyncStore/QueueHandleImpl.cpp
+ qpid/asyncStore/RunState.cpp
+ qpid/asyncStore/TxnHandleImpl.cpp
+ qpid/broker/AsyncResultHandle.cpp
+ qpid/broker/AsyncResultHandleImpl.cpp
+ qpid/broker/AsyncResultQueueImpl.cpp
+ qpid/broker/ConfigHandle.cpp
+ qpid/broker/EnqueueHandle.cpp
+ qpid/broker/EventHandle.cpp
+ qpid/broker/MessageHandle.cpp
+ qpid/broker/QueueHandle.cpp
+ qpid/broker/TxnAsyncContext.cpp
+ qpid/broker/TxnBuffer.cpp
+ qpid/broker/TxnHandle.cpp
+)
+
+if (UNIX)
+ add_library (asyncStore MODULE
+ ${jrnl2_SOURCES}
+ ${asyncStore_SOURCES}
+ )
+ set_target_properties (asyncStore PROPERTIES
+ PREFIX ""
+ OUTPUT_NAME asyncStore
+ SOVERSION ${asyncStore_version}
+ )
+ target_link_libraries (asyncStore
+ aio
+ rt
+ uuid
+ )
+endif (UNIX)
Modified: qpid/branches/asyncstore/cpp/src/qpid/asyncStore/AsyncOperation.cpp
URL: http://svn.apache.org/viewvc/qpid/branches/asyncstore/cpp/src/qpid/asyncStore/AsyncOperation.cpp?rev=1362039&r1=1362038&r2=1362039&view=diff
==============================================================================
--- qpid/branches/asyncstore/cpp/src/qpid/asyncStore/AsyncOperation.cpp (original)
+++ qpid/branches/asyncstore/cpp/src/qpid/asyncStore/AsyncOperation.cpp Mon Jul 16 13:54:11 2012
@@ -38,7 +38,7 @@ AsyncOperation::AsyncOperation() :
{}
AsyncOperation::AsyncOperation(const opCode op,
- const qpid::broker::IdHandle* th,
+ const AsyncStoreHandle* th,
boost::shared_ptr<qpid::broker::BrokerAsyncContext> brokerCtxt) :
m_op(op),
m_targetHandle(th),
@@ -48,7 +48,7 @@ AsyncOperation::AsyncOperation(const opC
{}
AsyncOperation::AsyncOperation(const opCode op,
- const qpid::broker::IdHandle* th,
+ const AsyncStoreHandle* th,
const qpid::broker::DataSource* const dataSrc,
boost::shared_ptr<qpid::broker::BrokerAsyncContext> brokerCtxt) :
m_op(op),
@@ -59,7 +59,7 @@ AsyncOperation::AsyncOperation(const opC
{}
AsyncOperation::AsyncOperation(const opCode op,
- const qpid::broker::IdHandle* th,
+ const AsyncStoreHandle* th,
const qpid::broker::TxnHandle* txnHandle,
boost::shared_ptr<qpid::broker::BrokerAsyncContext> brokerCtxt) :
m_op(op),
@@ -70,7 +70,7 @@ AsyncOperation::AsyncOperation(const opC
{}
AsyncOperation::AsyncOperation(const opCode op,
- const qpid::broker::IdHandle* th,
+ const AsyncStoreHandle* th,
const qpid::broker::DataSource* const dataSrc,
const qpid::broker::TxnHandle* txnHandle,
boost::shared_ptr<qpid::broker::BrokerAsyncContext> brokerCtxt) :
Modified: qpid/branches/asyncstore/cpp/src/qpid/asyncStore/AsyncOperation.h
URL: http://svn.apache.org/viewvc/qpid/branches/asyncstore/cpp/src/qpid/asyncStore/AsyncOperation.h?rev=1362039&r1=1362038&r2=1362039&view=diff
==============================================================================
--- qpid/branches/asyncstore/cpp/src/qpid/asyncStore/AsyncOperation.h (original)
+++ qpid/branches/asyncstore/cpp/src/qpid/asyncStore/AsyncOperation.h Mon Jul 16 13:54:11 2012
@@ -25,10 +25,10 @@
#define qpid_asyncStore_AsyncOperation_h_
#include "qpid/broker/AsyncStore.h"
-#include "qpid/broker/IdHandle.h"
namespace qpid {
namespace asyncStore {
+class AsyncStoreHandle;
class AsyncOperation {
public:
@@ -49,18 +49,18 @@ public:
AsyncOperation();
AsyncOperation(const opCode op,
- const qpid::broker::IdHandle* th,
+ const AsyncStoreHandle* th,
boost::shared_ptr<qpid::broker::BrokerAsyncContext> brokerCtxt);
AsyncOperation(const opCode op,
- const qpid::broker::IdHandle* th,
+ const AsyncStoreHandle* th,
const qpid::broker::DataSource* const dataSrc,
boost::shared_ptr<qpid::broker::BrokerAsyncContext> brokerCtxt);
AsyncOperation(const opCode op,
- const qpid::broker::IdHandle* th,
+ const AsyncStoreHandle* th,
const qpid::broker::TxnHandle* txnHandle,
boost::shared_ptr<qpid::broker::BrokerAsyncContext> brokerCtxt);
AsyncOperation(const opCode op,
- const qpid::broker::IdHandle* th,
+ const AsyncStoreHandle* th,
const qpid::broker::DataSource* const dataSrc,
const qpid::broker::TxnHandle* txnHandle,
boost::shared_ptr<qpid::broker::BrokerAsyncContext> brokerCtxt);
@@ -71,7 +71,7 @@ public:
private:
opCode m_op;
- const qpid::broker::IdHandle* m_targetHandle;
+ const AsyncStoreHandle* m_targetHandle;
const qpid::broker::DataSource* const m_dataSrc;
const qpid::broker::TxnHandle* m_txnHandle;
boost::shared_ptr<qpid::broker::BrokerAsyncContext> const m_brokerCtxt;
Added: qpid/branches/asyncstore/cpp/src/qpid/asyncStore/AsyncStoreHandle.h
URL: http://svn.apache.org/viewvc/qpid/branches/asyncstore/cpp/src/qpid/asyncStore/AsyncStoreHandle.h?rev=1362039&view=auto
==============================================================================
--- qpid/branches/asyncstore/cpp/src/qpid/asyncStore/AsyncStoreHandle.h (added)
+++ qpid/branches/asyncstore/cpp/src/qpid/asyncStore/AsyncStoreHandle.h Mon Jul 16 13:54:11 2012
@@ -0,0 +1,37 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+/**
+ * \file AsyncStoreHandle.h
+ */
+
+#ifndef qpid_asyncStore_AsyncStoreHandle_h_
+#define qpid_asyncStore_AsyncStoreHandle_h_
+
+namespace qpid {
+namespace asyncStore {
+
+class AsyncStoreHandle {
+public:
+ virtual ~AsyncStoreHandle() {}
+};
+
+}} // namespace qpid::asyncStore
+
+#endif // qpid_asyncStore_AsyncStoreHandle_h_
Modified: qpid/branches/asyncstore/cpp/src/qpid/asyncStore/AsyncStoreImpl.cpp
URL: http://svn.apache.org/viewvc/qpid/branches/asyncstore/cpp/src/qpid/asyncStore/AsyncStoreImpl.cpp?rev=1362039&r1=1362038&r2=1362039&view=diff
==============================================================================
--- qpid/branches/asyncstore/cpp/src/qpid/asyncStore/AsyncStoreImpl.cpp (original)
+++ qpid/branches/asyncstore/cpp/src/qpid/asyncStore/AsyncStoreImpl.cpp Mon Jul 16 13:54:11 2012
@@ -23,7 +23,11 @@
#include "AsyncStoreImpl.h"
-#include "AsyncOperation.h"
+#include "ConfigHandleImpl.h"
+#include "EnqueueHandleImpl.h"
+#include "EventHandleImpl.h"
+#include "MessageHandleImpl.h"
+#include "QueueHandleImpl.h"
#include "TxnHandleImpl.h"
#include "qpid/broker/ConfigHandle.h"
@@ -33,8 +37,6 @@
#include "qpid/broker/QueueHandle.h"
#include "qpid/broker/TxnHandle.h"
-#include <boost/intrusive_ptr.hpp>
-
namespace qpid {
namespace asyncStore {
@@ -88,6 +90,36 @@ AsyncStoreImpl::createTxnHandle(const st
return qpid::broker::TxnHandle(new TxnHandleImpl(xid, tb));
}
+void
+AsyncStoreImpl::submitPrepare(qpid::broker::TxnHandle& txnHandle,
+ boost::shared_ptr<qpid::broker::BrokerAsyncContext> brokerCtxt)
+{
+ boost::shared_ptr<const AsyncOperation> op(new AsyncOperation(AsyncOperation::TXN_PREPARE,
+ dynamic_cast<AsyncStoreHandle*>(&txnHandle),
+ brokerCtxt));
+ m_operations.submit(op);
+}
+
+void
+AsyncStoreImpl::submitCommit(qpid::broker::TxnHandle& txnHandle,
+ boost::shared_ptr<qpid::broker::BrokerAsyncContext> brokerCtxt)
+{
+ boost::shared_ptr<const AsyncOperation> op(new AsyncOperation(AsyncOperation::TXN_COMMIT,
+ dynamic_cast<AsyncStoreHandle*>(&txnHandle),
+ brokerCtxt));
+ m_operations.submit(op);
+}
+
+void
+AsyncStoreImpl::submitAbort(qpid::broker::TxnHandle& txnHandle,
+ boost::shared_ptr<qpid::broker::BrokerAsyncContext> brokerCtxt)
+{
+ boost::shared_ptr<const AsyncOperation> op(new AsyncOperation(AsyncOperation::TXN_ABORT,
+ dynamic_cast<AsyncStoreHandle*>(&txnHandle),
+ brokerCtxt));
+ m_operations.submit(op);
+}
+
qpid::broker::ConfigHandle
AsyncStoreImpl::createConfigHandle()
{
@@ -98,14 +130,16 @@ qpid::broker::EnqueueHandle
AsyncStoreImpl::createEnqueueHandle(qpid::broker::MessageHandle& msgHandle,
qpid::broker::QueueHandle& queueHandle)
{
- return qpid::broker::EnqueueHandle(new EnqueueHandleImpl(msgHandle, queueHandle));
+ return qpid::broker::EnqueueHandle(new EnqueueHandleImpl(msgHandle,
+ queueHandle));
}
qpid::broker::EventHandle
AsyncStoreImpl::createEventHandle(qpid::broker::QueueHandle& queueHandle,
const std::string& key)
{
- return qpid::broker::EventHandle(new EventHandleImpl(queueHandle, key));
+ return qpid::broker::EventHandle(new EventHandleImpl(queueHandle,
+ key));
}
qpid::broker::MessageHandle
@@ -123,42 +157,12 @@ AsyncStoreImpl::createQueueHandle(const
}
void
-AsyncStoreImpl::submitPrepare(qpid::broker::TxnHandle& txnHandle,
- boost::shared_ptr<qpid::broker::BrokerAsyncContext> brokerCtxt)
-{
- boost::shared_ptr<const AsyncOperation> op(new AsyncOperation(AsyncOperation::TXN_PREPARE,
- dynamic_cast<qpid::broker::IdHandle*>(&txnHandle),
- brokerCtxt));
- m_operations.submit(op);
-}
-
-void
-AsyncStoreImpl::submitCommit(qpid::broker::TxnHandle& txnHandle,
- boost::shared_ptr<qpid::broker::BrokerAsyncContext> brokerCtxt)
-{
- boost::shared_ptr<const AsyncOperation> op(new AsyncOperation(AsyncOperation::TXN_COMMIT,
- dynamic_cast<qpid::broker::IdHandle*>(&txnHandle),
- brokerCtxt));
- m_operations.submit(op);
-}
-
-void
-AsyncStoreImpl::submitAbort(qpid::broker::TxnHandle& txnHandle,
- boost::shared_ptr<qpid::broker::BrokerAsyncContext> brokerCtxt)
-{
- boost::shared_ptr<const AsyncOperation> op(new AsyncOperation(AsyncOperation::TXN_ABORT,
- dynamic_cast<qpid::broker::IdHandle*>(&txnHandle),
- brokerCtxt));
- m_operations.submit(op);
-}
-
-void
AsyncStoreImpl::submitCreate(qpid::broker::ConfigHandle& cfgHandle,
const qpid::broker::DataSource* const dataSrc,
boost::shared_ptr<qpid::broker::BrokerAsyncContext> brokerCtxt)
{
boost::shared_ptr<const AsyncOperation> op(new AsyncOperation(AsyncOperation::CONFIG_CREATE,
- dynamic_cast<qpid::broker::IdHandle*>(&cfgHandle),
+ dynamic_cast<AsyncStoreHandle*>(&cfgHandle),
dataSrc,
brokerCtxt));
m_operations.submit(op);
@@ -169,7 +173,7 @@ AsyncStoreImpl::submitDestroy(qpid::brok
boost::shared_ptr<qpid::broker::BrokerAsyncContext> brokerCtxt)
{
boost::shared_ptr<const AsyncOperation> op(new AsyncOperation(AsyncOperation::CONFIG_DESTROY,
- dynamic_cast<qpid::broker::IdHandle*>(&cfgHandle),
+ dynamic_cast<AsyncStoreHandle*>(&cfgHandle),
brokerCtxt));
m_operations.submit(op);
}
@@ -180,7 +184,7 @@ AsyncStoreImpl::submitCreate(qpid::broke
boost::shared_ptr<qpid::broker::BrokerAsyncContext> brokerCtxt)
{
boost::shared_ptr<const AsyncOperation> op(new AsyncOperation(AsyncOperation::QUEUE_CREATE,
- dynamic_cast<qpid::broker::IdHandle*>(&queueHandle),
+ dynamic_cast<AsyncStoreHandle*>(&queueHandle),
dataSrc,
brokerCtxt));
m_operations.submit(op);
@@ -191,7 +195,7 @@ AsyncStoreImpl::submitDestroy(qpid::brok
boost::shared_ptr<qpid::broker::BrokerAsyncContext> brokerCtxt)
{
boost::shared_ptr<const AsyncOperation> op(new AsyncOperation(AsyncOperation::QUEUE_DESTROY,
- dynamic_cast<qpid::broker::IdHandle*>(&queueHandle),
+ dynamic_cast<AsyncStoreHandle*>(&queueHandle),
brokerCtxt));
m_operations.submit(op);
}
@@ -201,19 +205,7 @@ AsyncStoreImpl::submitFlush(qpid::broker
boost::shared_ptr<qpid::broker::BrokerAsyncContext> brokerCtxt)
{
boost::shared_ptr<const AsyncOperation> op(new AsyncOperation(AsyncOperation::QUEUE_FLUSH,
- dynamic_cast<qpid::broker::IdHandle*>(&queueHandle),
- brokerCtxt));
- m_operations.submit(op);
-}
-
-void
-AsyncStoreImpl::submitCreate(qpid::broker::EventHandle& eventHandle,
- const qpid::broker::DataSource* const dataSrc,
- boost::shared_ptr<qpid::broker::BrokerAsyncContext> brokerCtxt)
-{
- boost::shared_ptr<const AsyncOperation> op(new AsyncOperation(AsyncOperation::EVENT_CREATE,
- dynamic_cast<qpid::broker::IdHandle*>(&eventHandle),
- dataSrc,
+ dynamic_cast<AsyncStoreHandle*>(&queueHandle),
brokerCtxt));
m_operations.submit(op);
}
@@ -225,7 +217,7 @@ AsyncStoreImpl::submitCreate(qpid::broke
boost::shared_ptr<qpid::broker::BrokerAsyncContext> brokerCtxt)
{
boost::shared_ptr<const AsyncOperation> op(new AsyncOperation(AsyncOperation::EVENT_CREATE,
- dynamic_cast<qpid::broker::IdHandle*>(&eventHandle),
+ dynamic_cast<AsyncStoreHandle*>(&eventHandle),
dataSrc,
&txnHandle,
brokerCtxt));
@@ -234,21 +226,11 @@ AsyncStoreImpl::submitCreate(qpid::broke
void
AsyncStoreImpl::submitDestroy(qpid::broker::EventHandle& eventHandle,
- boost::shared_ptr<qpid::broker::BrokerAsyncContext> brokerCtxt)
-{
- boost::shared_ptr<const AsyncOperation> op(new AsyncOperation(AsyncOperation::EVENT_DESTROY,
- dynamic_cast<qpid::broker::IdHandle*>(&eventHandle),
- brokerCtxt));
- m_operations.submit(op);
-}
-
-void
-AsyncStoreImpl::submitDestroy(qpid::broker::EventHandle& eventHandle,
qpid::broker::TxnHandle& txnHandle,
boost::shared_ptr<qpid::broker::BrokerAsyncContext> brokerCtxt)
{
boost::shared_ptr<const AsyncOperation> op(new AsyncOperation(AsyncOperation::EVENT_DESTROY,
- dynamic_cast<qpid::broker::IdHandle*>(&eventHandle),
+ dynamic_cast<AsyncStoreHandle*>(&eventHandle),
&txnHandle,
brokerCtxt));
m_operations.submit(op);
@@ -260,7 +242,7 @@ AsyncStoreImpl::submitEnqueue(qpid::brok
boost::shared_ptr<qpid::broker::BrokerAsyncContext> brokerCtxt)
{
boost::shared_ptr<const AsyncOperation> op(new AsyncOperation(AsyncOperation::MSG_ENQUEUE,
- dynamic_cast<qpid::broker::IdHandle*>(&enqHandle),
+ dynamic_cast<AsyncStoreHandle*>(&enqHandle),
&txnHandle,
brokerCtxt));
m_operations.submit(op);
@@ -272,7 +254,7 @@ AsyncStoreImpl::submitDequeue(qpid::brok
boost::shared_ptr<qpid::broker::BrokerAsyncContext> brokerCtxt)
{
boost::shared_ptr<const AsyncOperation> op(new AsyncOperation(AsyncOperation::MSG_DEQUEUE,
- dynamic_cast<qpid::broker::IdHandle*>(&enqHandle),
+ dynamic_cast<AsyncStoreHandle*>(&enqHandle),
&txnHandle,
brokerCtxt));
m_operations.submit(op);
Modified: qpid/branches/asyncstore/cpp/src/qpid/asyncStore/AsyncStoreImpl.h
URL: http://svn.apache.org/viewvc/qpid/branches/asyncstore/cpp/src/qpid/asyncStore/AsyncStoreImpl.h?rev=1362039&r1=1362038&r2=1362039&view=diff
==============================================================================
--- qpid/branches/asyncstore/cpp/src/qpid/asyncStore/AsyncStoreImpl.h (original)
+++ qpid/branches/asyncstore/cpp/src/qpid/asyncStore/AsyncStoreImpl.h Mon Jul 16 13:54:11 2012
@@ -30,17 +30,19 @@
#include "qpid/asyncStore/jrnl2/RecordIdCounter.h"
#include "qpid/broker/AsyncStore.h"
-#include "qpid/sys/Poller.h"
namespace qpid {
-
namespace broker {
class Broker;
-} // namespace qpid::broker
+}
+
+namespace sys {
+class Poller;
+}
namespace asyncStore {
-class AsyncStoreImpl: public qpid::broker::AsyncStore {
+class AsyncStoreImpl : public qpid::broker::AsyncStore {
public:
AsyncStoreImpl(boost::shared_ptr<qpid::sys::Poller> poller,
const AsyncStoreOptions& opts);
@@ -52,12 +54,23 @@ public:
void initManagement(qpid::broker::Broker* broker);
- // --- Factory methods for creating handles ---
+ // --- Interface from AsyncTransactionalStore ---
qpid::broker::TxnHandle createTxnHandle();
qpid::broker::TxnHandle createTxnHandle(qpid::broker::TxnBuffer* tb);
qpid::broker::TxnHandle createTxnHandle(const std::string& xid);
- qpid::broker::TxnHandle createTxnHandle(const std::string& xid, qpid::broker::TxnBuffer* tb);
+ qpid::broker::TxnHandle createTxnHandle(const std::string& xid,
+ qpid::broker::TxnBuffer* tb);
+
+ void submitPrepare(qpid::broker::TxnHandle& txnHandle,
+ boost::shared_ptr<qpid::broker::BrokerAsyncContext> brokerCtxt);
+ void submitCommit(qpid::broker::TxnHandle& txnHandle,
+ boost::shared_ptr<qpid::broker::BrokerAsyncContext> brokerCtxt);
+ void submitAbort(qpid::broker::TxnHandle& txnHandle,
+ boost::shared_ptr<qpid::broker::BrokerAsyncContext> brokerCtxt);
+
+
+ // --- Interface from AsyncStore ---
qpid::broker::ConfigHandle createConfigHandle();
qpid::broker::EnqueueHandle createEnqueueHandle(qpid::broker::MessageHandle& msgHandle,
@@ -68,16 +81,6 @@ public:
qpid::broker::QueueHandle createQueueHandle(const std::string& name,
const qpid::types::Variant::Map& opts);
-
- // --- Store async interface ---
-
- void submitPrepare(qpid::broker::TxnHandle& txnHandle,
- boost::shared_ptr<qpid::broker::BrokerAsyncContext> brokerCtxt);
- void submitCommit(qpid::broker::TxnHandle& txnHandle,
- boost::shared_ptr<qpid::broker::BrokerAsyncContext> brokerCtxt);
- void submitAbort(qpid::broker::TxnHandle& txnHandle,
- boost::shared_ptr<qpid::broker::BrokerAsyncContext> brokerCtxt);
-
void submitCreate(qpid::broker::ConfigHandle& cfgHandle,
const qpid::broker::DataSource* const dataSrc,
boost::shared_ptr<qpid::broker::BrokerAsyncContext> brokerCtxt);
@@ -94,14 +97,9 @@ public:
void submitCreate(qpid::broker::EventHandle& eventHandle,
const qpid::broker::DataSource* const dataSrc,
- boost::shared_ptr<qpid::broker::BrokerAsyncContext> brokerCtxt);
- void submitCreate(qpid::broker::EventHandle& eventHandle,
- const qpid::broker::DataSource* const dataSrc,
qpid::broker::TxnHandle& txnHandle,
boost::shared_ptr<qpid::broker::BrokerAsyncContext> brokerCtxt);
void submitDestroy(qpid::broker::EventHandle& eventHandle,
- boost::shared_ptr<qpid::broker::BrokerAsyncContext> brokerCtxt);
- void submitDestroy(qpid::broker::EventHandle& eventHandle,
qpid::broker::TxnHandle& txnHandle,
boost::shared_ptr<qpid::broker::BrokerAsyncContext> brokerCtxt);
Modified: qpid/branches/asyncstore/cpp/src/qpid/asyncStore/AsyncStoreOptions.h
URL: http://svn.apache.org/viewvc/qpid/branches/asyncstore/cpp/src/qpid/asyncStore/AsyncStoreOptions.h?rev=1362039&r1=1362038&r2=1362039&view=diff
==============================================================================
--- qpid/branches/asyncstore/cpp/src/qpid/asyncStore/AsyncStoreOptions.h (original)
+++ qpid/branches/asyncstore/cpp/src/qpid/asyncStore/AsyncStoreOptions.h Mon Jul 16 13:54:11 2012
@@ -24,16 +24,11 @@
#ifndef qpid_asyncStore_AsyncStoreOptions_h_
#define qpid_asyncStore_AsyncStoreOptions_h_
-#include "qpid/asyncStore/jrnl2/Streamable.h"
-
#include "qpid/Options.h"
#include <string>
namespace qpid {
-namespace broker {
-class Options;
-}
namespace asyncStore {
class AsyncStoreOptions : public qpid::Options
@@ -49,7 +44,8 @@ public:
std::string m_storeDir;
private:
- // Static initialization race condition avoidance with static instance of Plugin class (using construct-on-first-use idiom).
+ // Static initialization race condition avoidance with static instance of Plugin class
+ // (using construct-on-first-use idiom).
static std::string& getDefaultStoreDir();
};
Modified: qpid/branches/asyncstore/cpp/src/qpid/asyncStore/ConfigHandleImpl.cpp
URL: http://svn.apache.org/viewvc/qpid/branches/asyncstore/cpp/src/qpid/asyncStore/ConfigHandleImpl.cpp?rev=1362039&r1=1362038&r2=1362039&view=diff
==============================================================================
--- qpid/branches/asyncstore/cpp/src/qpid/asyncStore/ConfigHandleImpl.cpp (original)
+++ qpid/branches/asyncstore/cpp/src/qpid/asyncStore/ConfigHandleImpl.cpp Mon Jul 16 13:54:11 2012
@@ -23,8 +23,6 @@
#include "ConfigHandleImpl.h"
-#include "qpid/messaging/PrivateImplRef.h"
-
namespace qpid {
namespace asyncStore {
Modified: qpid/branches/asyncstore/cpp/src/qpid/asyncStore/EnqueueHandleImpl.cpp
URL: http://svn.apache.org/viewvc/qpid/branches/asyncstore/cpp/src/qpid/asyncStore/EnqueueHandleImpl.cpp?rev=1362039&r1=1362038&r2=1362039&view=diff
==============================================================================
--- qpid/branches/asyncstore/cpp/src/qpid/asyncStore/EnqueueHandleImpl.cpp (original)
+++ qpid/branches/asyncstore/cpp/src/qpid/asyncStore/EnqueueHandleImpl.cpp Mon Jul 16 13:54:11 2012
@@ -23,8 +23,6 @@
#include "EnqueueHandleImpl.h"
-#include "qpid/messaging/PrivateImplRef.h"
-
namespace qpid {
namespace asyncStore {
Modified: qpid/branches/asyncstore/cpp/src/qpid/asyncStore/EnqueueHandleImpl.h
URL: http://svn.apache.org/viewvc/qpid/branches/asyncstore/cpp/src/qpid/asyncStore/EnqueueHandleImpl.h?rev=1362039&r1=1362038&r2=1362039&view=diff
==============================================================================
--- qpid/branches/asyncstore/cpp/src/qpid/asyncStore/EnqueueHandleImpl.h (original)
+++ qpid/branches/asyncstore/cpp/src/qpid/asyncStore/EnqueueHandleImpl.h Mon Jul 16 13:54:11 2012
@@ -27,7 +27,6 @@
#include "qpid/RefCounted.h"
namespace qpid {
-
namespace broker {
class MessageHandle;
class QueueHandle;
Modified: qpid/branches/asyncstore/cpp/src/qpid/asyncStore/EventHandleImpl.cpp
URL: http://svn.apache.org/viewvc/qpid/branches/asyncstore/cpp/src/qpid/asyncStore/EventHandleImpl.cpp?rev=1362039&r1=1362038&r2=1362039&view=diff
==============================================================================
--- qpid/branches/asyncstore/cpp/src/qpid/asyncStore/EventHandleImpl.cpp (original)
+++ qpid/branches/asyncstore/cpp/src/qpid/asyncStore/EventHandleImpl.cpp Mon Jul 16 13:54:11 2012
@@ -23,8 +23,6 @@
#include "EventHandleImpl.h"
-#include "qpid/messaging/PrivateImplRef.h"
-
namespace qpid {
namespace asyncStore {
Modified: qpid/branches/asyncstore/cpp/src/qpid/asyncStore/EventHandleImpl.h
URL: http://svn.apache.org/viewvc/qpid/branches/asyncstore/cpp/src/qpid/asyncStore/EventHandleImpl.h?rev=1362039&r1=1362038&r2=1362039&view=diff
==============================================================================
--- qpid/branches/asyncstore/cpp/src/qpid/asyncStore/EventHandleImpl.h (original)
+++ qpid/branches/asyncstore/cpp/src/qpid/asyncStore/EventHandleImpl.h Mon Jul 16 13:54:11 2012
@@ -27,7 +27,6 @@
#include "qpid/RefCounted.h"
namespace qpid {
-
namespace broker {
class QueueHandle;
}
Modified: qpid/branches/asyncstore/cpp/src/qpid/asyncStore/MessageHandleImpl.cpp
URL: http://svn.apache.org/viewvc/qpid/branches/asyncstore/cpp/src/qpid/asyncStore/MessageHandleImpl.cpp?rev=1362039&r1=1362038&r2=1362039&view=diff
==============================================================================
--- qpid/branches/asyncstore/cpp/src/qpid/asyncStore/MessageHandleImpl.cpp (original)
+++ qpid/branches/asyncstore/cpp/src/qpid/asyncStore/MessageHandleImpl.cpp Mon Jul 16 13:54:11 2012
@@ -23,8 +23,6 @@
#include "MessageHandleImpl.h"
-#include "qpid/messaging/PrivateImplRef.h"
-
namespace qpid {
namespace asyncStore {
Modified: qpid/branches/asyncstore/cpp/src/qpid/asyncStore/MessageHandleImpl.h
URL: http://svn.apache.org/viewvc/qpid/branches/asyncstore/cpp/src/qpid/asyncStore/MessageHandleImpl.h?rev=1362039&r1=1362038&r2=1362039&view=diff
==============================================================================
--- qpid/branches/asyncstore/cpp/src/qpid/asyncStore/MessageHandleImpl.h (original)
+++ qpid/branches/asyncstore/cpp/src/qpid/asyncStore/MessageHandleImpl.h Mon Jul 16 13:54:11 2012
@@ -27,7 +27,6 @@
#include "qpid/RefCounted.h"
namespace qpid {
-
namespace broker {
class DataSource;
}
Modified: qpid/branches/asyncstore/cpp/src/qpid/asyncStore/OperationQueue.cpp
URL: http://svn.apache.org/viewvc/qpid/branches/asyncstore/cpp/src/qpid/asyncStore/OperationQueue.cpp?rev=1362039&r1=1362038&r2=1362039&view=diff
==============================================================================
--- qpid/branches/asyncstore/cpp/src/qpid/asyncStore/OperationQueue.cpp (original)
+++ qpid/branches/asyncstore/cpp/src/qpid/asyncStore/OperationQueue.cpp Mon Jul 16 13:54:11 2012
@@ -24,6 +24,8 @@
#include "OperationQueue.h"
#include "qpid/broker/AsyncResultHandle.h"
+#include "qpid/broker/AsyncResultHandleImpl.h"
+#include "qpid/log/Statement.h"
namespace qpid {
namespace asyncStore {
@@ -42,7 +44,6 @@ OperationQueue::~OperationQueue()
void
OperationQueue::submit(boost::shared_ptr<const AsyncOperation> op)
{
-//std::cout << "--> OperationQueue::submit() op=" << op->getOpStr() << std::endl << std::flush;
m_opQueue.push(op);
}
@@ -52,7 +53,6 @@ OperationQueue::handle(const OperationQu
{
try {
for (OpQueue::Batch::const_iterator i = e.begin(); i != e.end(); ++i) {
-//std::cout << "<-- OperationQueue::handle() Op=" << (*i)->getOpStr() << std::endl << std::flush;
boost::shared_ptr<qpid::broker::BrokerAsyncContext> bc = (*i)->getBrokerContext();
if (bc) {
qpid::broker::AsyncResultQueue* const arq = bc->getAsyncResultQueue();
@@ -64,9 +64,9 @@ OperationQueue::handle(const OperationQu
}
}
} catch (const std::exception& e) {
- std::cerr << "qpid::asyncStore::OperationQueue: Exception thrown processing async op: " << e.what() << std::endl;
+ QPID_LOG(error, "qpid::asyncStore::OperationQueue: Exception thrown processing async op: " << e.what());
} catch (...) {
- std::cerr << "qpid::asyncStore::OperationQueue: Unknown exception thrown processing async op" << std::endl;
+ QPID_LOG(error, "qpid::asyncStore::OperationQueue: Unknown exception thrown processing async op");
}
return e.end();
}
Modified: qpid/branches/asyncstore/cpp/src/qpid/asyncStore/OperationQueue.h
URL: http://svn.apache.org/viewvc/qpid/branches/asyncstore/cpp/src/qpid/asyncStore/OperationQueue.h?rev=1362039&r1=1362038&r2=1362039&view=diff
==============================================================================
--- qpid/branches/asyncstore/cpp/src/qpid/asyncStore/OperationQueue.h (original)
+++ qpid/branches/asyncstore/cpp/src/qpid/asyncStore/OperationQueue.h Mon Jul 16 13:54:11 2012
@@ -26,7 +26,7 @@
#include "AsyncOperation.h"
-#include "qpid/broker/AsyncStore.h"
+//#include "qpid/broker/AsyncStore.h"
#include "qpid/sys/PollableQueue.h"
namespace qpid {
Modified: qpid/branches/asyncstore/cpp/src/qpid/asyncStore/Plugin.cpp
URL: http://svn.apache.org/viewvc/qpid/branches/asyncstore/cpp/src/qpid/asyncStore/Plugin.cpp?rev=1362039&r1=1362038&r2=1362039&view=diff
==============================================================================
--- qpid/branches/asyncstore/cpp/src/qpid/asyncStore/Plugin.cpp (original)
+++ qpid/branches/asyncstore/cpp/src/qpid/asyncStore/Plugin.cpp Mon Jul 16 13:54:11 2012
@@ -23,6 +23,8 @@
#include "Plugin.h"
+#include "AsyncStoreImpl.h"
+
#include "qpid/broker/Broker.h"
namespace qpid {
Modified: qpid/branches/asyncstore/cpp/src/qpid/asyncStore/Plugin.h
URL: http://svn.apache.org/viewvc/qpid/branches/asyncstore/cpp/src/qpid/asyncStore/Plugin.h?rev=1362039&r1=1362038&r2=1362039&view=diff
==============================================================================
--- qpid/branches/asyncstore/cpp/src/qpid/asyncStore/Plugin.h (original)
+++ qpid/branches/asyncstore/cpp/src/qpid/asyncStore/Plugin.h Mon Jul 16 13:54:11 2012
@@ -24,13 +24,15 @@
#ifndef qpid_broker_Plugin_h_
#define qpid_broker_Plugin_h_
-#include "AsyncStoreImpl.h"
#include "AsyncStoreOptions.h"
#include "qpid/Plugin.h"
namespace qpid {
class Options;
+namespace asyncStore {
+class AsyncStoreImpl;
+}
namespace broker {
class Plugin : public qpid::Plugin
Modified: qpid/branches/asyncstore/cpp/src/qpid/asyncStore/QueueHandleImpl.cpp
URL: http://svn.apache.org/viewvc/qpid/branches/asyncstore/cpp/src/qpid/asyncStore/QueueHandleImpl.cpp?rev=1362039&r1=1362038&r2=1362039&view=diff
==============================================================================
--- qpid/branches/asyncstore/cpp/src/qpid/asyncStore/QueueHandleImpl.cpp (original)
+++ qpid/branches/asyncstore/cpp/src/qpid/asyncStore/QueueHandleImpl.cpp Mon Jul 16 13:54:11 2012
@@ -23,8 +23,6 @@
#include "QueueHandleImpl.h"
-#include "qpid/messaging/PrivateImplRef.h"
-
namespace qpid {
namespace asyncStore {
Modified: qpid/branches/asyncstore/cpp/src/qpid/asyncStore/RunState.h
URL: http://svn.apache.org/viewvc/qpid/branches/asyncstore/cpp/src/qpid/asyncStore/RunState.h?rev=1362039&r1=1362038&r2=1362039&view=diff
==============================================================================
--- qpid/branches/asyncstore/cpp/src/qpid/asyncStore/RunState.h (original)
+++ qpid/branches/asyncstore/cpp/src/qpid/asyncStore/RunState.h Mon Jul 16 13:54:11 2012
@@ -59,7 +59,7 @@ typedef enum {
RS_STOPPED
} RunState_t;
-class RunState: public qpid::asyncStore::jrnl2::State<RunState_t>
+class RunState : public qpid::asyncStore::jrnl2::State<RunState_t>
{
public:
RunState();
Modified: qpid/branches/asyncstore/cpp/src/qpid/asyncStore/TxnHandleImpl.cpp
URL: http://svn.apache.org/viewvc/qpid/branches/asyncstore/cpp/src/qpid/asyncStore/TxnHandleImpl.cpp?rev=1362039&r1=1362038&r2=1362039&view=diff
==============================================================================
--- qpid/branches/asyncstore/cpp/src/qpid/asyncStore/TxnHandleImpl.cpp (original)
+++ qpid/branches/asyncstore/cpp/src/qpid/asyncStore/TxnHandleImpl.cpp Mon Jul 16 13:54:11 2012
@@ -25,7 +25,7 @@
#include "qpid/Exception.h"
#include "qpid/broker/TxnBuffer.h"
-#include "qpid/messaging/PrivateImplRef.h"
+#include "qpid/log/Statement.h"
#include <uuid/uuid.h>
@@ -117,7 +117,7 @@ TxnHandleImpl::createLocalXid()
char uuidStr[37]; // 36-char uuid + trailing '\0'
::uuid_unparse(uuid, uuidStr);
m_xid.assign(uuidStr);
-//std::cout << "TTT TxnHandleImpl::createLocalXid(): Local XID created: \"" << m_xid << "\"" << std::endl << std::flush;
+ QPID_LOG(debug, "Local XID created: \"" << m_xid << "\"");
}
}} // namespace qpid::asyncStore
Modified: qpid/branches/asyncstore/cpp/src/qpid/broker/AsyncResultHandle.cpp
URL: http://svn.apache.org/viewvc/qpid/branches/asyncstore/cpp/src/qpid/broker/AsyncResultHandle.cpp?rev=1362039&r1=1362038&r2=1362039&view=diff
==============================================================================
--- qpid/branches/asyncstore/cpp/src/qpid/broker/AsyncResultHandle.cpp (original)
+++ qpid/branches/asyncstore/cpp/src/qpid/broker/AsyncResultHandle.cpp Mon Jul 16 13:54:11 2012
@@ -23,21 +23,22 @@
#include "AsyncResultHandle.h"
-#include "qpid/messaging/PrivateImplRef.h"
+#include "AsyncResultHandleImpl.h"
+#include "PrivateImplRef.h"
namespace qpid {
namespace broker {
-typedef qpid::messaging::PrivateImplRef<AsyncResultHandle> PrivateImpl;
+typedef PrivateImplRef<AsyncResultHandle> PrivateImpl;
AsyncResultHandle::AsyncResultHandle(AsyncResultHandleImpl* p) :
- qpid::messaging::Handle<AsyncResultHandleImpl>()
+ Handle<AsyncResultHandleImpl>()
{
PrivateImpl::ctor(*this, p);
}
AsyncResultHandle::AsyncResultHandle(const AsyncResultHandle& r) :
- qpid::messaging::Handle<AsyncResultHandleImpl>()
+ Handle<AsyncResultHandleImpl>()
{
PrivateImpl::copy(*this, r);
}
Modified: qpid/branches/asyncstore/cpp/src/qpid/broker/AsyncResultHandle.h
URL: http://svn.apache.org/viewvc/qpid/branches/asyncstore/cpp/src/qpid/broker/AsyncResultHandle.h?rev=1362039&r1=1362038&r2=1362039&view=diff
==============================================================================
--- qpid/branches/asyncstore/cpp/src/qpid/broker/AsyncResultHandle.h (original)
+++ qpid/branches/asyncstore/cpp/src/qpid/broker/AsyncResultHandle.h Mon Jul 16 13:54:11 2012
@@ -24,14 +24,17 @@
#ifndef qpid_broker_AsyncResultHandle_h_
#define qpid_broker_AsyncResultHandle_h_
-#include "AsyncResultHandleImpl.h"
+#include "Handle.h"
-#include "qpid/messaging/Handle.h"
+#include <boost/shared_ptr.hpp>
+#include <string>
namespace qpid {
namespace broker {
+class AsyncResultHandleImpl;
+class BrokerAsyncContext;
-class AsyncResultHandle : public qpid::messaging::Handle<AsyncResultHandleImpl>
+class AsyncResultHandle : public Handle<AsyncResultHandleImpl>
{
public:
AsyncResultHandle(AsyncResultHandleImpl* p = 0);
@@ -47,7 +50,7 @@ public:
void invokeAsyncResultCallback() const;
private:
- friend class qpid::messaging::PrivateImplRef<AsyncResultHandle>;
+ friend class PrivateImplRef<AsyncResultHandle>;
};
}} // namespace qpid::broker
Modified: qpid/branches/asyncstore/cpp/src/qpid/broker/AsyncResultQueueImpl.cpp
URL: http://svn.apache.org/viewvc/qpid/branches/asyncstore/cpp/src/qpid/broker/AsyncResultQueueImpl.cpp?rev=1362039&r1=1362038&r2=1362039&view=diff
==============================================================================
--- qpid/branches/asyncstore/cpp/src/qpid/broker/AsyncResultQueueImpl.cpp (original)
+++ qpid/branches/asyncstore/cpp/src/qpid/broker/AsyncResultQueueImpl.cpp Mon Jul 16 13:54:11 2012
@@ -21,9 +21,12 @@
* \file AsyncResultQueueImpl.cpp
*/
-#include "AsyncResultHandle.h"
#include "AsyncResultQueueImpl.h"
+#include "AsyncResultHandle.h"
+
+#include "qpid/log/Statement.h"
+
namespace qpid {
namespace broker {
@@ -41,7 +44,6 @@ AsyncResultQueueImpl::~AsyncResultQueueI
void
AsyncResultQueueImpl::submit(boost::shared_ptr<AsyncResultHandle> arh)
{
-//std::cout << "==> AsyncResultQueueImpl::submit() errNo=" << arh->getErrNo() << " errMsg=\"" << arh->getErrMsg() << "\"" << std::endl << std::flush;
m_resQueue.push(arh);
}
@@ -51,15 +53,14 @@ AsyncResultQueueImpl::handle(const Resul
{
try {
for (ResultQueue::Batch::const_iterator i = e.begin(); i != e.end(); ++i) {
-//std::cout << "<== AsyncResultQueueImpl::handle() errNo=" << (*i)->getErrNo() << " errMsg=\"" << (*i)->getErrMsg() << "\"" << std::endl << std::flush;
if ((*i)->isValid()) {
(*i)->invokeAsyncResultCallback();
}
}
} catch (const std::exception& e) {
- std::cerr << "qpid::broker::AsyncResultQueueImpl: Exception thrown processing async result: " << e.what() << std::endl;
+ QPID_LOG(error, "Exception thrown processing async result: " << e.what());
} catch (...) {
- std::cerr << "qpid::broker::AsyncResultQueueImpl: Unknown exception thrown processing async result" << std::endl;
+ QPID_LOG(error, "Unknown exception thrown processing async result");
}
return e.end();
}
Modified: qpid/branches/asyncstore/cpp/src/qpid/broker/AsyncStore.h
URL: http://svn.apache.org/viewvc/qpid/branches/asyncstore/cpp/src/qpid/broker/AsyncStore.h?rev=1362039&r1=1362038&r2=1362039&view=diff
==============================================================================
--- qpid/branches/asyncstore/cpp/src/qpid/broker/AsyncStore.h (original)
+++ qpid/branches/asyncstore/cpp/src/qpid/broker/AsyncStore.h Mon Jul 16 13:54:11 2012
@@ -20,12 +20,10 @@
#ifndef qpid_broker_AsyncStore_h_
#define qpid_broker_AsyncStore_h_
-// TODO: See if we can replace this with a forward declaration, but current definition of qpid::types::Variant::Map
-// does not allow it. Using a local map<std::string, Variant> definition also precludes forward declaration.
#include "qpid/types/Variant.h" // qpid::types::Variant::Map
#include <boost/shared_ptr.hpp>
-#include <stdint.h>
+#include <stdint.h> // uint64_t
#include <string>
namespace qpid {
@@ -57,66 +55,91 @@ public:
virtual void write(char* target) = 0;
};
-// Callback invoked by AsyncResultQueue to pass back async results
-typedef void (*AsyncResultCallback)(const AsyncResultHandle* const);
+// Opaque async handles used for carrying persistence state.
class ConfigHandle;
class EnqueueHandle;
class EventHandle;
class MessageHandle;
class QueueHandle;
-class TxnBuffer;
class TxnHandle;
-class AsyncTransactionalStore {
+class TxnBuffer;
+
+class AsyncTransaction {
public:
- virtual ~AsyncTransactionalStore() {}
+ virtual ~AsyncTransaction() {}
virtual TxnHandle createTxnHandle() = 0;
virtual TxnHandle createTxnHandle(TxnBuffer* tb) = 0;
virtual TxnHandle createTxnHandle(const std::string& xid) = 0;
- virtual TxnHandle createTxnHandle(const std::string& xid, TxnBuffer* tb) = 0;
+ virtual TxnHandle createTxnHandle(const std::string& xid,
+ TxnBuffer* tb) = 0;
- // TODO: Remove boost::shared_ptr<> from this interface
- virtual void submitPrepare(TxnHandle&, boost::shared_ptr<BrokerAsyncContext>) = 0; // Distributed txns only
- virtual void submitCommit(TxnHandle&, boost::shared_ptr<BrokerAsyncContext>) = 0;
- virtual void submitAbort(TxnHandle&, boost::shared_ptr<BrokerAsyncContext>) = 0;
+ // TODO: Remove boost::shared_ptr<BrokerAsyncContext> from this interface
+ virtual void submitPrepare(TxnHandle&,
+ boost::shared_ptr<BrokerAsyncContext>) = 0; // Distributed txns only
+ virtual void submitCommit(TxnHandle&,
+ boost::shared_ptr<BrokerAsyncContext>) = 0;
+ virtual void submitAbort(TxnHandle&,
+ boost::shared_ptr<BrokerAsyncContext>) = 0;
};
// Subclassed by store:
-class AsyncStore : public AsyncTransactionalStore {
+class AsyncStore : public AsyncTransaction {
public:
virtual ~AsyncStore() {}
// --- Factory methods for creating handles ---
virtual ConfigHandle createConfigHandle() = 0;
- virtual EnqueueHandle createEnqueueHandle(MessageHandle&, QueueHandle&) = 0;
- virtual EventHandle createEventHandle(QueueHandle&, const std::string& key=std::string()) = 0;
+ virtual EnqueueHandle createEnqueueHandle(MessageHandle&,
+ QueueHandle&) = 0;
+ virtual EventHandle createEventHandle(QueueHandle&,
+ const std::string& key=std::string()) = 0;
virtual MessageHandle createMessageHandle(const DataSource* const) = 0;
- virtual QueueHandle createQueueHandle(const std::string& name, const qpid::types::Variant::Map& opts) = 0;
+ virtual QueueHandle createQueueHandle(const std::string& name,
+ const qpid::types::Variant::Map& opts) = 0;
// --- Store async interface ---
- // TODO: Remove boost::shared_ptr<> from this interface
- virtual void submitCreate(ConfigHandle&, const DataSource* const, boost::shared_ptr<BrokerAsyncContext>) = 0;
- virtual void submitDestroy(ConfigHandle&, boost::shared_ptr<BrokerAsyncContext>) = 0;
-
- virtual void submitCreate(QueueHandle&, const DataSource* const, boost::shared_ptr<BrokerAsyncContext>) = 0;
- virtual void submitDestroy(QueueHandle&, boost::shared_ptr<BrokerAsyncContext>) = 0;
- virtual void submitFlush(QueueHandle&, boost::shared_ptr<BrokerAsyncContext>) = 0;
-
- virtual void submitCreate(EventHandle&, const DataSource* const, boost::shared_ptr<BrokerAsyncContext>) = 0;
- virtual void submitCreate(EventHandle&, const DataSource* const, TxnHandle&, boost::shared_ptr<BrokerAsyncContext>) = 0;
- virtual void submitDestroy(EventHandle&, boost::shared_ptr<BrokerAsyncContext>) = 0;
- virtual void submitDestroy(EventHandle&, TxnHandle&, boost::shared_ptr<BrokerAsyncContext>) = 0;
-
- virtual void submitEnqueue(EnqueueHandle&, TxnHandle&, boost::shared_ptr<BrokerAsyncContext>) = 0;
- virtual void submitDequeue(EnqueueHandle&, TxnHandle&, boost::shared_ptr<BrokerAsyncContext>) = 0;
+ // TODO: Remove boost::shared_ptr<BrokerAsyncContext> from this interface
+ virtual void submitCreate(ConfigHandle&,
+ const DataSource* const,
+ boost::shared_ptr<BrokerAsyncContext>) = 0;
+ virtual void submitDestroy(ConfigHandle&,
+ boost::shared_ptr<BrokerAsyncContext>) = 0;
+
+ virtual void submitCreate(QueueHandle&,
+ const DataSource* const,
+ boost::shared_ptr<BrokerAsyncContext>) = 0;
+ virtual void submitDestroy(QueueHandle&,
+ boost::shared_ptr<BrokerAsyncContext>) = 0;
+ virtual void submitFlush(QueueHandle&,
+ boost::shared_ptr<BrokerAsyncContext>) = 0;
+
+ virtual void submitCreate(EventHandle&,
+ const DataSource* const,
+ TxnHandle&,
+ boost::shared_ptr<BrokerAsyncContext>) = 0;
+ virtual void submitDestroy(EventHandle&,
+ TxnHandle&,
+ boost::shared_ptr<BrokerAsyncContext>) = 0;
+
+ virtual void submitEnqueue(EnqueueHandle&,
+ TxnHandle&,
+ boost::shared_ptr<BrokerAsyncContext>) = 0;
+ virtual void submitDequeue(EnqueueHandle&,
+ TxnHandle&,
+ boost::shared_ptr<BrokerAsyncContext>) = 0;
// Legacy - Restore FTD message, is NOT async!
- virtual int loadContent(MessageHandle&, QueueHandle&, char* data, uint64_t offset, const uint64_t length) = 0;
+ virtual int loadContent(MessageHandle&,
+ QueueHandle&,
+ char* data,
+ uint64_t offset,
+ const uint64_t length) = 0;
};
Modified: qpid/branches/asyncstore/cpp/src/qpid/broker/ConfigHandle.cpp
URL: http://svn.apache.org/viewvc/qpid/branches/asyncstore/cpp/src/qpid/broker/ConfigHandle.cpp?rev=1362039&r1=1362038&r2=1362039&view=diff
==============================================================================
--- qpid/branches/asyncstore/cpp/src/qpid/broker/ConfigHandle.cpp (original)
+++ qpid/branches/asyncstore/cpp/src/qpid/broker/ConfigHandle.cpp Mon Jul 16 13:54:11 2012
@@ -23,23 +23,23 @@
#include "ConfigHandle.h"
-#include "qpid/messaging/PrivateImplRef.h"
+#include "PrivateImplRef.h"
+
+#include "qpid/asyncStore/ConfigHandleImpl.h"
namespace qpid {
namespace broker {
-typedef qpid::messaging::PrivateImplRef<ConfigHandle> PrivateImpl;
+typedef PrivateImplRef<ConfigHandle> PrivateImpl;
ConfigHandle::ConfigHandle(qpid::asyncStore::ConfigHandleImpl* p) :
- qpid::messaging::Handle<qpid::asyncStore::ConfigHandleImpl>(),
- IdHandle()
+ Handle<qpid::asyncStore::ConfigHandleImpl>()
{
PrivateImpl::ctor(*this, p);
}
ConfigHandle::ConfigHandle(const ConfigHandle& r) :
- qpid::messaging::Handle<qpid::asyncStore::ConfigHandleImpl>(),
- IdHandle()
+ Handle<qpid::asyncStore::ConfigHandleImpl>()
{
PrivateImpl::copy(*this, r);
}
Modified: qpid/branches/asyncstore/cpp/src/qpid/broker/ConfigHandle.h
URL: http://svn.apache.org/viewvc/qpid/branches/asyncstore/cpp/src/qpid/broker/ConfigHandle.h?rev=1362039&r1=1362038&r2=1362039&view=diff
==============================================================================
--- qpid/branches/asyncstore/cpp/src/qpid/broker/ConfigHandle.h (original)
+++ qpid/branches/asyncstore/cpp/src/qpid/broker/ConfigHandle.h Mon Jul 16 13:54:11 2012
@@ -21,19 +21,21 @@
* \file ConfigHandle.h
*/
-#ifndef qpid_broker_ConfigHandleImpl_h_
-#define qpid_broker_ConfigHandleImpl_h_
+#ifndef qpid_broker_ConfigHandle_h_
+#define qpid_broker_ConfigHandle_h_
-#include "IdHandle.h"
+#include "Handle.h"
-#include "qpid/asyncStore/ConfigHandleImpl.h"
-#include "qpid/messaging/Handle.h"
+#include "qpid/asyncStore/AsyncStoreHandle.h"
namespace qpid {
+namespace asyncStore {
+class ConfigHandleImpl;
+}
namespace broker {
-class ConfigHandle : public qpid::messaging::Handle<qpid::asyncStore::ConfigHandleImpl>,
- public IdHandle
+class ConfigHandle : public Handle<qpid::asyncStore::ConfigHandleImpl>,
+ public qpid::asyncStore::AsyncStoreHandle
{
public:
ConfigHandle(qpid::asyncStore::ConfigHandleImpl* p = 0);
@@ -45,9 +47,9 @@ public:
// <none>
private:
- friend class qpid::messaging::PrivateImplRef<ConfigHandle>;
+ friend class PrivateImplRef<ConfigHandle>;
};
}} // namespace qpid::broker
-#endif // qpid_broker_ConfigHandleImpl_h_
+#endif // qpid_broker_ConfigHandle_h_
Modified: qpid/branches/asyncstore/cpp/src/qpid/broker/EnqueueHandle.cpp
URL: http://svn.apache.org/viewvc/qpid/branches/asyncstore/cpp/src/qpid/broker/EnqueueHandle.cpp?rev=1362039&r1=1362038&r2=1362039&view=diff
==============================================================================
--- qpid/branches/asyncstore/cpp/src/qpid/broker/EnqueueHandle.cpp (original)
+++ qpid/branches/asyncstore/cpp/src/qpid/broker/EnqueueHandle.cpp Mon Jul 16 13:54:11 2012
@@ -23,23 +23,23 @@
#include "EnqueueHandle.h"
-#include "qpid/messaging/PrivateImplRef.h"
+#include "PrivateImplRef.h"
+
+#include "qpid/asyncStore/EnqueueHandleImpl.h"
namespace qpid {
namespace broker {
-typedef qpid::messaging::PrivateImplRef<EnqueueHandle> PrivateImpl;
+typedef PrivateImplRef<EnqueueHandle> PrivateImpl;
EnqueueHandle::EnqueueHandle(qpid::asyncStore::EnqueueHandleImpl* p) :
- qpid::messaging::Handle<qpid::asyncStore::EnqueueHandleImpl>(),
- IdHandle()
+ Handle<qpid::asyncStore::EnqueueHandleImpl>()
{
PrivateImpl::ctor(*this, p);
}
EnqueueHandle::EnqueueHandle(const EnqueueHandle& r) :
- qpid::messaging::Handle<qpid::asyncStore::EnqueueHandleImpl>(),
- IdHandle()
+ Handle<qpid::asyncStore::EnqueueHandleImpl>()
{
PrivateImpl::copy(*this, r);
}
Modified: qpid/branches/asyncstore/cpp/src/qpid/broker/EnqueueHandle.h
URL: http://svn.apache.org/viewvc/qpid/branches/asyncstore/cpp/src/qpid/broker/EnqueueHandle.h?rev=1362039&r1=1362038&r2=1362039&view=diff
==============================================================================
--- qpid/branches/asyncstore/cpp/src/qpid/broker/EnqueueHandle.h (original)
+++ qpid/branches/asyncstore/cpp/src/qpid/broker/EnqueueHandle.h Mon Jul 16 13:54:11 2012
@@ -21,19 +21,21 @@
* \file EnqueueHandle.h
*/
-#ifndef qpid_broker_EnqueueHandleImpl_h_
-#define qpid_broker_EnqueueHandleImpl_h_
+#ifndef qpid_broker_EnqueueHandle_h_
+#define qpid_broker_EnqueueHandle_h_
-#include "IdHandle.h"
+#include "Handle.h"
-#include "qpid/asyncStore/EnqueueHandleImpl.h"
-#include "qpid/messaging/Handle.h"
+#include "qpid/asyncStore/AsyncStoreHandle.h"
namespace qpid {
+namespace asyncStore {
+class EnqueueHandleImpl;
+}
namespace broker {
-class EnqueueHandle : public qpid::messaging::Handle<qpid::asyncStore::EnqueueHandleImpl>,
- public IdHandle
+class EnqueueHandle : public Handle<qpid::asyncStore::EnqueueHandleImpl>,
+ public qpid::asyncStore::AsyncStoreHandle
{
public:
EnqueueHandle(qpid::asyncStore::EnqueueHandleImpl* p = 0);
@@ -45,9 +47,9 @@ public:
// <none>
private:
- friend class qpid::messaging::PrivateImplRef<EnqueueHandle>;
+ friend class PrivateImplRef<EnqueueHandle>;
};
}} // namespace qpid::broker
-#endif // qpid_broker_EnqueueHandleImpl_h_
+#endif // qpid_broker_EnqueueHandle_h_
Modified: qpid/branches/asyncstore/cpp/src/qpid/broker/EventHandle.cpp
URL: http://svn.apache.org/viewvc/qpid/branches/asyncstore/cpp/src/qpid/broker/EventHandle.cpp?rev=1362039&r1=1362038&r2=1362039&view=diff
==============================================================================
--- qpid/branches/asyncstore/cpp/src/qpid/broker/EventHandle.cpp (original)
+++ qpid/branches/asyncstore/cpp/src/qpid/broker/EventHandle.cpp Mon Jul 16 13:54:11 2012
@@ -23,23 +23,23 @@
#include "EventHandle.h"
-#include "qpid/messaging/PrivateImplRef.h"
+#include "PrivateImplRef.h"
+
+#include "qpid/asyncStore/EventHandleImpl.h"
namespace qpid {
namespace broker {
-typedef qpid::messaging::PrivateImplRef<EventHandle> PrivateImpl;
+typedef PrivateImplRef<EventHandle> PrivateImpl;
EventHandle::EventHandle(qpid::asyncStore::EventHandleImpl* p) :
- qpid::messaging::Handle<qpid::asyncStore::EventHandleImpl>(),
- IdHandle()
+ Handle<qpid::asyncStore::EventHandleImpl>()
{
PrivateImpl::ctor(*this, p);
}
EventHandle::EventHandle(const EventHandle& r) :
- qpid::messaging::Handle<qpid::asyncStore::EventHandleImpl>(),
- IdHandle()
+ Handle<qpid::asyncStore::EventHandleImpl>()
{
PrivateImpl::copy(*this, r);
}
Modified: qpid/branches/asyncstore/cpp/src/qpid/broker/EventHandle.h
URL: http://svn.apache.org/viewvc/qpid/branches/asyncstore/cpp/src/qpid/broker/EventHandle.h?rev=1362039&r1=1362038&r2=1362039&view=diff
==============================================================================
--- qpid/branches/asyncstore/cpp/src/qpid/broker/EventHandle.h (original)
+++ qpid/branches/asyncstore/cpp/src/qpid/broker/EventHandle.h Mon Jul 16 13:54:11 2012
@@ -21,19 +21,23 @@
* \file EventHandle.h
*/
-#ifndef qpid_broker_EventHandleImpl_h_
-#define qpid_broker_EventHandleImpl_h_
+#ifndef qpid_broker_EventHandle_h_
+#define qpid_broker_EventHandle_h_
-#include "IdHandle.h"
+#include "Handle.h"
-#include "qpid/asyncStore/EventHandleImpl.h"
-#include "qpid/messaging/Handle.h"
+#include "qpid/asyncStore/AsyncStoreHandle.h"
+
+#include <string>
namespace qpid {
+namespace asyncStore {
+class EventHandleImpl;
+}
namespace broker {
-class EventHandle : public qpid::messaging::Handle<qpid::asyncStore::EventHandleImpl>,
- public IdHandle
+class EventHandle : public Handle<qpid::asyncStore::EventHandleImpl>,
+ public qpid::asyncStore::AsyncStoreHandle
{
public:
EventHandle(qpid::asyncStore::EventHandleImpl* p = 0);
@@ -45,9 +49,9 @@ public:
const std::string& getKey() const;
private:
- friend class qpid::messaging::PrivateImplRef<EventHandle>;
+ friend class PrivateImplRef<EventHandle>;
};
}} // namespace qpid::broker
-#endif // qpid_broker_EventHandleImpl_h_
+#endif // qpid_broker_EventHandle_h_
Added: qpid/branches/asyncstore/cpp/src/qpid/broker/Handle.h
URL: http://svn.apache.org/viewvc/qpid/branches/asyncstore/cpp/src/qpid/broker/Handle.h?rev=1362039&view=auto
==============================================================================
--- qpid/branches/asyncstore/cpp/src/qpid/broker/Handle.h (added)
+++ qpid/branches/asyncstore/cpp/src/qpid/broker/Handle.h Mon Jul 16 13:54:11 2012
@@ -0,0 +1,83 @@
+#ifndef QPID_BROKER_HANDLE_H
+#define QPID_BROKER_HANDLE_H
+
+/*
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ *
+ */
+
+/*
+ * NOTE: This is a copy of qpid::messaging::Handle (but stripped of its
+ * messaging-specific Windows decoration macros)
+ *
+ * This (together with PrivateImplRef.h) has been placed here so
+ * as not to introduce unnecessary dependencies on qpid::messaging
+ * for users of the Handle template in the qpid::broker namespace.
+ *
+ * Any fixes made here should also be made to qpid/messaging/Handle.h
+ *
+ * TODO: Find the correct Windows decorations for these functions.
+ * TODO: Find (if possible) a way to eliminate two copies of the same code.
+ */
+
+namespace qpid {
+namespace broker {
+
+template <class> class PrivateImplRef;
+
+/** \ingroup messaging
+ * A handle is like a pointer: refers to an underlying implementation object.
+ * Copying the handle does not copy the object.
+ *
+ * Handles can be null, like a 0 pointer. Use isValid(), isNull() or the
+ * conversion to bool to test for a null handle.
+ */
+template <class T> class Handle {
+ public:
+
+ /**@return true if handle is valid, i.e. not null. */
+ bool isValid() const { return impl; }
+
+ /**@return true if handle is null. It is an error to call any function on a null handle. */
+ bool isNull() const { return !impl; }
+
+ /** Conversion to bool supports idiom if (handle) { handle->... } */
+ operator bool() const { return impl; }
+
+ /** Operator ! supports idiom if (!handle) { do_if_handle_is_null(); } */
+ bool operator !() const { return !impl; }
+
+ void swap(Handle<T>& h) { T* t = h.impl; h.impl = impl; impl = t; }
+
+ protected:
+ typedef T Impl;
+ Handle() :impl() {}
+
+ // Not implemented,subclasses must implement.
+ Handle(const Handle&);
+ Handle& operator=(const Handle&);
+
+ Impl* impl;
+
+ friend class PrivateImplRef<T>;
+};
+
+}} // namespace qpid::broker
+
+#endif /*!QPID_BROKER_HANDLE_H*/
Modified: qpid/branches/asyncstore/cpp/src/qpid/broker/MessageHandle.cpp
URL: http://svn.apache.org/viewvc/qpid/branches/asyncstore/cpp/src/qpid/broker/MessageHandle.cpp?rev=1362039&r1=1362038&r2=1362039&view=diff
==============================================================================
--- qpid/branches/asyncstore/cpp/src/qpid/broker/MessageHandle.cpp (original)
+++ qpid/branches/asyncstore/cpp/src/qpid/broker/MessageHandle.cpp Mon Jul 16 13:54:11 2012
@@ -23,22 +23,23 @@
#include "MessageHandle.h"
-#include "qpid/messaging/PrivateImplRef.h"
+#include "PrivateImplRef.h"
+
+#include "qpid/asyncStore/MessageHandleImpl.h"
namespace qpid {
namespace broker {
-typedef qpid::messaging::PrivateImplRef<MessageHandle> PrivateImpl;
+typedef PrivateImplRef<MessageHandle> PrivateImpl;
MessageHandle::MessageHandle(qpid::asyncStore::MessageHandleImpl* p) :
- IdHandle()
+ Handle<qpid::asyncStore::MessageHandleImpl>()
{
PrivateImpl::ctor(*this, p);
}
MessageHandle::MessageHandle(const MessageHandle& r) :
- qpid::messaging::Handle<qpid::asyncStore::MessageHandleImpl>(),
- IdHandle()
+ Handle<qpid::asyncStore::MessageHandleImpl>()
{
PrivateImpl::copy(*this, r);
}
Modified: qpid/branches/asyncstore/cpp/src/qpid/broker/MessageHandle.h
URL: http://svn.apache.org/viewvc/qpid/branches/asyncstore/cpp/src/qpid/broker/MessageHandle.h?rev=1362039&r1=1362038&r2=1362039&view=diff
==============================================================================
--- qpid/branches/asyncstore/cpp/src/qpid/broker/MessageHandle.h (original)
+++ qpid/branches/asyncstore/cpp/src/qpid/broker/MessageHandle.h Mon Jul 16 13:54:11 2012
@@ -21,19 +21,21 @@
* \file MessageHandle.h
*/
-#ifndef qpid_broker_MessageHandleImpl_h_
-#define qpid_broker_MessageHandleImpl_h_
+#ifndef qpid_broker_MessageHandle_h_
+#define qpid_broker_MessageHandle_h_
-#include "IdHandle.h"
+#include "Handle.h"
-#include "qpid/asyncStore/MessageHandleImpl.h"
-#include "qpid/messaging/Handle.h"
+#include "qpid/asyncStore/AsyncStoreHandle.h"
namespace qpid {
+namespace asyncStore {
+class MessageHandleImpl;
+}
namespace broker {
-class MessageHandle : public qpid::messaging::Handle<qpid::asyncStore::MessageHandleImpl>,
- public IdHandle
+class MessageHandle : public Handle<qpid::asyncStore::MessageHandleImpl>,
+ public qpid::asyncStore::AsyncStoreHandle
{
public:
MessageHandle(qpid::asyncStore::MessageHandleImpl* p = 0);
@@ -45,9 +47,9 @@ public:
// <none>
private:
- friend class qpid::messaging::PrivateImplRef<MessageHandle>;
+ friend class PrivateImplRef<MessageHandle>;
};
}} // namespace qpid::broker
-#endif // qpid_broker_MessageHandleImpl_h_
+#endif // qpid_broker_MessageHandle_h_
Added: qpid/branches/asyncstore/cpp/src/qpid/broker/PrivateImplRef.h
URL: http://svn.apache.org/viewvc/qpid/branches/asyncstore/cpp/src/qpid/broker/PrivateImplRef.h?rev=1362039&view=auto
==============================================================================
--- qpid/branches/asyncstore/cpp/src/qpid/broker/PrivateImplRef.h (added)
+++ qpid/branches/asyncstore/cpp/src/qpid/broker/PrivateImplRef.h Mon Jul 16 13:54:11 2012
@@ -0,0 +1,105 @@
+#ifndef QPID_BROKER_PRIVATEIMPLREF_H
+#define QPID_BROKER_PRIVATEIMPLREF_H
+
+/*
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ *
+ */
+
+/*
+ * NOTE: This is a copy of qpid::messaging::PrivateImplRef
+ *
+ * This (together with Handle.h) has been placed here so
+ * as not to introduce unnecessary dependencies on qpid::messaging
+ * for users of the Handle template in the qpid::broker namespace.
+ *
+ * Any fixes made here should also be made to qpid/messaging/PrivateImplRef.h
+ *
+ * TODO: Find (if possible) a way to eliminate two copies of the same code.
+ */
+
+#include <boost/intrusive_ptr.hpp>
+#include "qpid/RefCounted.h"
+
+namespace qpid {
+namespace broker {
+
+/**
+ * Helper class to implement a class with a private, reference counted
+ * implementation and reference semantics.
+ *
+ * Such classes are used in the public API to hide implementation, they
+ * should. Example of use:
+ *
+ * === Foo.h
+ *
+ * template <class T> class PrivateImplRef;
+ * class FooImpl;
+ *
+ * Foo : public Handle<FooImpl> {
+ * public:
+ * Foo(FooImpl* = 0);
+ * Foo(const Foo&);
+ * ~Foo();
+ * Foo& operator=(const Foo&);
+ *
+ * int fooDo(); // and other Foo functions...
+ *
+ * private:
+ * typedef FooImpl Impl;
+ * Impl* impl;
+ * friend class PrivateImplRef<Foo>;
+ *
+ * === Foo.cpp
+ *
+ * typedef PrivateImplRef<Foo> PI;
+ * Foo::Foo(FooImpl* p) { PI::ctor(*this, p); }
+ * Foo::Foo(const Foo& c) : Handle<FooImpl>() { PI::copy(*this, c); }
+ * Foo::~Foo() { PI::dtor(*this); }
+ * Foo& Foo::operator=(const Foo& c) { return PI::assign(*this, c); }
+ *
+ * int foo::fooDo() { return impl->fooDo(); }
+ *
+ */
+template <class T> class PrivateImplRef {
+ public:
+ typedef typename T::Impl Impl;
+ typedef boost::intrusive_ptr<Impl> intrusive_ptr;
+
+ /** Get the implementation pointer from a handle */
+ static intrusive_ptr get(const T& t) { return intrusive_ptr(t.impl); }
+
+ /** Set the implementation pointer in a handle */
+ static void set(T& t, const intrusive_ptr& p) {
+ if (t.impl == p) return;
+ if (t.impl) boost::intrusive_ptr_release(t.impl);
+ t.impl = p.get();
+ if (t.impl) boost::intrusive_ptr_add_ref(t.impl);
+ }
+
+ // Helper functions to implement the ctor, dtor, copy, assign
+ static void ctor(T& t, Impl* p) { t.impl = p; if (p) boost::intrusive_ptr_add_ref(p); }
+ static void copy(T& t, const T& x) { if (&t == &x) return; t.impl = 0; assign(t, x); }
+ static void dtor(T& t) { if(t.impl) boost::intrusive_ptr_release(t.impl); }
+ static T& assign(T& t, const T& x) { set(t, get(x)); return t;}
+};
+
+}} // namespace qpid::broker
+
+#endif /*!QPID_BROKER_PRIVATEIMPLREF_H*/
Modified: qpid/branches/asyncstore/cpp/src/qpid/broker/QueueHandle.cpp
URL: http://svn.apache.org/viewvc/qpid/branches/asyncstore/cpp/src/qpid/broker/QueueHandle.cpp?rev=1362039&r1=1362038&r2=1362039&view=diff
==============================================================================
--- qpid/branches/asyncstore/cpp/src/qpid/broker/QueueHandle.cpp (original)
+++ qpid/branches/asyncstore/cpp/src/qpid/broker/QueueHandle.cpp Mon Jul 16 13:54:11 2012
@@ -23,22 +23,23 @@
#include "QueueHandle.h"
-#include "qpid/messaging/PrivateImplRef.h"
+#include "PrivateImplRef.h"
+
+#include "qpid/asyncStore/QueueHandleImpl.h"
namespace qpid {
namespace broker {
-typedef qpid::messaging::PrivateImplRef<QueueHandle> PrivateImpl;
+typedef PrivateImplRef<QueueHandle> PrivateImpl;
QueueHandle::QueueHandle(qpid::asyncStore::QueueHandleImpl* p) :
- IdHandle()
+ Handle<qpid::asyncStore::QueueHandleImpl>()
{
PrivateImpl::ctor(*this, p);
}
QueueHandle::QueueHandle(const QueueHandle& r) :
- qpid::messaging::Handle<qpid::asyncStore::QueueHandleImpl>(),
- IdHandle()
+ Handle<qpid::asyncStore::QueueHandleImpl>()
{
PrivateImpl::copy(*this, r);
}
Modified: qpid/branches/asyncstore/cpp/src/qpid/broker/QueueHandle.h
URL: http://svn.apache.org/viewvc/qpid/branches/asyncstore/cpp/src/qpid/broker/QueueHandle.h?rev=1362039&r1=1362038&r2=1362039&view=diff
==============================================================================
--- qpid/branches/asyncstore/cpp/src/qpid/broker/QueueHandle.h (original)
+++ qpid/branches/asyncstore/cpp/src/qpid/broker/QueueHandle.h Mon Jul 16 13:54:11 2012
@@ -21,18 +21,23 @@
* \file QueueHandle.h
*/
-#ifndef qpid_broker_QueueHandleImpl_h_
-#define qpid_broker_QueueHandleImpl_h_
+#ifndef qpid_broker_QueueHandle_h_
+#define qpid_broker_QueueHandle_h_
-#include "IdHandle.h"
+#include "Handle.h"
-#include "qpid/asyncStore/QueueHandleImpl.h"
-#include "qpid/messaging/Handle.h"
+#include "qpid/asyncStore/AsyncStoreHandle.h"
+
+#include <string>
namespace qpid {
+namespace asyncStore {
+class QueueHandleImpl;
+}
namespace broker {
-class QueueHandle : public qpid::messaging::Handle<qpid::asyncStore::QueueHandleImpl>, public IdHandle
+class QueueHandle : public Handle<qpid::asyncStore::QueueHandleImpl>,
+ public qpid::asyncStore::AsyncStoreHandle
{
public:
QueueHandle(qpid::asyncStore::QueueHandleImpl* p = 0);
@@ -44,9 +49,9 @@ public:
const std::string& getName() const;
private:
- friend class qpid::messaging::PrivateImplRef<QueueHandle>;
+ friend class PrivateImplRef<QueueHandle>;
};
}} // namespace qpid::broker
-#endif // qpid_broker_QueueHandleImpl_h_
+#endif // qpid_broker_QueueHandle_h_
Modified: qpid/branches/asyncstore/cpp/src/qpid/broker/TxnAsyncContext.cpp
URL: http://svn.apache.org/viewvc/qpid/branches/asyncstore/cpp/src/qpid/broker/TxnAsyncContext.cpp?rev=1362039&r1=1362038&r2=1362039&view=diff
==============================================================================
--- qpid/branches/asyncstore/cpp/src/qpid/broker/TxnAsyncContext.cpp (original)
+++ qpid/branches/asyncstore/cpp/src/qpid/broker/TxnAsyncContext.cpp Mon Jul 16 13:54:11 2012
@@ -23,8 +23,6 @@
#include "TxnAsyncContext.h"
-#include <cassert>
-
namespace qpid {
namespace broker {
@@ -38,9 +36,7 @@ TxnAsyncContext::TxnAsyncContext(TxnBuff
m_op(op),
m_rcb(rcb),
m_arq(arq)
-{
- assert(m_th.isValid());
-}
+{}
TxnAsyncContext::~TxnAsyncContext()
{}
@@ -63,7 +59,7 @@ TxnAsyncContext::getOpStr() const
return qpid::asyncStore::AsyncOperation::getOpStr(m_op);
}
-TxnHandle
+TxnHandle&
TxnAsyncContext::getTransactionContext() const
{
return m_th;
Modified: qpid/branches/asyncstore/cpp/src/qpid/broker/TxnAsyncContext.h
URL: http://svn.apache.org/viewvc/qpid/branches/asyncstore/cpp/src/qpid/broker/TxnAsyncContext.h?rev=1362039&r1=1362038&r2=1362039&view=diff
==============================================================================
--- qpid/branches/asyncstore/cpp/src/qpid/broker/TxnAsyncContext.h (original)
+++ qpid/branches/asyncstore/cpp/src/qpid/broker/TxnAsyncContext.h Mon Jul 16 13:54:11 2012
@@ -25,15 +25,16 @@
#define qpid_broker_TxnAsyncContext_h_
#include "AsyncStore.h" // qpid::broker::BrokerAsyncContext
-#include "TxnHandle.h"
#include "qpid/asyncStore/AsyncOperation.h"
-#include <boost/shared_ptr.hpp>
-
namespace qpid {
namespace broker {
+class TxnHandle;
+
+typedef void (*AsyncResultCallback)(const AsyncResultHandle* const);
+
class TxnAsyncContext: public BrokerAsyncContext
{
public:
@@ -46,7 +47,7 @@ public:
TxnBuffer* getTxnBuffer() const;
qpid::asyncStore::AsyncOperation::opCode getOpCode() const;
const char* getOpStr() const;
- TxnHandle getTransactionContext() const;
+ TxnHandle& getTransactionContext() const;
// --- Interface BrokerAsyncContext ---
AsyncResultQueue* getAsyncResultQueue() const;
@@ -54,7 +55,7 @@ public:
private:
TxnBuffer* const m_tb;
- TxnHandle m_th;
+ TxnHandle& m_th;
const qpid::asyncStore::AsyncOperation::opCode m_op;
AsyncResultCallback m_rcb;
AsyncResultQueue* const m_arq;
Modified: qpid/branches/asyncstore/cpp/src/qpid/broker/TxnBuffer.cpp
URL: http://svn.apache.org/viewvc/qpid/branches/asyncstore/cpp/src/qpid/broker/TxnBuffer.cpp?rev=1362039&r1=1362038&r2=1362039&view=diff
==============================================================================
--- qpid/branches/asyncstore/cpp/src/qpid/broker/TxnBuffer.cpp (original)
+++ qpid/branches/asyncstore/cpp/src/qpid/broker/TxnBuffer.cpp Mon Jul 16 13:54:11 2012
@@ -24,13 +24,10 @@
#include "TxnBuffer.h"
#include "AsyncResultHandle.h"
-#include "AsyncStore.h"
#include "TxnAsyncContext.h"
#include "TxnOp.h"
-#include "qpid/Exception.h"
-
-#include <boost/shared_ptr.hpp>
+#include "qpid/log/Statement.h"
namespace qpid {
namespace broker {
@@ -47,7 +44,6 @@ TxnBuffer::~TxnBuffer()
void
TxnBuffer::enlist(boost::shared_ptr<TxnOp> op)
{
-//std::cout << "TTT TxnBuffer::enlist" << std::endl << std::flush;
qpid::sys::ScopedLock<qpid::sys::Mutex> l(m_opsMutex);
m_ops.push_back(op);
}
@@ -55,7 +51,6 @@ TxnBuffer::enlist(boost::shared_ptr<TxnO
bool
TxnBuffer::prepare(TxnHandle& th)
{
-//std::cout << "TTT TxnBuffer::prepare" << std::endl << std::flush;
qpid::sys::ScopedLock<qpid::sys::Mutex> l(m_opsMutex);
for(std::vector<boost::shared_ptr<TxnOp> >::iterator i = m_ops.begin(); i != m_ops.end(); ++i) {
if (!(*i)->prepare(th)) {
@@ -68,7 +63,6 @@ TxnBuffer::prepare(TxnHandle& th)
void
TxnBuffer::commit()
{
-//std::cout << "TTT TxnBuffer::commit" << std::endl << std::flush;
qpid::sys::ScopedLock<qpid::sys::Mutex> l(m_opsMutex);
for(std::vector<boost::shared_ptr<TxnOp> >::iterator i = m_ops.begin(); i != m_ops.end(); ++i) {
(*i)->commit();
@@ -79,7 +73,6 @@ TxnBuffer::commit()
void
TxnBuffer::rollback()
{
-//std::cout << "TTT TxnBuffer::rollback" << std::endl << std::flush;
qpid::sys::ScopedLock<qpid::sys::Mutex> l(m_opsMutex);
for(std::vector<boost::shared_ptr<TxnOp> >::iterator i = m_ops.begin(); i != m_ops.end(); ++i) {
(*i)->rollback();
@@ -88,17 +81,16 @@ TxnBuffer::rollback()
}
bool
-TxnBuffer::commitLocal(AsyncTransactionalStore* const store)
+TxnBuffer::commitLocal(AsyncTransaction* const store)
{
-//std::cout << "TTT TxnBuffer::commitLocal" << std::endl << std::flush;
if (store) {
try {
m_store = store;
asyncLocalCommit();
} catch (std::exception& e) {
- std::cerr << "Commit failed: " << e.what() << std::endl;
+ QPID_LOG(error, "TxnBuffer::commitLocal: Commit failed: " << e.what());
} catch (...) {
- std::cerr << "Commit failed (unknown exception)" << std::endl;
+ QPID_LOG(error, "TxnBuffer::commitLocal: Commit failed (unknown exception)");
}
}
return false;
@@ -111,11 +103,10 @@ TxnBuffer::handleAsyncResult(const Async
if (arh) {
boost::shared_ptr<TxnAsyncContext> tac = boost::dynamic_pointer_cast<TxnAsyncContext>(arh->getBrokerAsyncContext());
if (arh->getErrNo()) {
- std::cerr << "Transaction xid=\"" << tac->getTransactionContext().getXid() << "\": Operation " << tac->getOpStr() << ": failure "
- << arh->getErrNo() << " (" << arh->getErrMsg() << ")" << std::endl;
+ QPID_LOG(error, "TxnBuffer::handleAsyncResult: Transactional operation " << tac->getOpStr() << " failed: err=" << arh->getErrNo()
+ << " (" << arh->getErrMsg() << ")");
tac->getTxnBuffer()->asyncLocalAbort();
} else {
-//std::cout << "TTT TxnBuffer::handleAsyncResult() op=" << tac->getOpStr() << std::endl << std::flush;
if (tac->getOpCode() == qpid::asyncStore::AsyncOperation::TXN_ABORT) {
tac->getTxnBuffer()->asyncLocalAbort();
} else {
@@ -131,13 +122,11 @@ TxnBuffer::asyncLocalCommit()
assert(m_store != 0);
switch(m_state) {
case NONE:
-//std::cout << "TTT TxnBuffer::asyncLocalCommit: NONE->PREPARE" << std::endl << std::flush;
m_state = PREPARE;
m_txnHandle = m_store->createTxnHandle(this);
prepare(m_txnHandle);
break;
case PREPARE:
-//std::cout << "TTT TxnBuffer::asyncLocalCommit: PREPARE->COMMIT" << std::endl << std::flush;
m_state = COMMIT;
{
boost::shared_ptr<TxnAsyncContext> tac(new TxnAsyncContext(this,
@@ -149,16 +138,12 @@ TxnBuffer::asyncLocalCommit()
}
break;
case COMMIT:
-//std::cout << "TTT TxnBuffer:asyncLocalCommit: COMMIT->COMPLETE" << std::endl << std::flush;
commit();
m_state = COMPLETE;
delete this; // TODO: ugly! Find a better way to handle the life cycle of this class
break;
-// case COMPLETE:
-//std::cout << "TTT TxnBuffer:asyncLocalCommit: COMPLETE" << std::endl << std::flush;
- break;
+ case COMPLETE:
default: ;
-//std::cout << "TTT TxnBuffer:asyncLocalCommit: Unexpected state " << m_state << std::endl << std::flush;
}
}
@@ -170,7 +155,6 @@ TxnBuffer::asyncLocalAbort()
case NONE:
case PREPARE:
case COMMIT:
-//std::cout << "TTT TxnBuffer::asyncRollback: xxx->ROLLBACK" << std::endl << std::flush;
m_state = ROLLBACK;
{
boost::shared_ptr<TxnAsyncContext> tac(new TxnAsyncContext(this,
@@ -182,31 +166,11 @@ TxnBuffer::asyncLocalAbort()
}
break;
case ROLLBACK:
-//std::cout << "TTT TxnBuffer:asyncRollback: ROLLBACK->COMPLETE" << std::endl << std::flush;
rollback();
m_state = COMPLETE;
delete this; // TODO: ugly! Find a better way to handle the life cycle of this class
default: ;
-//std::cout << "TTT TxnBuffer:asyncRollback: Unexpected state " << m_state << std::endl << std::flush;
- }
-}
-
-// for debugging
-/*
-void
-TxnBuffer::printState(std::ostream& os)
-{
- os << "state=";
- switch(m_state) {
- case NONE: os << "NONE"; break;
- case PREPARE: os << "PREPARE"; break;
- case COMMIT: os << "COMMIT"; break;
- case ROLLBACK: os << "ROLLBACK"; break;
- case COMPLETE: os << "COMPLETE"; break;
- default: os << m_state << "(unknown)";
}
- os << "; " << m_ops.size() << "; store=" << m_store;
}
-*/
}} // namespace qpid::broker
Modified: qpid/branches/asyncstore/cpp/src/qpid/broker/TxnBuffer.h
URL: http://svn.apache.org/viewvc/qpid/branches/asyncstore/cpp/src/qpid/broker/TxnBuffer.h?rev=1362039&r1=1362038&r2=1362039&view=diff
==============================================================================
--- qpid/branches/asyncstore/cpp/src/qpid/broker/TxnBuffer.h (original)
+++ qpid/branches/asyncstore/cpp/src/qpid/broker/TxnBuffer.h Mon Jul 16 13:54:11 2012
@@ -26,7 +26,8 @@
#include "TxnHandle.h"
-//#include <boost/enable_shared_from_this.hpp>
+#include "qpid/sys/Mutex.h"
+
#include <boost/shared_ptr.hpp>
#include <vector>
@@ -35,10 +36,10 @@ namespace broker {
class AsyncResultHandle;
class AsyncResultQueue;
-class AsyncTransactionalStore;
+class AsyncTransaction;
class TxnOp;
-class TxnBuffer /*: public boost::enable_shared_from_this<TxnBuffer>*/ {
+class TxnBuffer {
public:
TxnBuffer(AsyncResultQueue& arq);
virtual ~TxnBuffer();
@@ -47,21 +48,18 @@ public:
bool prepare(TxnHandle& th);
void commit();
void rollback();
- bool commitLocal(AsyncTransactionalStore* const store);
+ bool commitLocal(AsyncTransaction* const store);
// --- Async operations ---
static void handleAsyncResult(const AsyncResultHandle* const arh);
void asyncLocalCommit();
void asyncLocalAbort();
- // --- Debug ---
- //void printState(std::ostream& os);
-
private:
std::vector<boost::shared_ptr<TxnOp> > m_ops;
qpid::sys::Mutex m_opsMutex;
TxnHandle m_txnHandle;
- AsyncTransactionalStore* m_store;
+ AsyncTransaction* m_store;
AsyncResultQueue& m_resultQueue;
typedef enum {NONE = 0, PREPARE, COMMIT, ROLLBACK, COMPLETE} e_txnState;
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@qpid.apache.org
For additional commands, e-mail: commits-help@qpid.apache.org