summaryrefslogtreecommitdiff
path: root/cpp/src
diff options
context:
space:
mode:
authorMatthew Newhook <matthew@zeroc.com>2005-10-12 02:23:00 +0000
committerMatthew Newhook <matthew@zeroc.com>2005-10-12 02:23:00 +0000
commit2a52a8fca98c1b3f5549f56a5d89356023699cb2 (patch)
tree6577c0dafdaf817d458adc092747f5c7a815aca5 /cpp/src
parenthttp://bugzilla.zeroc.com/bugzilla/show_bug.cgi?id=87 (diff)
downloadice-2a52a8fca98c1b3f5549f56a5d89356023699cb2.tar.bz2
ice-2a52a8fca98c1b3f5549f56a5d89356023699cb2.tar.xz
ice-2a52a8fca98c1b3f5549f56a5d89356023699cb2.zip
http://bugzilla.zeroc.com/bugzilla/show_bug.cgi?id=87
Diffstat (limited to 'cpp/src')
-rw-r--r--cpp/src/Ice/Application.cpp2
-rw-r--r--cpp/src/Ice/CommunicatorI.cpp4
-rw-r--r--cpp/src/Ice/CommunicatorI.h6
-rw-r--r--cpp/src/Ice/Initialize.cpp18
-rw-r--r--cpp/src/Ice/Instance.cpp43
-rw-r--r--cpp/src/Ice/Instance.h2
6 files changed, 47 insertions, 28 deletions
diff --git a/cpp/src/Ice/Application.cpp b/cpp/src/Ice/Application.cpp
index 26e7c0d51d6..2e143fa81f2 100644
--- a/cpp/src/Ice/Application.cpp
+++ b/cpp/src/Ice/Application.cpp
@@ -249,7 +249,7 @@ Ice::Application::main(int argc, char* argv[], const char* configFile, const Log
}
else
{
- _communicator = initialize(argc, argv);
+ _communicator = initializeWithLogger(argc, argv, logger);
}
_destroyed = false;
diff --git a/cpp/src/Ice/CommunicatorI.cpp b/cpp/src/Ice/CommunicatorI.cpp
index 3fb9e387e67..8170ea1b1cf 100644
--- a/cpp/src/Ice/CommunicatorI.cpp
+++ b/cpp/src/Ice/CommunicatorI.cpp
@@ -239,12 +239,12 @@ Ice::CommunicatorI::flushBatchRequests()
_instance->flushBatchRequests();
}
-Ice::CommunicatorI::CommunicatorI(const PropertiesPtr& properties)
+Ice::CommunicatorI::CommunicatorI(const PropertiesPtr& properties, const LoggerPtr& logger)
{
__setNoDelete(true);
try
{
- const_cast<InstancePtr&>(_instance) = new Instance(this, properties);
+ const_cast<InstancePtr&>(_instance) = new Instance(this, properties, logger);
//
// Keep a reference to the dynamic library list to ensure
diff --git a/cpp/src/Ice/CommunicatorI.h b/cpp/src/Ice/CommunicatorI.h
index 2865f1b449e..46b2d1560db 100644
--- a/cpp/src/Ice/CommunicatorI.h
+++ b/cpp/src/Ice/CommunicatorI.h
@@ -61,7 +61,7 @@ public:
private:
- CommunicatorI(const PropertiesPtr&);
+ CommunicatorI(const PropertiesPtr&, const LoggerPtr&);
virtual ~CommunicatorI();
//
@@ -70,8 +70,8 @@ private:
//
void finishSetup(int&, char*[]);
- friend ICE_API CommunicatorPtr initialize(int&, char*[], Int);
- friend ICE_API CommunicatorPtr initializeWithProperties(int&, char*[], const PropertiesPtr&, Int);
+ friend ICE_API CommunicatorPtr initializeWithPropertiesAndLogger(int&, char*[], const PropertiesPtr&,
+ const LoggerPtr&, Int);
friend ICE_API ::IceInternal::InstancePtr IceInternal::getInstance(const ::Ice::CommunicatorPtr&);
const ::IceInternal::InstancePtr _instance;
diff --git a/cpp/src/Ice/Initialize.cpp b/cpp/src/Ice/Initialize.cpp
index b7d5a0246ed..733e3e278ac 100644
--- a/cpp/src/Ice/Initialize.cpp
+++ b/cpp/src/Ice/Initialize.cpp
@@ -151,12 +151,26 @@ CommunicatorPtr
Ice::initialize(int& argc, char* argv[], Int version)
{
PropertiesPtr properties = getDefaultProperties(argc, argv);
- return initializeWithProperties(argc, argv, properties, version);
+ return initializeWithPropertiesAndLogger(argc, argv, properties, 0, version);
}
CommunicatorPtr
Ice::initializeWithProperties(int& argc, char* argv[], const PropertiesPtr& properties, Int version)
{
+ return initializeWithPropertiesAndLogger(argc, argv, properties, 0, version);
+}
+
+CommunicatorPtr
+Ice::initializeWithLogger(int& argc, char* argv[], const LoggerPtr& logger, Int version)
+{
+ PropertiesPtr properties = getDefaultProperties(argc, argv);
+ return initializeWithPropertiesAndLogger(argc, argv, properties, logger, version);
+}
+
+CommunicatorPtr
+Ice::initializeWithPropertiesAndLogger(int& argc, char* argv[], const PropertiesPtr& properties,
+ const LoggerPtr& logger, Int version)
+{
#ifndef ICE_IGNORE_VERSION
//
// Major and minor version numbers must match.
@@ -179,7 +193,7 @@ Ice::initializeWithProperties(int& argc, char* argv[], const PropertiesPtr& prop
args = properties->parseIceCommandLineOptions(args);
stringSeqToArgs(args, argc, argv);
- CommunicatorI* communicatorI = new CommunicatorI(properties);
+ CommunicatorI* communicatorI = new CommunicatorI(properties, logger);
CommunicatorPtr result = communicatorI; // For exception safety.
communicatorI->finishSetup(argc, argv);
return result;
diff --git a/cpp/src/Ice/Instance.cpp b/cpp/src/Ice/Instance.cpp
index 7e0c0cb8ea1..112fbd74cc8 100644
--- a/cpp/src/Ice/Instance.cpp
+++ b/cpp/src/Ice/Instance.cpp
@@ -414,9 +414,11 @@ IceInternal::Instance::getDefaultContext() const
}
-IceInternal::Instance::Instance(const CommunicatorPtr& communicator, const PropertiesPtr& properties) :
+IceInternal::Instance::Instance(const CommunicatorPtr& communicator, const PropertiesPtr& properties,
+ const LoggerPtr& logger) :
_state(StateActive),
_properties(properties),
+ _logger(logger),
_messageSizeMax(0),
_clientACM(0),
_serverACM(0),
@@ -539,27 +541,30 @@ IceInternal::Instance::Instance(const CommunicatorPtr& communicator, const Prope
sync.release();
-#ifdef _WIN32
- if(_properties->getPropertyAsInt("Ice.UseEventLog") > 0)
- {
- _logger = new EventLoggerI(_properties->getProperty("Ice.ProgramName"));
- }
- else
+ if(!_logger)
{
- _logger = new LoggerI(_properties->getProperty("Ice.ProgramName"),
- _properties->getPropertyAsInt("Ice.Logger.Timestamp") > 0);
- }
+#ifdef _WIN32
+ if(_properties->getPropertyAsInt("Ice.UseEventLog") > 0)
+ {
+ _logger = new EventLoggerI(_properties->getProperty("Ice.ProgramName"));
+ }
+ else
+ {
+ _logger = new LoggerI(_properties->getProperty("Ice.ProgramName"),
+ _properties->getPropertyAsInt("Ice.Logger.Timestamp") > 0);
+ }
#else
- if(_properties->getPropertyAsInt("Ice.UseSyslog") > 0)
- {
- _logger = new SysLoggerI;
- }
- else
- {
- _logger = new LoggerI(_properties->getProperty("Ice.ProgramName"),
- _properties->getPropertyAsInt("Ice.Logger.Timestamp") > 0);
- }
+ if(_properties->getPropertyAsInt("Ice.UseSyslog") > 0)
+ {
+ _logger = new SysLoggerI;
+ }
+ else
+ {
+ _logger = new LoggerI(_properties->getProperty("Ice.ProgramName"),
+ _properties->getPropertyAsInt("Ice.Logger.Timestamp") > 0);
+ }
#endif
+ }
_stats = 0; // There is no default statistics callback object.
diff --git a/cpp/src/Ice/Instance.h b/cpp/src/Ice/Instance.h
index 44b50d98e95..4da34f46fc2 100644
--- a/cpp/src/Ice/Instance.h
+++ b/cpp/src/Ice/Instance.h
@@ -80,7 +80,7 @@ public:
private:
- Instance(const Ice::CommunicatorPtr&, const Ice::PropertiesPtr&);
+ Instance(const Ice::CommunicatorPtr&, const Ice::PropertiesPtr&, const Ice::LoggerPtr&);
virtual ~Instance();
void finishSetup(int&, char*[]);
bool destroy();