summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBenoit Foucher <benoit@zeroc.com>2005-02-14 09:58:18 +0000
committerBenoit Foucher <benoit@zeroc.com>2005-02-14 09:58:18 +0000
commit0b3e545cb8f494752c1982aa504f4aa658ced475 (patch)
tree45c2bfeb2fc1e9e93cee2414ac34394c82f20350
parentFixed warning with aCC (HP) (diff)
downloadice-0b3e545cb8f494752c1982aa504f4aa658ced475.tar.bz2
ice-0b3e545cb8f494752c1982aa504f4aa658ced475.tar.xz
ice-0b3e545cb8f494752c1982aa504f4aa658ced475.zip
Fixes to ensure that the evictor updates will be saved immediatly.
-rw-r--r--cpp/src/IcePack/AdapterFactory.cpp3
-rw-r--r--cpp/src/IcePack/IcePackNode.cpp23
-rw-r--r--cpp/src/IcePack/Registry.cpp20
-rw-r--r--cpp/src/IcePack/Registry.h2
-rw-r--r--cpp/src/IcePack/ServerFactory.cpp2
5 files changed, 30 insertions, 20 deletions
diff --git a/cpp/src/IcePack/AdapterFactory.cpp b/cpp/src/IcePack/AdapterFactory.cpp
index 7000d4f5a20..25981f5c520 100644
--- a/cpp/src/IcePack/AdapterFactory.cpp
+++ b/cpp/src/IcePack/AdapterFactory.cpp
@@ -24,9 +24,12 @@ IcePack::AdapterFactory::AdapterFactory(const Ice::ObjectAdapterPtr& adapter,
_adapter(adapter),
_traceLevels(traceLevels)
{
+ Ice::PropertiesPtr properties = _adapter->getCommunicator()->getProperties();
+
//
// Create and install the freeze evictor for standalone adapter objects.
//
+ properties->setProperty("Freeze.Evictor." + envName + ".adapter.SaveSizeTrigger", "1");
_evictor = Freeze::createEvictor(_adapter, envName, "adapter");
_evictor->setSize(1000);
diff --git a/cpp/src/IcePack/IcePackNode.cpp b/cpp/src/IcePack/IcePackNode.cpp
index c7b7c80db16..fa14acda8df 100644
--- a/cpp/src/IcePack/IcePackNode.cpp
+++ b/cpp/src/IcePack/IcePackNode.cpp
@@ -227,8 +227,8 @@ IcePack::NodeService::start(int argc, char* argv[])
//
// Initialize the database environment (first setup the directory structure if needed).
//
- string envName;
string dataPath = properties->getProperty("IcePack.Node.Data");
+ string dbPath;
if(dataPath.empty())
{
error("property `IcePack.Node.Data' is not set");
@@ -261,22 +261,21 @@ IcePack::NodeService::start(int argc, char* argv[])
#endif
//
- // Creates subdirectories db and servers in the IcePack.Node.Data
- // directory if they don't already exist.
+ // Creates subdirectories db and servers in the IcePack.Node.Data directory if they don't already exist.
//
if(dataPath[dataPath.length() - 1] != '/')
{
dataPath += "/";
}
- envName = dataPath + "db";
+ dbPath = dataPath + "db";
string serversPath = dataPath + "servers";
string tmpPath = dataPath + "tmp";
#ifdef _WIN32
- if(::_stat(envName.c_str(), &filestat) != 0)
+ if(::_stat(dbPath.c_str(), &filestat) != 0)
{
- _mkdir(envName.c_str());
+ _mkdir(dbPath.c_str());
}
if(::_stat(serversPath.c_str(), &filestat) != 0)
{
@@ -287,9 +286,9 @@ IcePack::NodeService::start(int argc, char* argv[])
_mkdir(tmpPath.c_str());
}
#else
- if(::stat(envName.c_str(), &filestat) != 0)
+ if(::stat(dbPath.c_str(), &filestat) != 0)
{
- mkdir(envName.c_str(), 0755);
+ mkdir(dbPath.c_str(), 0755);
}
if(::stat(serversPath.c_str(), &filestat) != 0)
{
@@ -327,6 +326,12 @@ IcePack::NodeService::start(int argc, char* argv[])
}
//
+ // Setup the Freeze database environment home directory. The name of the database
+ // environment for the IcePack node is the name of the node.
+ //
+ properties->setProperty("Freeze.DbEnv." + name + ".DbHome", dbPath);
+
+ //
// Set the adapter id for this node and create the node object adapter.
//
properties->setProperty("IcePack.Node.AdapterId", "IcePack.Node." + name);
@@ -350,7 +355,7 @@ IcePack::NodeService::start(int argc, char* argv[])
// for the server and server adapter. It also takes care of installing the
// evictors and object factories necessary to store these objects.
//
- ServerFactoryPtr serverFactory = new ServerFactory(adapter, traceLevels, envName, _activator, _waitQueue);
+ ServerFactoryPtr serverFactory = new ServerFactory(adapter, traceLevels, name, _activator, _waitQueue);
NodePtr node = new NodeI(_activator, name, serverFactory, communicator(), properties);
Identity id = stringToIdentity(IceUtil::generateUUID());
adapter->add(node, id);
diff --git a/cpp/src/IcePack/Registry.cpp b/cpp/src/IcePack/Registry.cpp
index 7046ce4d51e..7cc646f9a54 100644
--- a/cpp/src/IcePack/Registry.cpp
+++ b/cpp/src/IcePack/Registry.cpp
@@ -66,8 +66,8 @@ IcePack::Registry::start(bool nowarn)
//
// Initialize the database environment.
//
- _envName = properties->getProperty("IcePack.Registry.Data");
- if(_envName.empty())
+ string dbPath = properties->getProperty("IcePack.Registry.Data");
+ if(dbPath.empty())
{
Error out(_communicator->getLogger());
out << "property `IcePack.Registry.Data' is not set";
@@ -76,7 +76,7 @@ IcePack::Registry::start(bool nowarn)
else
{
struct stat filestat;
- if(stat(_envName.c_str(), &filestat) != 0 || !S_ISDIR(filestat.st_mode))
+ if(stat(dbPath.c_str(), &filestat) != 0 || !S_ISDIR(filestat.st_mode))
{
Error out(_communicator->getLogger());
SyscallException ex(__FILE__, __LINE__);
@@ -220,12 +220,14 @@ IcePack::Registry::start(bool nowarn)
//
// Create the internal registries (node, server, adapter, object).
//
- AdapterFactoryPtr adapterFactory = new AdapterFactory(registryAdapter, traceLevels, _envName);
- ObjectRegistryPtr objectRegistry = new ObjectRegistryI(_communicator, _envName, traceLevels);
- AdapterRegistryPtr adapterRegistry = new AdapterRegistryI(_communicator, _envName, traceLevels);
- ServerRegistryPtr serverRegistry = new ServerRegistryI(_communicator, _envName, traceLevels);
- ApplicationRegistryPtr appReg = new ApplicationRegistryI(_communicator, serverRegistry, _envName, traceLevels);
- NodeRegistryPtr nodeReg = new NodeRegistryI(_communicator, _envName, adapterRegistry, adapterFactory, traceLevels);
+ const string envName = "Registry";
+ properties->setProperty("Freeze.DbEnv.Registry.DbHome", dbPath);
+ AdapterFactoryPtr adapterFactory = new AdapterFactory(registryAdapter, traceLevels, envName);
+ ObjectRegistryPtr objectRegistry = new ObjectRegistryI(_communicator, envName, traceLevels);
+ AdapterRegistryPtr adapterRegistry = new AdapterRegistryI(_communicator, envName, traceLevels);
+ ServerRegistryPtr serverRegistry = new ServerRegistryI(_communicator, envName, traceLevels);
+ ApplicationRegistryPtr appReg = new ApplicationRegistryI(_communicator, serverRegistry, envName, traceLevels);
+ NodeRegistryPtr nodeReg = new NodeRegistryI(_communicator, envName, adapterRegistry, adapterFactory, traceLevels);
registryAdapter->add(objectRegistry, stringToIdentity("IcePack/ObjectRegistry"));
registryAdapter->add(adapterRegistry, stringToIdentity("IcePack/AdapterRegistry"));
diff --git a/cpp/src/IcePack/Registry.h b/cpp/src/IcePack/Registry.h
index 41f7e2e2676..b1b1e7daf2c 100644
--- a/cpp/src/IcePack/Registry.h
+++ b/cpp/src/IcePack/Registry.h
@@ -25,8 +25,6 @@ public:
private:
Ice::CommunicatorPtr _communicator;
-
- std::string _envName;
};
}
diff --git a/cpp/src/IcePack/ServerFactory.cpp b/cpp/src/IcePack/ServerFactory.cpp
index 1304209cd81..038702ae6e3 100644
--- a/cpp/src/IcePack/ServerFactory.cpp
+++ b/cpp/src/IcePack/ServerFactory.cpp
@@ -102,12 +102,14 @@ ServerFactory::ServerFactory(const Ice::ObjectAdapterPtr& adapter,
//
// Create and install the freeze evictor for server objects.
//
+ properties->setProperty("Freeze.Evictor." + envName + ".servers.SaveSizeTrigger", "1");
_serverEvictor = Freeze::createEvictor(_adapter, envName, "servers", 0);
_serverEvictor->setSize(10000);
//
// Create and install the freeze evictor for server adapter objects.
//
+ properties->setProperty("Freeze.Evictor." + envName + ".serveradapters.SaveSizeTrigger", "1");
_serverAdapterEvictor = Freeze::createEvictor(_adapter, envName, "serveradapters", 0);
_serverAdapterEvictor->setSize(10000);