diff options
author | Alan Conway <aconway@apache.org> | 2008-02-08 22:27:38 +0000 |
---|---|---|
committer | Alan Conway <aconway@apache.org> | 2008-02-08 22:27:38 +0000 |
commit | 76bb9ff15b04a406153f7de71092eef0e27c0249 (patch) | |
tree | b25f228b801810ca0fdea29bff5f0620ad66f509 /cpp/src | |
parent | 5ae1949f3cf7737b01abd43cc943b066d684a52e (diff) | |
download | qpid-python-76bb9ff15b04a406153f7de71092eef0e27c0249.tar.gz |
From Ted Ross, https://issues.apache.org/jira/browse/QPID-782
The attached patch makes the following changes:
The --load-dir option has been renamed to --module-dir
The --no-modules option and been replaced by the --no-module-dir option. This new option suppresses ONLY the loading of modules from the directory.
The --no-data-dir option has been added to suppress the use of a data directory.
Logging has been added for data directory lock and unlock.
git-svn-id: https://svn.apache.org/repos/asf/incubator/qpid/trunk/qpid@620017 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'cpp/src')
-rw-r--r-- | cpp/src/qpid/DataDir.cpp | 10 | ||||
-rw-r--r-- | cpp/src/qpid/broker/Broker.cpp | 5 | ||||
-rw-r--r-- | cpp/src/qpid/broker/Broker.h | 1 | ||||
-rw-r--r-- | cpp/src/qpidd.cpp | 17 |
4 files changed, 24 insertions, 9 deletions
diff --git a/cpp/src/qpid/DataDir.cpp b/cpp/src/qpid/DataDir.cpp index baf536c109..f5f5444ac0 100644 --- a/cpp/src/qpid/DataDir.cpp +++ b/cpp/src/qpid/DataDir.cpp @@ -20,6 +20,7 @@ #include "Exception.h" #include "DataDir.h" +#include "qpid/log/Statement.h" #include <sys/types.h> #include <sys/stat.h> #include <fcntl.h> @@ -32,7 +33,10 @@ DataDir::DataDir (std::string path) : dirPath (path) { if (!enabled) + { + QPID_LOG (info, "No data directory - Disabling persistent configuration"); return; + } const char *cpath = dirPath.c_str (); struct stat s; @@ -55,14 +59,20 @@ DataDir::DataDir (std::string path) : oss << "Error locking data directory: errno=" << errno; throw Exception (oss.str ()); } + + QPID_LOG (info, "Locked data direcory: " << dirPath); } DataDir::~DataDir () { + if (dirPath.empty ()) + return; + std::string lockFile (dirPath); lockFile = lockFile + "/lock"; ::unlink (lockFile.c_str ()); + QPID_LOG (info, "Unlocked data directory: " << dirPath); } } // namespace qpid diff --git a/cpp/src/qpid/broker/Broker.cpp b/cpp/src/qpid/broker/Broker.cpp index 1d55db0c0f..117a93b571 100644 --- a/cpp/src/qpid/broker/Broker.cpp +++ b/cpp/src/qpid/broker/Broker.cpp @@ -60,6 +60,7 @@ namespace broker { Broker::Options::Options(const std::string& name) : qpid::Options(name), + noDataDir(0), dataDir("/var/lib/qpidd"), port(DEFAULT_PORT), workerThreads(5), @@ -75,6 +76,8 @@ Broker::Options::Options(const std::string& name) : addOptions() ("data-dir", optValue(dataDir,"DIR"), "Directory to contain persistent data generated by the broker") + ("no-data-dir", optValue(noDataDir), + "Don't use a data directory. No persistent configuration will be loaded or stored") ("port,p", optValue(port,"PORT"), "Tells the broker to listen on PORT") ("worker-threads", optValue(workerThreads, "N"), @@ -103,7 +106,7 @@ const std::string qpid_management("qpid.management"); Broker::Broker(const Broker::Options& conf) : config(conf), store(0), - dataDir(conf.dataDir), + dataDir(conf.noDataDir ? std::string () : conf.dataDir), factory(*this), sessionManager(conf.ack) { diff --git a/cpp/src/qpid/broker/Broker.h b/cpp/src/qpid/broker/Broker.h index 852cb2da42..68dbf570f0 100644 --- a/cpp/src/qpid/broker/Broker.h +++ b/cpp/src/qpid/broker/Broker.h @@ -61,6 +61,7 @@ class Broker : public sys::Runnable, public Plugin::Target, public management::M struct Options : public qpid::Options { Options(const std::string& name="Broker Options"); + bool noDataDir; std::string dataDir; uint16_t port; int workerThreads; diff --git a/cpp/src/qpidd.cpp b/cpp/src/qpidd.cpp index 6c20ebc58f..444283b067 100644 --- a/cpp/src/qpidd.cpp +++ b/cpp/src/qpidd.cpp @@ -48,9 +48,9 @@ struct ModuleOptions : public qpid::Options { ModuleOptions() : qpid::Options("Module options"), loadDir("/usr/lib/qpidd"), noLoad(false) { addOptions() - ("load-dir", optValue(loadDir, "DIR"), "Load all modules from this directory") - ("load-module", optValue(load, "FILE"), "Specifies additional module(s) to be loaded") - ("no-modules", optValue(noLoad), "Don't load any modules"); + ("module-dir", optValue(loadDir, "DIR"), "Load all .so modules in this directory") + ("load-module", optValue(load, "FILE"), "Specifies additional module(s) to be loaded") + ("no-module-dir", optValue(noLoad), "Don't load modules from module directory"); } }; @@ -188,12 +188,13 @@ int main(int argc, char* argv[]) // be re-parsed with all of the module-supplied options. bootOptions.parse (argc, argv, bootOptions.common.config, true); qpid::log::Logger::instance().configure(bootOptions.log, argv[0]); - if (!bootOptions.module.noLoad) { - for (vector<string>::iterator iter = bootOptions.module.load.begin(); - iter != bootOptions.module.load.end(); - iter++) - tryShlib (iter->data(), false); + for (vector<string>::iterator iter = bootOptions.module.load.begin(); + iter != bootOptions.module.load.end(); + iter++) + tryShlib (iter->data(), false); + + if (!bootOptions.module.noLoad) { bool isDefault = defaultPath == bootOptions.module.loadDir; loadModuleDir (bootOptions.module.loadDir, isDefault); } |