You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@qpid.apache.org by ac...@apache.org on 2008/02/08 23:27:42 UTC
svn commit: r620017 - in /incubator/qpid/trunk/qpid/cpp/src:
qpid/DataDir.cpp qpid/broker/Broker.cpp qpid/broker/Broker.h qpidd.cpp
Author: aconway
Date: Fri Feb 8 14:27:38 2008
New Revision: 620017
URL: http://svn.apache.org/viewvc?rev=620017&view=rev
Log:
>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.
Modified:
incubator/qpid/trunk/qpid/cpp/src/qpid/DataDir.cpp
incubator/qpid/trunk/qpid/cpp/src/qpid/broker/Broker.cpp
incubator/qpid/trunk/qpid/cpp/src/qpid/broker/Broker.h
incubator/qpid/trunk/qpid/cpp/src/qpidd.cpp
Modified: incubator/qpid/trunk/qpid/cpp/src/qpid/DataDir.cpp
URL: http://svn.apache.org/viewvc/incubator/qpid/trunk/qpid/cpp/src/qpid/DataDir.cpp?rev=620017&r1=620016&r2=620017&view=diff
==============================================================================
--- incubator/qpid/trunk/qpid/cpp/src/qpid/DataDir.cpp (original)
+++ incubator/qpid/trunk/qpid/cpp/src/qpid/DataDir.cpp Fri Feb 8 14:27:38 2008
@@ -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 @@
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 @@
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
Modified: incubator/qpid/trunk/qpid/cpp/src/qpid/broker/Broker.cpp
URL: http://svn.apache.org/viewvc/incubator/qpid/trunk/qpid/cpp/src/qpid/broker/Broker.cpp?rev=620017&r1=620016&r2=620017&view=diff
==============================================================================
--- incubator/qpid/trunk/qpid/cpp/src/qpid/broker/Broker.cpp (original)
+++ incubator/qpid/trunk/qpid/cpp/src/qpid/broker/Broker.cpp Fri Feb 8 14:27:38 2008
@@ -60,6 +60,7 @@
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 @@
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 @@
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)
{
Modified: incubator/qpid/trunk/qpid/cpp/src/qpid/broker/Broker.h
URL: http://svn.apache.org/viewvc/incubator/qpid/trunk/qpid/cpp/src/qpid/broker/Broker.h?rev=620017&r1=620016&r2=620017&view=diff
==============================================================================
--- incubator/qpid/trunk/qpid/cpp/src/qpid/broker/Broker.h (original)
+++ incubator/qpid/trunk/qpid/cpp/src/qpid/broker/Broker.h Fri Feb 8 14:27:38 2008
@@ -61,6 +61,7 @@
struct Options : public qpid::Options {
Options(const std::string& name="Broker Options");
+ bool noDataDir;
std::string dataDir;
uint16_t port;
int workerThreads;
Modified: incubator/qpid/trunk/qpid/cpp/src/qpidd.cpp
URL: http://svn.apache.org/viewvc/incubator/qpid/trunk/qpid/cpp/src/qpidd.cpp?rev=620017&r1=620016&r2=620017&view=diff
==============================================================================
--- incubator/qpid/trunk/qpid/cpp/src/qpidd.cpp (original)
+++ incubator/qpid/trunk/qpid/cpp/src/qpidd.cpp Fri Feb 8 14:27:38 2008
@@ -48,9 +48,9 @@
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 @@
// 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);
}