[rhmessaging-commits] rhmessaging commits: r1844 - in store/trunk/cpp: lib/gen and 4 other directories.

rhmessaging-commits at lists.jboss.org rhmessaging-commits at lists.jboss.org
Mon Apr 7 12:11:45 EDT 2008


Author: kpvdr
Date: 2008-04-07 12:11:44 -0400 (Mon, 07 Apr 2008)
New Revision: 1844

Added:
   store/trunk/cpp/lib/gen/
   store/trunk/cpp/lib/gen/qpid/
   store/trunk/cpp/lib/gen/qpid/management/
   store/trunk/cpp/lib/gen/qpid/management/ArgsJournalExpand.h
   store/trunk/cpp/lib/gen/qpid/management/ArgsJournalReconfigure.h
   store/trunk/cpp/lib/gen/qpid/management/Journal.cpp
   store/trunk/cpp/lib/gen/qpid/management/Journal.h
   store/trunk/cpp/lib/gen/qpid/management/PackageMrgstore.cpp
   store/trunk/cpp/lib/gen/qpid/management/PackageMrgstore.h
   store/trunk/cpp/lib/gen/qpid/management/Store.cpp
   store/trunk/cpp/lib/gen/qpid/management/Store.h
Modified:
   store/trunk/cpp/lib/BdbMessageStore.cpp
   store/trunk/cpp/lib/BdbMessageStore.h
   store/trunk/cpp/lib/JournalImpl.cpp
   store/trunk/cpp/lib/JournalImpl.h
   store/trunk/cpp/lib/Makefile.am
   store/trunk/cpp/lib/StorePlugin.cpp
   store/trunk/cpp/lib/jrnl/jcfg.hpp
   store/trunk/cpp/lib/jrnl/jcntl.cpp
   store/trunk/cpp/lib/jrnl/jcntl.hpp
   store/trunk/cpp/lib/jrnl/rmgr.cpp
   store/trunk/cpp/lib/jrnl/wmgr.cpp
   store/trunk/cpp/lib/jrnl/wmgr.hpp
   store/trunk/cpp/tests/Makefile.am
Log:
Reconfigured jcntl::initialize() to take journal file geometry paramtetrs. Initial instrumentation for management, including connecting management reconfigure method, which descructively resizes the journal. The directory cpp/lib/gen added here contain generated management files and will be removed later when the generator is added to the build process.

Modified: store/trunk/cpp/lib/BdbMessageStore.cpp
===================================================================
--- store/trunk/cpp/lib/BdbMessageStore.cpp	2008-04-07 15:30:19 UTC (rev 1843)
+++ store/trunk/cpp/lib/BdbMessageStore.cpp	2008-04-07 16:11:44 UTC (rev 1844)
@@ -35,6 +35,8 @@
 #include "StringDbt.h"
 #include "JournalImpl.h"
 #include "DataTokenImpl.h"
+#include "qpid/management/ManagementAgent.h"
+#include "qpid/management/PackageMrgstore.h"
 
 using namespace rhm::bdbstore;
 using namespace qpid::broker;
@@ -45,6 +47,7 @@
 using std::max;
 using qpid::framing::Buffer;
 using qpid::framing::FieldTable;
+using qpid::management::ManagementAgent;
 
 static const u_int8_t MESSAGE_MESSAGE = 1;
 static const u_int8_t BASIC_MESSAGE = 2;
@@ -71,11 +74,32 @@
 
 {
 }
+ 
+void BdbMessageStore::initManagement (Broker* broker)
+{
+    if (broker != 0)
+    {
+        ManagementAgent::shared_ptr agent = ManagementAgent::getAgent ();
 
+        if (agent.get () != 0)
+        {
+            qpid::management::PackageMrgstore packageInitializer(agent);
+            mgmtObject = qpid::management::Store::shared_ptr(new qpid::management::Store (this, broker));
+
+            mgmtObject->set_location(storeDir);
+            mgmtObject->set_async(useAsync);
+            mgmtObject->set_defaultInitialFileCount(numJrnlFiles);
+            mgmtObject->set_defaultDataFileSize(jrnlFsizePgs);
+
+            agent->addObject(mgmtObject, 3, 0);
+        }
+    }
+}
+
 bool BdbMessageStore::init(const std::string& dir, const bool async, const bool force, u_int16_t jfiles, u_int32_t jfileSizePgs) 
 { 
     if (isInit) return true;
-	
+
     numJrnlFiles = jfiles;
     jrnlFsizePgs = jfileSizePgs;
     useAsync = async;
@@ -220,6 +244,9 @@
     } catch (const std::exception& e) {
         std::cerr << e.what() << std::endl;
     } catch (...) {}
+
+    if (mgmtObject.get() != 0)
+        mgmtObject->resourceDestroy();
 }
 
 void BdbMessageStore::truncate()

Modified: store/trunk/cpp/lib/BdbMessageStore.h
===================================================================
--- store/trunk/cpp/lib/BdbMessageStore.h	2008-04-07 15:30:19 UTC (rev 1843)
+++ store/trunk/cpp/lib/BdbMessageStore.h	2008-04-07 16:11:44 UTC (rev 1844)
@@ -34,6 +34,7 @@
 #include "TxnCtxt.h"
 #include <qpid/broker/Broker.h>
 #include <qpid/broker/MessageStore.h>
+#include <qpid/management/Manageable.h>
 #include <qpid/sys/Monitor.h>
 #include <qpid/sys/Time.h>
 #include <map>
@@ -42,6 +43,7 @@
 #include <boost/format.hpp>
 #include <boost/intrusive_ptr.hpp>
 #include <boost/ptr_container/ptr_list.hpp>
+#include "qpid/management/Store.h"
 
 namespace rhm {
     namespace bdbstore {
@@ -50,7 +52,7 @@
         /**
          * An implementation of the MessageStore interface based on Berkeley DB
          */
-        class BdbMessageStore : public qpid::broker::MessageStore
+        class BdbMessageStore : public qpid::broker::MessageStore, public qpid::management::Manageable
         {
             typedef std::map<u_int64_t, qpid::broker::RecoverableQueue::shared_ptr> queue_index;
             typedef std::map<u_int64_t, qpid::broker::RecoverableExchange::shared_ptr> exchange_index;
@@ -62,8 +64,8 @@
             // Default store settings
             static const bool defUseAsync = false;
             static const bool defForceStoreConversion = false;
-            static const u_int16_t defNumJrnlFiles = 8;
-            static const u_int32_t defJrnlFileSizePgs = 24;
+            static const u_int16_t defNumJrnlFiles = 8;      // TODO: make configurable
+            static const u_int32_t defJrnlFileSizePgs = 24;  // TODO: make configurable
 
             std::list<Db*> dbs;
             DbEnv env;
@@ -87,6 +89,7 @@
 			const char* envPath;
             static qpid::sys::Duration defJournalGetEventsTimeout;
             static qpid::sys::Duration defJournalFlushTimeout;
+            qpid::management::Store::shared_ptr mgmtObject;
             qpid::sys::Mutex jrnlCreateLock;
 
             bool mode(const bool mode, const bool force);
@@ -156,10 +159,13 @@
                 uint32_t jrnlFsizePgs;
             };
 
+            typedef boost::shared_ptr<BdbMessageStore> shared_ptr;
+
             BdbMessageStore(const char* envpath = 0);
             virtual ~BdbMessageStore();
 			bool init(const qpid::Options* options);
 			bool init(const std::string& dir, const bool async, const bool force, u_int16_t jfiles, u_int32_t jfileSizePgs);
+            void initManagement (qpid::broker::Broker* broker);
 
             void truncate();
 
@@ -203,6 +209,12 @@
             void prepare(qpid::broker::TPCTransactionContext& ctxt);
             void commit(qpid::broker::TransactionContext& ctxt);
             void abort(qpid::broker::TransactionContext& ctxt);
+
+            qpid::management::ManagementObject::shared_ptr GetManagementObject (void) const
+            { return mgmtObject; }
+
+            qpid::management::Manageable::status_t ManagementMethod (uint32_t, qpid::management::Args&)
+            { return qpid::management::Manageable::STATUS_OK; }
         };
     }
 }

Modified: store/trunk/cpp/lib/JournalImpl.cpp
===================================================================
--- store/trunk/cpp/lib/JournalImpl.cpp	2008-04-07 15:30:19 UTC (rev 1843)
+++ store/trunk/cpp/lib/JournalImpl.cpp	2008-04-07 16:11:44 UTC (rev 1844)
@@ -26,12 +26,16 @@
 #include "jrnl/jerrno.hpp"
 #include "jrnl/jexception.hpp"
 #include "jrnl/slock.hpp"
+#include "qpid/log/Statement.h"
+#include "qpid/management/ManagementAgent.h"
+#include "qpid/management/ArgsJournalExpand.h"
+#include "qpid/management/ArgsJournalReconfigure.h"
+#include "qpid/sys/Monitor.h"
 #include "StoreException.h"
-#include <qpid/sys/Monitor.h>
-#include <qpid/log/Statement.h>
 
 using namespace rhm::bdbstore;
 using namespace rhm::journal;
+using qpid::management::ManagementAgent;
 
 qpid::broker::Timer* JournalImpl::journalTimerPtr = 0;
 u_int32_t JournalImpl::cnt = 0;
@@ -67,6 +71,24 @@
     journalTimerPtr->start();
     journalTimerPtr->add(inactivityFireEventPtr);
 
+    ManagementAgent::shared_ptr agent = ManagementAgent::getAgent ();
+
+    if (agent.get () != 0)
+    {
+        _mgmtObject = qpid::management::Journal::shared_ptr
+            (new qpid::management::Journal((qpid::management::Manageable*) this));
+
+        _mgmtObject->set_name(journalId);
+        _mgmtObject->set_journalDirectory(journalDirectory);
+        _mgmtObject->set_journalBaseFileName(journalBaseFilename);
+        _mgmtObject->set_journalWritePageSize(JRNL_WMGR_PAGE_SIZE * JRNL_SBLK_SIZE * JRNL_DBLK_SIZE);
+        _mgmtObject->set_journalWritePages(JRNL_WMGR_PAGES);
+        _mgmtObject->set_journalReadPageSize(JRNL_RMGR_PAGE_SIZE * JRNL_SBLK_SIZE * JRNL_DBLK_SIZE);
+        _mgmtObject->set_journalReadPages(JRNL_RMGR_PAGES);
+
+        agent->addObject(_mgmtObject);
+    }
+
     log(LOG_NOTICE, "Instantiation");
     std::ostringstream oss;
     oss << "Journal directory = \"" << journalDirectory << "\"; Base file name = \"" << journalBaseFilename << "\"";
@@ -96,6 +118,9 @@
         journalTimerPtr = 0;
     }
 
+    if (_mgmtObject.get() != 0)
+        _mgmtObject->resourceDestroy();
+
     ::pthread_mutex_destroy(&_getf_mutex);
     log(LOG_DEBUG, "Destroyed");
 }
@@ -109,6 +134,13 @@
     log(LOG_DEBUG, oss.str());
     jcntl::initialize(num_jfiles, jfsize_sblks, rd_cb, wr_cb);
     log(LOG_DEBUG, "Initialization complete");
+
+    if (_mgmtObject.get() != 0)
+    {
+        _mgmtObject->set_initialFileCount(_num_jfiles);
+        _mgmtObject->set_dataFileSize(_jfsize_sblks * JRNL_SBLK_SIZE * JRNL_DBLK_SIZE);
+        _mgmtObject->set_journalCurrentFileCount(_num_jfiles);
+    }
 }
 
 void
@@ -151,6 +183,13 @@
     std::ostringstream oss2;
     oss2 << "Recover complete; highest rid found = 0x" << std::hex << highest_rid;
     log(LOG_DEBUG, oss2.str());
+
+    if (_mgmtObject.get() != 0)
+    {
+        _mgmtObject->set_initialFileCount(_num_jfiles);
+        _mgmtObject->set_dataFileSize(_jfsize_sblks * JRNL_SBLK_SIZE * JRNL_DBLK_SIZE);
+        _mgmtObject->set_journalCurrentFileCount(_num_jfiles);
+    }
 }
 
 #define MAX_AIO_SLEEPS 500
@@ -216,13 +255,19 @@
         const size_t this_data_len, data_tok* dtokp, const bool transient)
 {
     handleIoResult(jcntl::enqueue_data_record(data_buff, tot_data_len, this_data_len, dtokp, transient));
+    
+    if (_mgmtObject.get() != 0)
+        _mgmtObject->inc_journalRecordEnqueues();
 }
 
 void
 JournalImpl::enqueue_extern_data_record(const size_t tot_data_len, data_tok* dtokp,
         const bool transient)
 {
-   handleIoResult(jcntl::enqueue_extern_data_record(tot_data_len, dtokp, transient));
+    handleIoResult(jcntl::enqueue_extern_data_record(tot_data_len, dtokp, transient));
+    
+    if (_mgmtObject.get() != 0)
+        _mgmtObject->inc_journalRecordEnqueues();
 }
 
 void
@@ -230,6 +275,9 @@
         const size_t this_data_len, data_tok* dtokp, const std::string& xid, const bool transient)
 {
     handleIoResult(jcntl::enqueue_txn_data_record(data_buff, tot_data_len, this_data_len, dtokp, xid, transient));
+    
+    if (_mgmtObject.get() != 0)
+        _mgmtObject->inc_journalRecordEnqueues();
 }
 
 void
@@ -237,18 +285,27 @@
         const std::string& xid, const bool transient)
 {
     handleIoResult(jcntl::enqueue_extern_txn_data_record(tot_data_len, dtokp, xid, transient));
+    
+    if (_mgmtObject.get() != 0)
+        _mgmtObject->inc_journalRecordEnqueues();
 }
 
 void
 JournalImpl::dequeue_data_record(data_tok* const dtokp)
 {
     handleIoResult(jcntl::dequeue_data_record(dtokp));
+    
+    if (_mgmtObject.get() != 0)
+        _mgmtObject->inc_journalRecordDequeues();
 }
 
 void
 JournalImpl::dequeue_txn_data_record(data_tok* const dtokp, const std::string& xid)
 {
     handleIoResult(jcntl::dequeue_txn_data_record(dtokp, xid));
+    
+    if (_mgmtObject.get() != 0)
+        _mgmtObject->inc_journalRecordDequeues();
 }
 
 void
@@ -282,13 +339,13 @@
 }
 
 void
-JournalImpl::log(journal::log_level ll, const std::string& log_stmt)
+JournalImpl::log(journal::log_level ll, const std::string& log_stmt) const
 {
     log(ll, log_stmt.c_str());
 }
 
 void
-JournalImpl::log(journal::log_level ll, const char* const log_stmt)
+JournalImpl::log(journal::log_level ll, const char* const log_stmt) const
 {
     switch (ll)
     {
@@ -362,6 +419,33 @@
     }
 }
 
+void
+JournalImpl::reconfigure(const u_int16_t num_jfiles, const u_int32_t jfsize_sblks,
+        const journal::rd_aio_cb rd_cb, const journal::wr_aio_cb wr_cb)
+{
+    std::ostringstream oss;
+    oss << "Management reconfiguration: num_jfiles=" << num_jfiles << " jfsize_sblks=" << jfsize_sblks;
+    log(LOG_NOTICE, oss.str());
+
+    // Make sure something is actually changing before going to all the trouble...
+    if (num_jfiles == _num_jfiles && jfsize_sblks == _jfsize_sblks)
+    {
+        log(LOG_INFO, "Management reconfiguration parameters identical to existing; reconfiguration ignored.");
+        return;
+    }
+
+    stop(true);
+    jcntl::initialize(num_jfiles, jfsize_sblks, rd_cb, wr_cb);
+    log(LOG_DEBUG, "Management reconfiguration complete");
+
+    if (_mgmtObject.get() != 0)
+    {
+        _mgmtObject->set_initialFileCount(_num_jfiles);
+        _mgmtObject->set_dataFileSize(_jfsize_sblks * JRNL_SBLK_SIZE * JRNL_DBLK_SIZE);
+        _mgmtObject->set_journalCurrentFileCount(_num_jfiles);
+    }
+}
+
 // static AIO callback fns
 
 void
@@ -392,10 +476,45 @@
     }
 }
 
-qpid::management::Manageable::status_t JournalImpl::ManagementMethod (uint32_t /*methodId*/,
-        qpid::management::Args& /*args*/)
+qpid::management::Manageable::status_t JournalImpl::ManagementMethod (uint32_t methodId,
+        qpid::management::Args& args)
 {
-    return Manageable::STATUS_UNKNOWN_METHOD;
+    Manageable::status_t status = Manageable::STATUS_UNKNOWN_METHOD;
+
+    switch (methodId)
+    {
+    case qpid::management::Journal::METHOD_EXPAND :
+        //qpid::management::ArgsJournalExpand& eArgs =
+        //    dynamic_cast<qpid::management::ArgsJournalExpand&>(args);
+
+        // Implement "expand" using eArgs.i_by (expand-by argument)
+
+        status = Manageable::STATUS_NOT_IMPLEMENTED;
+        break;
+
+    case qpid::management::Journal::METHOD_RECONFIGURE :
+        qpid::management::ArgsJournalReconfigure& rArgs =
+            dynamic_cast<qpid::management::ArgsJournalReconfigure&>(args);
+        // Check parameter validity
+        if (rArgs.i_fileCount < JRNL_MIN_NUM_FILES || rArgs.i_fileCount > JRNL_MAX_NUM_FILES)
+        {
+            // TODO: add text indicating nature of failure
+            status = Manageable::STATUS_INVALID_PARAMETER;
+            break;
+        }
+        u_int32_t fsize_sblks = rArgs.i_fileSize * JRNL_RMGR_PAGE_SIZE;
+        if (fsize_sblks < JRNL_MIN_FILE_SIZE || fsize_sblks > JRNL_MAX_FILE_SIZE)
+        {
+            // TODO: add text indicating nature of failure
+            status = Manageable::STATUS_INVALID_PARAMETER;
+            break;
+        }
+        reconfigure(rArgs.i_fileCount, fsize_sblks);
+        status = Manageable::STATUS_OK;
+        break;
+    }
+
+    return status;
 }
 
 // void

Modified: store/trunk/cpp/lib/JournalImpl.h
===================================================================
--- store/trunk/cpp/lib/JournalImpl.h	2008-04-07 15:30:19 UTC (rev 1843)
+++ store/trunk/cpp/lib/JournalImpl.h	2008-04-07 16:11:44 UTC (rev 1844)
@@ -33,6 +33,8 @@
 #include <qpid/sys/Time.h>
 #include <boost/ptr_container/ptr_list.hpp>
 #include <boost/intrusive_ptr.hpp>
+#include "qpid/management/Manageable.h"
+#include "qpid/management/Journal.h"
 
 namespace rhm {
     namespace bdbstore {
@@ -83,6 +85,7 @@
             size_t _dlen;
             journal::data_tok _dtok;
             bool _external;
+            qpid::management::Journal::shared_ptr _mgmtObject;
 
         public:
             JournalImpl(const std::string& journalId,
@@ -143,8 +146,8 @@
             void stop(bool block_till_aio_cmpl = false);
 
             // Logging
-            void log(journal::log_level level, const std::string& log_stmt);
-            void log(journal::log_level level, const char* const log_stmt);
+            void log(journal::log_level level, const std::string& log_stmt) const;
+            void log(journal::log_level level, const char* const log_stmt) const;
 
             // Overrides for get_events timer
             const journal::iores flush(const bool block_till_aio_cmpl = false);
@@ -154,7 +157,7 @@
             void flushFire();
 
             qpid::management::ManagementObject::shared_ptr GetManagementObject (void) const
-                { qpid::management::ManagementObject::shared_ptr p; return p; }
+                { return _mgmtObject; }
 
             qpid::management::Manageable::status_t ManagementMethod (uint32_t,
                     qpid::management::Args&);
@@ -168,6 +171,11 @@
                 getEventsTimerSetFlag = true;
             }
             void handleIoResult(const journal::iores r);
+            void reconfigure(const u_int16_t num_jfiles, const u_int32_t jfsize_sblks,
+                    const journal::rd_aio_cb rd_cb, const journal::wr_aio_cb wr_cb);
+            inline void reconfigure(const u_int16_t num_jfiles, const u_int32_t jfsize_sblks) {
+                reconfigure(num_jfiles, jfsize_sblks, 0, &aio_wr_callback);
+            }
             static void aio_wr_callback(jcntl* journal, std::vector<journal::data_tok*>& dtokl);
             // static void aio_rd_callback(jcntl* journal, std::vector<u_int16_t>& pil);
         }; // class JournalImpl

Modified: store/trunk/cpp/lib/Makefile.am
===================================================================
--- store/trunk/cpp/lib/Makefile.am	2008-04-07 15:30:19 UTC (rev 1843)
+++ store/trunk/cpp/lib/Makefile.am	2008-04-07 16:11:44 UTC (rev 1844)
@@ -1,4 +1,5 @@
-AM_CXXFLAGS = $(WARNING_CFLAGS) $(APR_CXXFLAGS) $(QPID_CXXFLAGS) -DRHM_CLEAN -pthread
+AM_CXXFLAGS = $(WARNING_CFLAGS) $(APR_CXXFLAGS) $(QPID_CXXFLAGS) -I$(srcdir)/gen \
+  -DRHM_CLEAN -pthread
  
 lib_LTLIBRARIES = libbdbstore.la
 
@@ -91,7 +92,10 @@
   jrnl/txn_map.hpp			\
   jrnl/txn_rec.hpp			\
   jrnl/wmgr.hpp			\
-  jrnl/wrfc.hpp
+  jrnl/wrfc.hpp			\
+  gen/qpid/management/PackageMrgstore.cpp \
+  gen/qpid/management/Journal.cpp \
+  gen/qpid/management/Store.cpp
 
 
 BUILT_SOURCES = db-inc.h

Modified: store/trunk/cpp/lib/StorePlugin.cpp
===================================================================
--- store/trunk/cpp/lib/StorePlugin.cpp	2008-04-07 15:30:19 UTC (rev 1843)
+++ store/trunk/cpp/lib/StorePlugin.cpp	2008-04-07 16:11:44 UTC (rev 1844)
@@ -36,13 +36,14 @@
 struct StorePlugin : public Plugin {
 
     rhm::bdbstore::BdbMessageStore::Options options;
+    MessageStore *store;
 
     Options* getOptions() { return &options; }
 
     void earlyInitialize (Plugin::Target& target)
     {
         Broker* broker = dynamic_cast<Broker*>(&target);
-        MessageStore *store = new rhm::bdbstore::BdbMessageStore ();
+        store = new rhm::bdbstore::BdbMessageStore ();
         DataDir& dataDir = broker->getDataDir ();
 
         if (options.storeDir.empty ())
@@ -62,7 +63,11 @@
         broker->setStore (store);
     }
 
-    void initialize(Plugin::Target&) {}
+    void initialize(Plugin::Target& target)
+    {
+        Broker* broker = dynamic_cast<Broker*>(&target);
+        ((rhm::bdbstore::BdbMessageStore*) store)->initManagement (broker);
+    }
 };
 
 static StorePlugin instance; // Static initialization.

Added: store/trunk/cpp/lib/gen/qpid/management/ArgsJournalExpand.h
===================================================================
--- store/trunk/cpp/lib/gen/qpid/management/ArgsJournalExpand.h	                        (rev 0)
+++ store/trunk/cpp/lib/gen/qpid/management/ArgsJournalExpand.h	2008-04-07 16:11:44 UTC (rev 1844)
@@ -0,0 +1,42 @@
+
+#ifndef _ARGS_JOURNALEXPAND_
+#define _ARGS_JOURNALEXPAND_
+
+//
+// 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.
+//
+
+// This source file was created by a code generator.
+// Please do not edit.
+
+#include "qpid/management/Args.h"
+#include <string>
+
+namespace qpid { 
+namespace management {
+
+class ArgsJournalExpand : public Args
+{
+  public:
+    uint32_t i_by;
+
+};
+
+}}
+
+#endif  /*!_ARGS_JOURNALEXPAND_*/

Added: store/trunk/cpp/lib/gen/qpid/management/ArgsJournalReconfigure.h
===================================================================
--- store/trunk/cpp/lib/gen/qpid/management/ArgsJournalReconfigure.h	                        (rev 0)
+++ store/trunk/cpp/lib/gen/qpid/management/ArgsJournalReconfigure.h	2008-04-07 16:11:44 UTC (rev 1844)
@@ -0,0 +1,43 @@
+
+#ifndef _ARGS_JOURNALRECONFIGURE_
+#define _ARGS_JOURNALRECONFIGURE_
+
+//
+// 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.
+//
+
+// This source file was created by a code generator.
+// Please do not edit.
+
+#include "qpid/management/Args.h"
+#include <string>
+
+namespace qpid { 
+namespace management {
+
+class ArgsJournalReconfigure : public Args
+{
+  public:
+    uint32_t i_fileCount;
+    uint32_t i_fileSize;
+
+};
+
+}}
+
+#endif  /*!_ARGS_JOURNALRECONFIGURE_*/

Added: store/trunk/cpp/lib/gen/qpid/management/Journal.cpp
===================================================================
--- store/trunk/cpp/lib/gen/qpid/management/Journal.cpp	                        (rev 0)
+++ store/trunk/cpp/lib/gen/qpid/management/Journal.cpp	2008-04-07 16:11:44 UTC (rev 1844)
@@ -0,0 +1,466 @@
+
+//
+// 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.
+//
+
+// This source file was created by a code generator.
+// Please do not edit.
+
+#include "qpid/log/Statement.h"
+#include "qpid/framing/FieldTable.h"
+#include "qpid/management/Manageable.h" 
+#include "Journal.h"
+#include "qpid/management/ArgsJournalExpand.h"
+#include "qpid/management/ArgsJournalReconfigure.h"
+
+
+using namespace qpid::management;
+using namespace qpid::sys;
+using namespace qpid::framing;
+using           std::string;
+
+string  Journal::packageName  = string ("mrgstore");
+string  Journal::className    = string ("journal");
+uint8_t Journal::md5Sum[16]   =
+    {0x59,0x12,0x32,0xe1,0x16,0x75,0xbe,0x3,0xf,0x2,0x6,0x82,0x84,0xd5,0xf,0x52};
+
+Journal::Journal (Manageable* _core) :
+    ManagementObject(_core)
+    
+{
+    
+    initialFileCount = 0;
+    dataFileSize = 0;
+    journalCurrentFileCount = 0;
+    journalRecordDepth = 0;
+    journalRecordDepthHigh = 0;
+    journalRecordDepthLow  = 0;
+    journalRecordEnqueues = 0;
+    journalRecordDequeues = 0;
+    journalFreeFileCount = 0;
+    journalFreeFileCountHigh = 0;
+    journalFreeFileCountLow  = 0;
+    journalAvailableFileCount = 0;
+    journalAvailableFileCountHigh = 0;
+    journalAvailableFileCountLow  = 0;
+    journalWriteWaitFailures = 0;
+    journalWriteBusyFailures = 0;
+    journalReadRecordCount = 0;
+    journalReadBusyFailures = 0;
+    journalWritePageCacheDepth = 0;
+    journalWritePageCacheDepthHigh = 0;
+    journalWritePageCacheDepthLow  = 0;
+    journalReadPageCacheDepth = 0;
+    journalReadPageCacheDepthHigh = 0;
+    journalReadPageCacheDepthLow  = 0;
+
+}
+
+Journal::~Journal () {}
+
+namespace {
+    const string NAME("name");
+    const string TYPE("type");
+    const string ACCESS("access");
+    const string INDEX("index");
+    const string UNIT("unit");
+    const string MIN("min");
+    const string MAX("max");
+    const string MAXLEN("maxlen");
+    const string DESC("desc");
+    const string ARGCOUNT("argCount");
+    const string ARGS("args");
+    const string DIR("dir");
+    const string DEFAULT("default");
+}
+
+void Journal::writeSchema (Buffer& buf)
+{
+    FieldTable ft;
+
+    // Schema class header:
+    buf.putShortString (packageName); // Package Name
+    buf.putShortString (className);   // Class Name
+    buf.putBin128      (md5Sum);      // Schema Hash
+    buf.putShort       (7); // Config Element Count
+    buf.putShort       (24); // Inst Element Count
+    buf.putShort       (2); // Method Count
+    buf.putShort       (0); // Event Count
+
+    // Config Elements
+    ft = FieldTable ();
+    ft.setString (NAME,   "name");
+    ft.setInt    (TYPE,   TYPE_SSTR);
+    ft.setInt    (ACCESS, ACCESS_RO);
+    ft.setInt    (INDEX,  1);
+    buf.put (ft);
+
+    ft = FieldTable ();
+    ft.setString (NAME,   "journalDirectory");
+    ft.setInt    (TYPE,   TYPE_SSTR);
+    ft.setInt    (ACCESS, ACCESS_RO);
+    ft.setInt    (INDEX,  0);
+    ft.setString (DESC,   "Directory containing journal files");
+    buf.put (ft);
+
+    ft = FieldTable ();
+    ft.setString (NAME,   "journalBaseFileName");
+    ft.setInt    (TYPE,   TYPE_SSTR);
+    ft.setInt    (ACCESS, ACCESS_RO);
+    ft.setInt    (INDEX,  0);
+    ft.setString (DESC,   "Base filename prefix for journal");
+    buf.put (ft);
+
+    ft = FieldTable ();
+    ft.setString (NAME,   "journalWritePageSize");
+    ft.setInt    (TYPE,   TYPE_U32);
+    ft.setInt    (ACCESS, ACCESS_RO);
+    ft.setInt    (INDEX,  0);
+    ft.setString (UNIT,   "byte");
+    ft.setString (DESC,   "Page size in write-page-cache");
+    buf.put (ft);
+
+    ft = FieldTable ();
+    ft.setString (NAME,   "journalWritePages");
+    ft.setInt    (TYPE,   TYPE_U32);
+    ft.setInt    (ACCESS, ACCESS_RO);
+    ft.setInt    (INDEX,  0);
+    ft.setString (UNIT,   "wpage");
+    ft.setString (DESC,   "Number of pages in write-page-cache");
+    buf.put (ft);
+
+    ft = FieldTable ();
+    ft.setString (NAME,   "journalReadPageSize");
+    ft.setInt    (TYPE,   TYPE_U32);
+    ft.setInt    (ACCESS, ACCESS_RO);
+    ft.setInt    (INDEX,  0);
+    ft.setString (UNIT,   "byte");
+    ft.setString (DESC,   "Page size in read-page-cache");
+    buf.put (ft);
+
+    ft = FieldTable ();
+    ft.setString (NAME,   "journalReadPages");
+    ft.setInt    (TYPE,   TYPE_U32);
+    ft.setInt    (ACCESS, ACCESS_RO);
+    ft.setInt    (INDEX,  0);
+    ft.setString (UNIT,   "rpage");
+    ft.setString (DESC,   "Number of pages in read-page-cache");
+    buf.put (ft);
+
+
+    // Inst Elements
+    ft = FieldTable ();
+    ft.setString (NAME,   "initialFileCount");
+    ft.setInt    (TYPE,   TYPE_U16);
+    ft.setString (UNIT,   "file");
+    ft.setString (DESC,   "Number of files initially allocated to this journal");
+    buf.put (ft);
+
+    ft = FieldTable ();
+    ft.setString (NAME,   "dataFileSize");
+    ft.setInt    (TYPE,   TYPE_U32);
+    ft.setString (UNIT,   "byte");
+    ft.setString (DESC,   "Size of each journal data file");
+    buf.put (ft);
+
+    ft = FieldTable ();
+    ft.setString (NAME,   "journalCurrentFileCount");
+    ft.setInt    (TYPE,   TYPE_U32);
+    ft.setString (UNIT,   "file");
+    ft.setString (DESC,   "Number of files currently allocated to this journal");
+    buf.put (ft);
+
+    ft = FieldTable ();
+    ft.setString (NAME,   "journalRecordDepth");
+    ft.setInt    (TYPE,   TYPE_U32);
+    ft.setString (UNIT,   "record");
+    ft.setString (DESC,   "Number of enqueued records (durable messages)");
+    buf.put (ft);
+
+    ft = FieldTable ();
+    ft.setString (NAME,   "journalRecordDepthHigh");
+    ft.setInt    (TYPE,   TYPE_U32);
+    ft.setString (UNIT,   "record");
+    ft.setString (DESC,   "Number of enqueued records (durable messages) (High)");
+    buf.put (ft);
+
+    ft = FieldTable ();
+    ft.setString (NAME,   "journalRecordDepthLow");
+    ft.setInt    (TYPE,   TYPE_U32);
+    ft.setString (UNIT,   "record");
+    ft.setString (DESC,   "Number of enqueued records (durable messages) (Low)");
+    buf.put (ft);
+
+    ft = FieldTable ();
+    ft.setString (NAME,   "journalRecordEnqueues");
+    ft.setInt    (TYPE,   TYPE_U64);
+    ft.setString (UNIT,   "record");
+    ft.setString (DESC,   "Total enqueued records on journal");
+    buf.put (ft);
+
+    ft = FieldTable ();
+    ft.setString (NAME,   "journalRecordDequeues");
+    ft.setInt    (TYPE,   TYPE_U64);
+    ft.setString (UNIT,   "record");
+    ft.setString (DESC,   "Total dequeued records on journal");
+    buf.put (ft);
+
+    ft = FieldTable ();
+    ft.setString (NAME,   "journalFreeFileCount");
+    ft.setInt    (TYPE,   TYPE_U32);
+    ft.setString (UNIT,   "file");
+    ft.setString (DESC,   "Number of files free on this journal. Includes free files trapped in holes.");
+    buf.put (ft);
+
+    ft = FieldTable ();
+    ft.setString (NAME,   "journalFreeFileCountHigh");
+    ft.setInt    (TYPE,   TYPE_U32);
+    ft.setString (UNIT,   "file");
+    ft.setString (DESC,   "Number of files free on this journal. Includes free files trapped in holes. (High)");
+    buf.put (ft);
+
+    ft = FieldTable ();
+    ft.setString (NAME,   "journalFreeFileCountLow");
+    ft.setInt    (TYPE,   TYPE_U32);
+    ft.setString (UNIT,   "file");
+    ft.setString (DESC,   "Number of files free on this journal. Includes free files trapped in holes. (Low)");
+    buf.put (ft);
+
+    ft = FieldTable ();
+    ft.setString (NAME,   "journalAvailableFileCount");
+    ft.setInt    (TYPE,   TYPE_U32);
+    ft.setString (UNIT,   "file");
+    ft.setString (DESC,   "Number of files available to be written.  Excluding holes");
+    buf.put (ft);
+
+    ft = FieldTable ();
+    ft.setString (NAME,   "journalAvailableFileCountHigh");
+    ft.setInt    (TYPE,   TYPE_U32);
+    ft.setString (UNIT,   "file");
+    ft.setString (DESC,   "Number of files available to be written.  Excluding holes (High)");
+    buf.put (ft);
+
+    ft = FieldTable ();
+    ft.setString (NAME,   "journalAvailableFileCountLow");
+    ft.setInt    (TYPE,   TYPE_U32);
+    ft.setString (UNIT,   "file");
+    ft.setString (DESC,   "Number of files available to be written.  Excluding holes (Low)");
+    buf.put (ft);
+
+    ft = FieldTable ();
+    ft.setString (NAME,   "journalWriteWaitFailures");
+    ft.setInt    (TYPE,   TYPE_U64);
+    ft.setString (UNIT,   "record");
+    ft.setString (DESC,   "AIO Wait failures on write");
+    buf.put (ft);
+
+    ft = FieldTable ();
+    ft.setString (NAME,   "journalWriteBusyFailures");
+    ft.setInt    (TYPE,   TYPE_U64);
+    ft.setString (UNIT,   "record");
+    ft.setString (DESC,   "AIO Busy failures on write");
+    buf.put (ft);
+
+    ft = FieldTable ();
+    ft.setString (NAME,   "journalReadRecordCount");
+    ft.setInt    (TYPE,   TYPE_U64);
+    ft.setString (UNIT,   "record");
+    ft.setString (DESC,   "Records read from the journal");
+    buf.put (ft);
+
+    ft = FieldTable ();
+    ft.setString (NAME,   "journalReadBusyFailures");
+    ft.setInt    (TYPE,   TYPE_U64);
+    ft.setString (UNIT,   "record");
+    ft.setString (DESC,   "AIO Busy failures on read");
+    buf.put (ft);
+
+    ft = FieldTable ();
+    ft.setString (NAME,   "journalWritePageCacheDepth");
+    ft.setInt    (TYPE,   TYPE_U32);
+    ft.setString (UNIT,   "page");
+    ft.setString (DESC,   "Current depth of write-page-cache");
+    buf.put (ft);
+
+    ft = FieldTable ();
+    ft.setString (NAME,   "journalWritePageCacheDepthHigh");
+    ft.setInt    (TYPE,   TYPE_U32);
+    ft.setString (UNIT,   "page");
+    ft.setString (DESC,   "Current depth of write-page-cache (High)");
+    buf.put (ft);
+
+    ft = FieldTable ();
+    ft.setString (NAME,   "journalWritePageCacheDepthLow");
+    ft.setInt    (TYPE,   TYPE_U32);
+    ft.setString (UNIT,   "page");
+    ft.setString (DESC,   "Current depth of write-page-cache (Low)");
+    buf.put (ft);
+
+    ft = FieldTable ();
+    ft.setString (NAME,   "journalReadPageCacheDepth");
+    ft.setInt    (TYPE,   TYPE_U32);
+    ft.setString (UNIT,   "page");
+    ft.setString (DESC,   "Current depth of read-page-cache");
+    buf.put (ft);
+
+    ft = FieldTable ();
+    ft.setString (NAME,   "journalReadPageCacheDepthHigh");
+    ft.setInt    (TYPE,   TYPE_U32);
+    ft.setString (UNIT,   "page");
+    ft.setString (DESC,   "Current depth of read-page-cache (High)");
+    buf.put (ft);
+
+    ft = FieldTable ();
+    ft.setString (NAME,   "journalReadPageCacheDepthLow");
+    ft.setInt    (TYPE,   TYPE_U32);
+    ft.setString (UNIT,   "page");
+    ft.setString (DESC,   "Current depth of read-page-cache (Low)");
+    buf.put (ft);
+
+
+    // Methods
+    ft = FieldTable ();
+    ft.setString (NAME,     "expand");
+    ft.setInt    (ARGCOUNT, 1);
+    ft.setString (DESC,     "Increase number of files allocated for this journal");
+    buf.put (ft);
+
+    ft = FieldTable ();
+    ft.setString (NAME,    "by");
+    ft.setInt    (TYPE,    TYPE_U32);
+    ft.setString (DIR,     "I");
+    ft.setString (DESC,    "Number of files to increase journal size by");
+    buf.put (ft);
+
+    ft = FieldTable ();
+    ft.setString (NAME,     "reconfigure");
+    ft.setInt    (ARGCOUNT, 2);
+    ft.setString (DESC,     "Destructively reconfigure dimensions for this journal");
+    buf.put (ft);
+
+    ft = FieldTable ();
+    ft.setString (NAME,    "fileCount");
+    ft.setInt    (TYPE,    TYPE_U32);
+    ft.setString (DIR,     "I");
+    ft.setString (DESC,    "Number of files in journal");
+    buf.put (ft);
+
+    ft = FieldTable ();
+    ft.setString (NAME,    "fileSize");
+    ft.setInt    (TYPE,    TYPE_U32);
+    ft.setString (DIR,     "I");
+    ft.setString (DESC,    "Size of files in journal");
+    buf.put (ft);
+
+
+    // Events
+
+}
+
+void Journal::writeConfig (Buffer& buf)
+{
+    sys::RWlock::ScopedRlock readLock (accessLock);
+    configChanged = false;
+
+    writeTimestamps (buf);
+    buf.putShortString (name);
+    buf.putShortString (journalDirectory);
+    buf.putShortString (journalBaseFileName);
+    buf.putLong (journalWritePageSize);
+    buf.putLong (journalWritePages);
+    buf.putLong (journalReadPageSize);
+    buf.putLong (journalReadPages);
+
+}
+
+void Journal::writeInstrumentation (Buffer& buf, bool skipHeaders)
+{
+    sys::RWlock::ScopedWlock writeLock (accessLock);
+    instChanged = false;
+
+    if (!skipHeaders)
+        writeTimestamps (buf);
+    buf.putShort (initialFileCount);
+    buf.putLong (dataFileSize);
+    buf.putLong (journalCurrentFileCount);
+    buf.putLong (journalRecordDepth);
+    buf.putLong (journalRecordDepthHigh);
+    buf.putLong (journalRecordDepthLow);
+    buf.putLongLong (journalRecordEnqueues);
+    buf.putLongLong (journalRecordDequeues);
+    buf.putLong (journalFreeFileCount);
+    buf.putLong (journalFreeFileCountHigh);
+    buf.putLong (journalFreeFileCountLow);
+    buf.putLong (journalAvailableFileCount);
+    buf.putLong (journalAvailableFileCountHigh);
+    buf.putLong (journalAvailableFileCountLow);
+    buf.putLongLong (journalWriteWaitFailures);
+    buf.putLongLong (journalWriteBusyFailures);
+    buf.putLongLong (journalReadRecordCount);
+    buf.putLongLong (journalReadBusyFailures);
+    buf.putLong (journalWritePageCacheDepth);
+    buf.putLong (journalWritePageCacheDepthHigh);
+    buf.putLong (journalWritePageCacheDepthLow);
+    buf.putLong (journalReadPageCacheDepth);
+    buf.putLong (journalReadPageCacheDepthHigh);
+    buf.putLong (journalReadPageCacheDepthLow);
+
+
+    // Maintenance of hi-lo statistics
+    journalRecordDepthHigh = journalRecordDepth;
+    journalRecordDepthLow  = journalRecordDepth;
+    journalFreeFileCountHigh = journalFreeFileCount;
+    journalFreeFileCountLow  = journalFreeFileCount;
+    journalAvailableFileCountHigh = journalAvailableFileCount;
+    journalAvailableFileCountLow  = journalAvailableFileCount;
+    journalWritePageCacheDepthHigh = journalWritePageCacheDepth;
+    journalWritePageCacheDepthLow  = journalWritePageCacheDepth;
+    journalReadPageCacheDepthHigh = journalReadPageCacheDepth;
+    journalReadPageCacheDepthLow  = journalReadPageCacheDepth;
+
+}
+
+void Journal::doMethod (string methodName, Buffer& inBuf, Buffer& outBuf)
+{
+    Manageable::status_t status = Manageable::STATUS_UNKNOWN_METHOD;
+
+    if (methodName == "expand")
+    {
+        ArgsJournalExpand ioArgs;
+        ioArgs.i_by = inBuf.getLong ();
+        status = coreObject->ManagementMethod (METHOD_EXPAND, ioArgs);
+        outBuf.putLong        (status);
+        outBuf.putShortString (Manageable::StatusText (status));
+        return;
+    }
+
+    if (methodName == "reconfigure")
+    {
+        ArgsJournalReconfigure ioArgs;
+        ioArgs.i_fileCount = inBuf.getLong ();
+        ioArgs.i_fileSize = inBuf.getLong ();
+        status = coreObject->ManagementMethod (METHOD_RECONFIGURE, ioArgs);
+        outBuf.putLong        (status);
+        outBuf.putShortString (Manageable::StatusText (status));
+        return;
+    }
+
+    outBuf.putLong        (status);
+    outBuf.putShortString (Manageable::StatusText (status));
+}
+

Added: store/trunk/cpp/lib/gen/qpid/management/Journal.h
===================================================================
--- store/trunk/cpp/lib/gen/qpid/management/Journal.h	                        (rev 0)
+++ store/trunk/cpp/lib/gen/qpid/management/Journal.h	2008-04-07 16:11:44 UTC (rev 1844)
@@ -0,0 +1,290 @@
+
+#ifndef _MANAGEMENT_JOURNAL_
+#define _MANAGEMENT_JOURNAL_
+
+//
+// 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.
+//
+
+// This source file was created by a code generator.
+// Please do not edit.
+
+#include "qpid/management/ManagementObject.h"
+#include "qpid/framing/Uuid.h"
+
+namespace qpid {
+namespace management {
+
+class Journal : public ManagementObject
+{
+  private:
+
+    static std::string packageName;
+    static std::string className;
+    static uint8_t     md5Sum[16];
+
+    // Configuration Elements
+    std::string name;
+    std::string journalDirectory;
+    std::string journalBaseFileName;
+    uint32_t journalWritePageSize;
+    uint32_t journalWritePages;
+    uint32_t journalReadPageSize;
+    uint32_t journalReadPages;
+
+    // Instrumentation Elements
+    uint16_t  initialFileCount;
+    uint32_t  dataFileSize;
+    uint32_t  journalCurrentFileCount;
+    uint32_t  journalRecordDepth;
+    uint32_t  journalRecordDepthHigh;
+    uint32_t  journalRecordDepthLow;
+    uint64_t  journalRecordEnqueues;
+    uint64_t  journalRecordDequeues;
+    uint32_t  journalFreeFileCount;
+    uint32_t  journalFreeFileCountHigh;
+    uint32_t  journalFreeFileCountLow;
+    uint32_t  journalAvailableFileCount;
+    uint32_t  journalAvailableFileCountHigh;
+    uint32_t  journalAvailableFileCountLow;
+    uint64_t  journalWriteWaitFailures;
+    uint64_t  journalWriteBusyFailures;
+    uint64_t  journalReadRecordCount;
+    uint64_t  journalReadBusyFailures;
+    uint32_t  journalWritePageCacheDepth;
+    uint32_t  journalWritePageCacheDepthHigh;
+    uint32_t  journalWritePageCacheDepthLow;
+    uint32_t  journalReadPageCacheDepth;
+    uint32_t  journalReadPageCacheDepthHigh;
+    uint32_t  journalReadPageCacheDepthLow;
+
+    // Private Methods
+    static void writeSchema   (qpid::framing::Buffer& buf);
+    void writeConfig          (qpid::framing::Buffer& buf);
+    void writeInstrumentation (qpid::framing::Buffer& buf,
+                               bool skipHeaders = false);
+    void doMethod             (std::string            methodName,
+                               qpid::framing::Buffer& inBuf,
+                               qpid::framing::Buffer& outBuf);
+    writeSchemaCall_t getWriteSchemaCall (void) { return writeSchema; }
+
+
+  public:
+
+    friend class PackageMrgstore;
+    typedef boost::shared_ptr<Journal> shared_ptr;
+
+    Journal (Manageable* coreObject);
+    ~Journal (void);
+
+    std::string getPackageName (void) { return packageName; }
+    std::string getClassName   (void) { return className; }
+    uint8_t*    getMd5Sum      (void) { return md5Sum; }
+
+    // Method IDs
+    static const uint32_t METHOD_EXPAND = 1;
+    static const uint32_t METHOD_RECONFIGURE = 2;
+
+    // Accessor Methods
+    inline void set_name (std::string val){
+        sys::RWlock::ScopedWlock writeLock (accessLock);
+        name = val;
+        configChanged = true;
+    }
+    inline void set_journalDirectory (std::string val){
+        sys::RWlock::ScopedWlock writeLock (accessLock);
+        journalDirectory = val;
+        configChanged = true;
+    }
+    inline void set_journalBaseFileName (std::string val){
+        sys::RWlock::ScopedWlock writeLock (accessLock);
+        journalBaseFileName = val;
+        configChanged = true;
+    }
+    inline void set_journalWritePageSize (uint32_t val){
+        sys::RWlock::ScopedWlock writeLock (accessLock);
+        journalWritePageSize = val;
+        configChanged = true;
+    }
+    inline void set_journalWritePages (uint32_t val){
+        sys::RWlock::ScopedWlock writeLock (accessLock);
+        journalWritePages = val;
+        configChanged = true;
+    }
+    inline void set_journalReadPageSize (uint32_t val){
+        sys::RWlock::ScopedWlock writeLock (accessLock);
+        journalReadPageSize = val;
+        configChanged = true;
+    }
+    inline void set_journalReadPages (uint32_t val){
+        sys::RWlock::ScopedWlock writeLock (accessLock);
+        journalReadPages = val;
+        configChanged = true;
+    }
+    inline void set_initialFileCount (uint16_t val){
+        sys::RWlock::ScopedWlock writeLock (accessLock);
+        initialFileCount = val;
+        instChanged = true;
+    }
+    inline void set_dataFileSize (uint32_t val){
+        sys::RWlock::ScopedWlock writeLock (accessLock);
+        dataFileSize = val;
+        instChanged = true;
+    }
+    inline void set_journalCurrentFileCount (uint32_t val){
+        sys::RWlock::ScopedWlock writeLock (accessLock);
+        journalCurrentFileCount = val;
+        instChanged = true;
+    }
+    inline void inc_journalRecordDepth (uint32_t by = 1){
+        sys::RWlock::ScopedWlock writeLock (accessLock);
+        journalRecordDepth += by;
+        if (journalRecordDepthHigh < journalRecordDepth)
+            journalRecordDepthHigh = journalRecordDepth;
+        instChanged = true;
+    }
+    inline void dec_journalRecordDepth (uint32_t by = 1){
+        sys::RWlock::ScopedWlock writeLock (accessLock);
+        journalRecordDepth -= by;
+        if (journalRecordDepthLow > journalRecordDepth)
+            journalRecordDepthLow = journalRecordDepth;
+        instChanged = true;
+    }
+    inline void inc_journalRecordEnqueues (uint64_t by = 1){
+        sys::RWlock::ScopedWlock writeLock (accessLock);
+        journalRecordEnqueues += by;
+        instChanged = true;
+    }
+    inline void dec_journalRecordEnqueues (uint64_t by = 1){
+        sys::RWlock::ScopedWlock writeLock (accessLock);
+        journalRecordEnqueues -= by;
+        instChanged = true;
+    }
+    inline void inc_journalRecordDequeues (uint64_t by = 1){
+        sys::RWlock::ScopedWlock writeLock (accessLock);
+        journalRecordDequeues += by;
+        instChanged = true;
+    }
+    inline void dec_journalRecordDequeues (uint64_t by = 1){
+        sys::RWlock::ScopedWlock writeLock (accessLock);
+        journalRecordDequeues -= by;
+        instChanged = true;
+    }
+    inline void inc_journalFreeFileCount (uint32_t by = 1){
+        sys::RWlock::ScopedWlock writeLock (accessLock);
+        journalFreeFileCount += by;
+        if (journalFreeFileCountHigh < journalFreeFileCount)
+            journalFreeFileCountHigh = journalFreeFileCount;
+        instChanged = true;
+    }
+    inline void dec_journalFreeFileCount (uint32_t by = 1){
+        sys::RWlock::ScopedWlock writeLock (accessLock);
+        journalFreeFileCount -= by;
+        if (journalFreeFileCountLow > journalFreeFileCount)
+            journalFreeFileCountLow = journalFreeFileCount;
+        instChanged = true;
+    }
+    inline void inc_journalAvailableFileCount (uint32_t by = 1){
+        sys::RWlock::ScopedWlock writeLock (accessLock);
+        journalAvailableFileCount += by;
+        if (journalAvailableFileCountHigh < journalAvailableFileCount)
+            journalAvailableFileCountHigh = journalAvailableFileCount;
+        instChanged = true;
+    }
+    inline void dec_journalAvailableFileCount (uint32_t by = 1){
+        sys::RWlock::ScopedWlock writeLock (accessLock);
+        journalAvailableFileCount -= by;
+        if (journalAvailableFileCountLow > journalAvailableFileCount)
+            journalAvailableFileCountLow = journalAvailableFileCount;
+        instChanged = true;
+    }
+    inline void inc_journalWriteWaitFailures (uint64_t by = 1){
+        sys::RWlock::ScopedWlock writeLock (accessLock);
+        journalWriteWaitFailures += by;
+        instChanged = true;
+    }
+    inline void dec_journalWriteWaitFailures (uint64_t by = 1){
+        sys::RWlock::ScopedWlock writeLock (accessLock);
+        journalWriteWaitFailures -= by;
+        instChanged = true;
+    }
+    inline void inc_journalWriteBusyFailures (uint64_t by = 1){
+        sys::RWlock::ScopedWlock writeLock (accessLock);
+        journalWriteBusyFailures += by;
+        instChanged = true;
+    }
+    inline void dec_journalWriteBusyFailures (uint64_t by = 1){
+        sys::RWlock::ScopedWlock writeLock (accessLock);
+        journalWriteBusyFailures -= by;
+        instChanged = true;
+    }
+    inline void inc_journalReadRecordCount (uint64_t by = 1){
+        sys::RWlock::ScopedWlock writeLock (accessLock);
+        journalReadRecordCount += by;
+        instChanged = true;
+    }
+    inline void dec_journalReadRecordCount (uint64_t by = 1){
+        sys::RWlock::ScopedWlock writeLock (accessLock);
+        journalReadRecordCount -= by;
+        instChanged = true;
+    }
+    inline void inc_journalReadBusyFailures (uint64_t by = 1){
+        sys::RWlock::ScopedWlock writeLock (accessLock);
+        journalReadBusyFailures += by;
+        instChanged = true;
+    }
+    inline void dec_journalReadBusyFailures (uint64_t by = 1){
+        sys::RWlock::ScopedWlock writeLock (accessLock);
+        journalReadBusyFailures -= by;
+        instChanged = true;
+    }
+    inline void inc_journalWritePageCacheDepth (uint32_t by = 1){
+        sys::RWlock::ScopedWlock writeLock (accessLock);
+        journalWritePageCacheDepth += by;
+        if (journalWritePageCacheDepthHigh < journalWritePageCacheDepth)
+            journalWritePageCacheDepthHigh = journalWritePageCacheDepth;
+        instChanged = true;
+    }
+    inline void dec_journalWritePageCacheDepth (uint32_t by = 1){
+        sys::RWlock::ScopedWlock writeLock (accessLock);
+        journalWritePageCacheDepth -= by;
+        if (journalWritePageCacheDepthLow > journalWritePageCacheDepth)
+            journalWritePageCacheDepthLow = journalWritePageCacheDepth;
+        instChanged = true;
+    }
+    inline void inc_journalReadPageCacheDepth (uint32_t by = 1){
+        sys::RWlock::ScopedWlock writeLock (accessLock);
+        journalReadPageCacheDepth += by;
+        if (journalReadPageCacheDepthHigh < journalReadPageCacheDepth)
+            journalReadPageCacheDepthHigh = journalReadPageCacheDepth;
+        instChanged = true;
+    }
+    inline void dec_journalReadPageCacheDepth (uint32_t by = 1){
+        sys::RWlock::ScopedWlock writeLock (accessLock);
+        journalReadPageCacheDepth -= by;
+        if (journalReadPageCacheDepthLow > journalReadPageCacheDepth)
+            journalReadPageCacheDepthLow = journalReadPageCacheDepth;
+        instChanged = true;
+    }
+
+};
+
+}}
+            
+
+#endif  /*!_MANAGEMENT_JOURNAL_*/

Added: store/trunk/cpp/lib/gen/qpid/management/PackageMrgstore.cpp
===================================================================
--- store/trunk/cpp/lib/gen/qpid/management/PackageMrgstore.cpp	                        (rev 0)
+++ store/trunk/cpp/lib/gen/qpid/management/PackageMrgstore.cpp	2008-04-07 16:11:44 UTC (rev 1844)
@@ -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.
+//
+
+// This source file was created by a code generator.
+// Please do not edit.
+
+#include "qpid/management/PackageMrgstore.h"
+#include "qpid/management/Store.h"
+#include "qpid/management/Journal.h"
+
+
+using namespace qpid::management;
+
+PackageMrgstore::PackageMrgstore (ManagementAgent::shared_ptr agent)
+{
+agent->RegisterClass (Store::packageName, Store::className, Store::md5Sum, Store::writeSchema);
+agent->RegisterClass (Journal::packageName, Journal::className, Journal::md5Sum, Journal::writeSchema);
+
+}
+

Added: store/trunk/cpp/lib/gen/qpid/management/PackageMrgstore.h
===================================================================
--- store/trunk/cpp/lib/gen/qpid/management/PackageMrgstore.h	                        (rev 0)
+++ store/trunk/cpp/lib/gen/qpid/management/PackageMrgstore.h	2008-04-07 16:11:44 UTC (rev 1844)
@@ -0,0 +1,42 @@
+
+#ifndef _MANAGEMENT_PACKAGE_MRGSTORE_
+#define _MANAGEMENT_PACKAGE_MRGSTORE_
+
+//
+// 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.
+//
+
+// This source file was created by a code generator.
+// Please do not edit.
+
+#include "qpid/management/ManagementAgent.h"
+
+namespace qpid {
+namespace management {
+
+class PackageMrgstore
+{
+  public:
+    PackageMrgstore (ManagementAgent::shared_ptr agent);
+    ~PackageMrgstore () {}
+};
+
+}}
+            
+
+#endif  /*!_MANAGEMENT_PACKAGE_MRGSTORE_*/

Added: store/trunk/cpp/lib/gen/qpid/management/Store.cpp
===================================================================
--- store/trunk/cpp/lib/gen/qpid/management/Store.cpp	                        (rev 0)
+++ store/trunk/cpp/lib/gen/qpid/management/Store.cpp	2008-04-07 16:11:44 UTC (rev 1844)
@@ -0,0 +1,164 @@
+
+//
+// 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.
+//
+
+// This source file was created by a code generator.
+// Please do not edit.
+
+#include "qpid/log/Statement.h"
+#include "qpid/framing/FieldTable.h"
+#include "qpid/management/Manageable.h" 
+#include "Store.h"
+
+
+using namespace qpid::management;
+using namespace qpid::sys;
+using namespace qpid::framing;
+using           std::string;
+
+string  Store::packageName  = string ("mrgstore");
+string  Store::className    = string ("store");
+uint8_t Store::md5Sum[16]   =
+    {0x0,0xc6,0x7a,0x17,0x1,0xc6,0x33,0xb4,0x5d,0x75,0xd3,0x86,0xe3,0x20,0xcc,0xe2};
+
+Store::Store (Manageable* _core, Manageable* _parent) :
+    ManagementObject(_core)
+    
+{
+    qpidBrokerRef = _parent->GetManagementObject ()->getObjectId ();
+
+}
+
+Store::~Store () {}
+
+namespace {
+    const string NAME("name");
+    const string TYPE("type");
+    const string ACCESS("access");
+    const string INDEX("index");
+    const string UNIT("unit");
+    const string MIN("min");
+    const string MAX("max");
+    const string MAXLEN("maxlen");
+    const string DESC("desc");
+    const string ARGCOUNT("argCount");
+    const string ARGS("args");
+    const string DIR("dir");
+    const string DEFAULT("default");
+}
+
+void Store::writeSchema (Buffer& buf)
+{
+    FieldTable ft;
+
+    // Schema class header:
+    buf.putShortString (packageName); // Package Name
+    buf.putShortString (className);   // Class Name
+    buf.putBin128      (md5Sum);      // Schema Hash
+    buf.putShort       (5); // Config Element Count
+    buf.putShort       (0); // Inst Element Count
+    buf.putShort       (0); // Method Count
+    buf.putShort       (0); // Event Count
+
+    // Config Elements
+    ft = FieldTable ();
+    ft.setString (NAME,   "qpidBrokerRef");
+    ft.setInt    (TYPE,   TYPE_REF);
+    ft.setInt    (ACCESS, ACCESS_RO);
+    ft.setInt    (INDEX,  1);
+    buf.put (ft);
+
+    ft = FieldTable ();
+    ft.setString (NAME,   "location");
+    ft.setInt    (TYPE,   TYPE_SSTR);
+    ft.setInt    (ACCESS, ACCESS_RO);
+    ft.setInt    (INDEX,  0);
+    ft.setString (DESC,   "Logical directory on disk");
+    buf.put (ft);
+
+    ft = FieldTable ();
+    ft.setString (NAME,   "async");
+    ft.setInt    (TYPE,   TYPE_BOOL);
+    ft.setInt    (ACCESS, ACCESS_RO);
+    ft.setInt    (INDEX,  0);
+    ft.setString (DESC,   "Asynchronous IO");
+    buf.put (ft);
+
+    ft = FieldTable ();
+    ft.setString (NAME,   "defaultInitialFileCount");
+    ft.setInt    (TYPE,   TYPE_U16);
+    ft.setInt    (ACCESS, ACCESS_RO);
+    ft.setInt    (INDEX,  0);
+    ft.setString (UNIT,   "file");
+    ft.setString (DESC,   "Default number of files initially allocated to each journal");
+    buf.put (ft);
+
+    ft = FieldTable ();
+    ft.setString (NAME,   "defaultDataFileSize");
+    ft.setInt    (TYPE,   TYPE_U32);
+    ft.setInt    (ACCESS, ACCESS_RO);
+    ft.setInt    (INDEX,  0);
+    ft.setString (UNIT,   "RdPg");
+    ft.setString (DESC,   "Default size of each journal data file");
+    buf.put (ft);
+
+
+    // Inst Elements
+
+    // Methods
+
+    // Events
+
+}
+
+void Store::writeConfig (Buffer& buf)
+{
+    sys::RWlock::ScopedRlock readLock (accessLock);
+    configChanged = false;
+
+    writeTimestamps (buf);
+    buf.putLongLong (qpidBrokerRef);
+    buf.putShortString (location);
+    buf.putOctet (async?1:0);
+    buf.putShort (defaultInitialFileCount);
+    buf.putLong (defaultDataFileSize);
+
+}
+
+void Store::writeInstrumentation (Buffer& buf, bool skipHeaders)
+{
+    sys::RWlock::ScopedWlock writeLock (accessLock);
+    instChanged = false;
+
+    if (!skipHeaders)
+        writeTimestamps (buf);
+
+
+    // Maintenance of hi-lo statistics
+
+}
+
+void Store::doMethod (string, Buffer&, Buffer& outBuf)
+{
+    Manageable::status_t status = Manageable::STATUS_UNKNOWN_METHOD;
+
+    outBuf.putLong        (status);
+    outBuf.putShortString (Manageable::StatusText (status));
+}
+

Added: store/trunk/cpp/lib/gen/qpid/management/Store.h
===================================================================
--- store/trunk/cpp/lib/gen/qpid/management/Store.h	                        (rev 0)
+++ store/trunk/cpp/lib/gen/qpid/management/Store.h	2008-04-07 16:11:44 UTC (rev 1844)
@@ -0,0 +1,109 @@
+
+#ifndef _MANAGEMENT_STORE_
+#define _MANAGEMENT_STORE_
+
+//
+// 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.
+//
+
+// This source file was created by a code generator.
+// Please do not edit.
+
+#include "qpid/management/ManagementObject.h"
+#include "qpid/framing/Uuid.h"
+
+namespace qpid {
+namespace management {
+
+class Store : public ManagementObject
+{
+  private:
+
+    static std::string packageName;
+    static std::string className;
+    static uint8_t     md5Sum[16];
+
+    // Configuration Elements
+    uint64_t qpidBrokerRef;
+    std::string location;
+    uint8_t async;
+    uint16_t defaultInitialFileCount;
+    uint32_t defaultDataFileSize;
+
+    // Instrumentation Elements
+
+    // Private Methods
+    static void writeSchema   (qpid::framing::Buffer& buf);
+    void writeConfig          (qpid::framing::Buffer& buf);
+    void writeInstrumentation (qpid::framing::Buffer& buf,
+                               bool skipHeaders = false);
+    void doMethod             (std::string            methodName,
+                               qpid::framing::Buffer& inBuf,
+                               qpid::framing::Buffer& outBuf);
+    writeSchemaCall_t getWriteSchemaCall (void) { return writeSchema; }
+
+    // Stub for getInstChanged.  There are no inst elements
+    bool getInstChanged (void) { return false; }
+
+  public:
+
+    friend class PackageMrgstore;
+    typedef boost::shared_ptr<Store> shared_ptr;
+
+    Store (Manageable* coreObject, Manageable* _parent);
+    ~Store (void);
+
+    std::string getPackageName (void) { return packageName; }
+    std::string getClassName   (void) { return className; }
+    uint8_t*    getMd5Sum      (void) { return md5Sum; }
+
+    // Method IDs
+
+    // Accessor Methods
+    inline void set_qpidBrokerRef (uint64_t val){
+        sys::RWlock::ScopedWlock writeLock (accessLock);
+        qpidBrokerRef = val;
+        configChanged = true;
+    }
+    inline void set_location (std::string val){
+        sys::RWlock::ScopedWlock writeLock (accessLock);
+        location = val;
+        configChanged = true;
+    }
+    inline void set_async (uint8_t val){
+        sys::RWlock::ScopedWlock writeLock (accessLock);
+        async = val;
+        configChanged = true;
+    }
+    inline void set_defaultInitialFileCount (uint16_t val){
+        sys::RWlock::ScopedWlock writeLock (accessLock);
+        defaultInitialFileCount = val;
+        configChanged = true;
+    }
+    inline void set_defaultDataFileSize (uint32_t val){
+        sys::RWlock::ScopedWlock writeLock (accessLock);
+        defaultDataFileSize = val;
+        configChanged = true;
+    }
+
+};
+
+}}
+            
+
+#endif  /*!_MANAGEMENT_STORE_*/

Modified: store/trunk/cpp/lib/jrnl/jcfg.hpp
===================================================================
--- store/trunk/cpp/lib/jrnl/jcfg.hpp	2008-04-07 15:30:19 UTC (rev 1843)
+++ store/trunk/cpp/lib/jrnl/jcfg.hpp	2008-04-07 16:11:44 UTC (rev 1844)
@@ -71,6 +71,7 @@
 
 #define JRNL_WMGR_PAGE_SIZE     64          ///< Journal write page size in softblocks
 #define JRNL_WMGR_PAGES         32          ///< Number of pages to use in wmgr
+
 #define JRNL_WMGR_MAXDTOKPP     1024        ///< Max. dtoks (data blocks) per page in wmgr
 #define JRNL_WMGR_MAXWAITUS     100         ///< Max. wait time (us) before submitting AIO
 

Modified: store/trunk/cpp/lib/jrnl/jcntl.cpp
===================================================================
--- store/trunk/cpp/lib/jrnl/jcntl.cpp	2008-04-07 15:30:19 UTC (rev 1843)
+++ store/trunk/cpp/lib/jrnl/jcntl.cpp	2008-04-07 16:11:44 UTC (rev 1844)
@@ -424,13 +424,13 @@
 }
 
 void
-jcntl::log(log_level ll, const std::string& log_stmt)
+jcntl::log(log_level ll, const std::string& log_stmt) const
 {
     log(ll, log_stmt.c_str());
 }
 
 void
-jcntl::log(log_level ll, const char* const log_stmt)
+jcntl::log(log_level ll, const char* const log_stmt) const
 {
     if (ll > LOG_INFO)
     {

Modified: store/trunk/cpp/lib/jrnl/jcntl.hpp
===================================================================
--- store/trunk/cpp/lib/jrnl/jcntl.hpp	2008-04-07 15:30:19 UTC (rev 1843)
+++ store/trunk/cpp/lib/jrnl/jcntl.hpp	2008-04-07 16:11:44 UTC (rev 1844)
@@ -590,8 +590,8 @@
         inline const u_int32_t jfsize_sblks() const { return _jfsize_sblks; }
 
         // Logging
-        virtual void log(log_level level, const std::string& log_stmt);
-        virtual void log(log_level level, const char* const log_stmt);
+        virtual void log(log_level level, const std::string& log_stmt) const;
+        virtual void log(log_level level, const char* const log_stmt) const;
 
         // these are _rmgr to _wmgr interactions, remove when _rmgr contains ref to _wmgr:        
         void chk_wr_frot();

Modified: store/trunk/cpp/lib/jrnl/rmgr.cpp
===================================================================
--- store/trunk/cpp/lib/jrnl/rmgr.cpp	2008-04-07 15:30:19 UTC (rev 1843)
+++ store/trunk/cpp/lib/jrnl/rmgr.cpp	2008-04-07 16:11:44 UTC (rev 1844)
@@ -88,8 +88,11 @@
 void
 rmgr::clean()
 {
+    pmgr::clean();
+
     ::free(_fhdr_buffer);
     _fhdr_buffer = 0;
+
     if (_iocbp)
     {
         delete _iocbp;

Modified: store/trunk/cpp/lib/jrnl/wmgr.cpp
===================================================================
--- store/trunk/cpp/lib/jrnl/wmgr.cpp	2008-04-07 15:30:19 UTC (rev 1843)
+++ store/trunk/cpp/lib/jrnl/wmgr.cpp	2008-04-07 16:11:44 UTC (rev 1844)
@@ -53,6 +53,7 @@
         _cached_offset_dblks(0),
         _jfsize_dblks(0),
         _jfsize_pgs(0),
+        _num_jfiles(0),
         _enq_busy(false),
         _deq_busy(false),
         _abort_busy(false),
@@ -72,6 +73,7 @@
         _cached_offset_dblks(0),
         _jfsize_dblks(0),
         _jfsize_pgs(0),
+        _num_jfiles(0),
         _enq_busy(false),
         _deq_busy(false),
         _abort_busy(false),
@@ -906,9 +908,9 @@
 void
 wmgr::initialize()
 {
-    const u_int16_t num_jfiles = _jc->num_jfiles();
     pmgr::initialize();
-    if (::posix_memalign(&_fhdr_base_ptr, _sblksize, _sblksize * num_jfiles))
+    _num_jfiles = _jc->num_jfiles();
+    if (::posix_memalign(&_fhdr_base_ptr, _sblksize, _sblksize * _num_jfiles))
     {
         clean();
         std::ostringstream oss;
@@ -916,12 +918,12 @@
         oss << " errno=" << errno;
         throw jexception(jerrno::JERR__MALLOC, oss.str(), "wmgr", "initialize");
     }
-    _fhdr_ptr_arr = (void**)::malloc(num_jfiles * sizeof(void*));
+    _fhdr_ptr_arr = (void**)::malloc(_num_jfiles * sizeof(void*));
     MALLOC_CHK(_fhdr_ptr_arr, "_fhdr_ptr_arr", "wmgr", "initialize");
-    _iocba = (iocb**)::malloc(sizeof(iocb*) * num_jfiles);
+    _iocba = (iocb**)::malloc(sizeof(iocb*) * _num_jfiles);
     MALLOC_CHK(_iocba, "_iocba", "wmgr", "initialize");
-    ::memset(_iocba, 0, sizeof(iocb*) * num_jfiles);
-    for (u_int16_t i=0; i<num_jfiles; i++)
+    ::memset(_iocba, 0, sizeof(iocb*) * _num_jfiles);
+    for (u_int16_t i=0; i<_num_jfiles; i++)
     {
         _fhdr_ptr_arr[i] = (void*)((char*)_fhdr_base_ptr + _sblksize * i);
         _iocba[i] = new iocb;
@@ -1067,6 +1069,7 @@
 void
 wmgr::clean()
 {
+    pmgr::clean();
     // clean up allocated memory here
     ::free(_fhdr_base_ptr);
     _fhdr_base_ptr = 0;
@@ -1076,7 +1079,7 @@
 
     if (_iocba)
     {
-        for (u_int32_t i=0; i<_jc->num_jfiles(); i++)
+        for (u_int32_t i=0; i<_num_jfiles; i++)
             delete _iocba[i];
         ::free(_iocba);
         _iocba = 0;

Modified: store/trunk/cpp/lib/jrnl/wmgr.hpp
===================================================================
--- store/trunk/cpp/lib/jrnl/wmgr.hpp	2008-04-07 15:30:19 UTC (rev 1843)
+++ store/trunk/cpp/lib/jrnl/wmgr.hpp	2008-04-07 16:11:44 UTC (rev 1844)
@@ -79,6 +79,7 @@
         std::deque<data_tok*> _ddtokl;  ///< Deferred dequeue data_tok list
         u_int32_t _jfsize_dblks;        ///< Journal file size in dblks (NOT sblks!)
         u_int32_t _jfsize_pgs;          ///< Journal file size in cache pages
+        u_int16_t _num_jfiles;          ///< Number of files used in iocb mallocs
 
         // TODO: Convert _enq_busy etc into a proper threadsafe lock
         // TODO: Convert to enum? Are these encodes mutually exclusive?

Modified: store/trunk/cpp/tests/Makefile.am
===================================================================
--- store/trunk/cpp/tests/Makefile.am	2008-04-07 15:30:19 UTC (rev 1843)
+++ store/trunk/cpp/tests/Makefile.am	2008-04-07 16:11:44 UTC (rev 1844)
@@ -4,7 +4,7 @@
 AM_CXXFLAGS = $(WARNING_CFLAGS) $(APR_CXXFLAGS) $(QPID_CXXFLAGS) \
 	$(CPPUNIT_CXXFLAGS) -DBOOST_TEST_DYN_LINK
 
-INCLUDES=-I../lib
+INCLUDES=-I../lib -I../lib/gen
 
 SUBDIRS = jrnl
 




More information about the rhmessaging-commits mailing list