summaryrefslogtreecommitdiff
path: root/ACE/ace/Service_Gestalt.cpp
diff options
context:
space:
mode:
authoriliyan <iliyan@ae88bc3d-4319-0410-8dbf-d08b4c9d3795>2007-01-16 21:04:09 +0000
committeriliyan <iliyan@ae88bc3d-4319-0410-8dbf-d08b4c9d3795>2007-01-16 21:04:09 +0000
commitbd276fb57c3162f0c5ce8626dd73958f69a8151c (patch)
tree80ae303b01edc9894f9e37a67904e5266ad5e9d4 /ACE/ace/Service_Gestalt.cpp
parent2b994b55cf8ba3eb17c2d17c34afc6d73f7a5429 (diff)
downloadATCD-bd276fb57c3162f0c5ce8626dd73958f69a8151c.tar.gz
ChangeLogTag: Tue Jan 16 21:00:20 UTC 2007 Iliyan Jeliazkov <iliyan@ociweb.com>
Diffstat (limited to 'ACE/ace/Service_Gestalt.cpp')
-rw-r--r--ACE/ace/Service_Gestalt.cpp49
1 files changed, 24 insertions, 25 deletions
diff --git a/ACE/ace/Service_Gestalt.cpp b/ACE/ace/Service_Gestalt.cpp
index 4d2492daac2..8757e54c8b2 100644
--- a/ACE/ace/Service_Gestalt.cpp
+++ b/ACE/ace/Service_Gestalt.cpp
@@ -283,6 +283,7 @@ ACE_Service_Gestalt::ACE_Service_Gestalt (size_t size,
, no_static_svcs_ (no_static_svcs)
, svc_queue_ (0)
, svc_conf_file_queue_ (0)
+ , repo_ (0)
, static_svcs_ (0)
, processed_static_svcs_ (0)
{
@@ -297,22 +298,29 @@ ACE_Service_Gestalt::ACE_Service_Gestalt (size_t size,
}
/// Performs the common initialization tasks for a new or previously
-/// closed instance. Must not be virtual, as it is called from the
-/// constructor.
+/// closed instance. Must not be virtual, as it is also called from
+/// the constructor.
int
ACE_Service_Gestalt::init_i (void)
{
- if (this->svc_repo_is_owned_)
- {
- ACE_NEW_NORETURN (this->repo_,
- ACE_Service_Repository (this->svc_repo_size_));
- }
- else
+ // Only initialize the repo_ if (a) we are being constructed, or;
+ // (b) we're being open()-ed, perhaps after previously having been
+ // close()-ed. In both cases: repo_ == 0 and we need a repository.
+ if (this->repo_ == 0)
{
- this->repo_ =
- ACE_Service_Repository::instance (this->svc_repo_size_);
+ if (this->svc_repo_is_owned_)
+ {
+ ACE_NEW_NORETURN (this->repo_,
+ ACE_Service_Repository (this->svc_repo_size_));
+ if (this->repo_ == 0)
+ return -1;
+ }
+ else
+ {
+ this->repo_ =
+ ACE_Service_Repository::instance (this->svc_repo_size_);
+ }
}
-
return 0;
}
@@ -1299,14 +1307,6 @@ ACE_Service_Gestalt::close (void)
delete this->svc_conf_file_queue_;
this->svc_conf_file_queue_ = 0;
-#ifndef ACE_NLOGGING
- // Delete the dynamically allocated static_svcs instance.
- if (ACE::debug ())
- ACE_DEBUG ((LM_DEBUG,
- ACE_LIB_TEXT ("ACE (%P|%t) SG::close - this=%@, repo=%@, pss = %@\n"),
- this, this->repo_, this->processed_static_svcs_));
-#endif
-
if (this->processed_static_svcs_ &&
!this->processed_static_svcs_->is_empty())
{
@@ -1321,18 +1321,17 @@ ACE_Service_Gestalt::close (void)
delete this->processed_static_svcs_;
this->processed_static_svcs_ = 0;
- if (this->svc_repo_is_owned_)
- delete this->repo_;
-
#ifndef ACE_NLOGGING
if (ACE::debug ())
ACE_DEBUG ((LM_DEBUG,
- ACE_LIB_TEXT ("ACE (%P|%t) SG::close - complete this=%@, repo=%@\n"),
- this, this->repo_));
+ ACE_LIB_TEXT ("ACE (%P|%t) SG::close - complete this=%@, repo=%@, owned=%d\n"),
+ this, this->repo_, this->svc_repo_is_owned_));
#endif
- this->repo_ = 0;
+ if (this->svc_repo_is_owned_)
+ delete this->repo_;
+ this->repo_ = 0;
return 0;
} /* close () */