|
From: <bni...@us...> - 2007-05-21 22:53:51
|
Revision: 465
http://svn.sourceforge.net/omc/?rev=465&view=rev
Author: bnicholes
Date: 2007-05-21 15:53:49 -0700 (Mon, 21 May 2007)
Log Message:
-----------
Fix the addressing file code so that the addressing file is not opened repeatedly. Submitted by: [Jeff McMenomey <jeff mcmenomey hp com>]
Modified Paths:
--------------
clp/trunk/src/omcclpprogram.cpp
clp/trunk/src/omcclpprogram.h
Modified: clp/trunk/src/omcclpprogram.cpp
===================================================================
--- clp/trunk/src/omcclpprogram.cpp 2007-05-21 21:53:25 UTC (rev 464)
+++ clp/trunk/src/omcclpprogram.cpp 2007-05-21 22:53:49 UTC (rev 465)
@@ -76,6 +76,7 @@
, m_session(CIMNULL)
, m_sessionUFiP()
, m_clpout(clpout)
+ , m_addrref(NULL)
{
}
@@ -132,37 +133,46 @@
*/
OMCCLPConfigurationRef OMCCLPProgram::getAddrFileReference()
{
- if (m_addr_filename.empty())
+ //Let's not open the addressing configuration file a bunch of times. Do it
+ //once and re-use it. Re-opening this file many times can cause BIG performance problems.
+ //It doesn't appear that this should cause problems because each
+ //connection thread gets it's own OMCCLPDaemon object when it is created.
+ if (!m_addrref)
{
- m_addr_filename = getConfigItem(OMCClpdConfigOpts::CIM_ADDRESS_MAP_FILE_opt,
- OMCCLPD_DEFAULT_CIM_ADDRESS_MAP_FILE);
- }
- OMCCLPConfigurationRef addrref(new OMCCLPConfiguration(m_addr_filename));
+ if (m_addr_filename.empty())
+ {
+ m_addr_filename = getConfigItem(OMCClpdConfigOpts::CIM_ADDRESS_MAP_FILE_opt,
+ OMCCLPD_DEFAULT_CIM_ADDRESS_MAP_FILE);
+ }
- if (!addrref->isOpen())
- {
- String msg = String("The addressing file at ") + m_addr_filename +
- " appears to be empty or missing";
- logInfoMessage(msg);
- }
+ OMCCLPConfigurationRef addrref(new OMCCLPConfiguration(m_addr_filename));
- /* Get a list of all of the UFcTs that have a filter. */
- String ufcts = addrref->GetIniSectionsByKey("ufct");
- StringArray ufctSections = ufcts.tokenize(";");
+ if (!addrref->isOpen())
+ {
+ String msg = String("The addressing file at ") + m_addr_filename +
+ " appears to be empty or missing";
+ logInfoMessage(msg);
+ }
- for (int j=0; j<ufctSections.size(); j++)
- {
- String UFcT = addrref->GetIniSetting(ufctSections[j], String("ufct"));
+ /* Get a list of all of the UFcTs that have a filter. */
+ String ufcts = addrref->GetIniSectionsByKey("ufct");
+ StringArray ufctSections = ufcts.tokenize(";");
- addrref->PutIniSetting(String("UFcTs"), UFcT, ufctSections[j]);
- }
+ for (int j=0; j<ufctSections.size(); j++)
+ {
+ String UFcT = addrref->GetIniSetting(ufctSections[j], String("ufct"));
+ addrref->PutIniSetting(String("UFcTs"), UFcT, ufctSections[j]);
+ }
+
#ifdef DEBUG1
- StlIni::INIFile ini = addrref->getDataIni();
- SaveIni(ini, "debugdata.ini");
+ StlIni::INIFile ini = addrref->getDataIni();
+ SaveIni(ini, "debugdata.ini");
#endif
+ m_addrref = addrref;
+ }
- return addrref;
+ return m_addrref;
}
/**
Modified: clp/trunk/src/omcclpprogram.h
===================================================================
--- clp/trunk/src/omcclpprogram.h 2007-05-21 21:53:25 UTC (rev 464)
+++ clp/trunk/src/omcclpprogram.h 2007-05-21 22:53:49 UTC (rev 465)
@@ -203,6 +203,8 @@
CIMObjectPath m_session; // Reference to the session data
String m_sessionUFiP; // User friendly path that corresponds to the session object
std::ostream& m_clpout; // output stream
+ OMCCLPConfigurationRef m_addrref;
+
#ifndef OMCCLPCLIENT
LoggerRef m_logger;
#endif
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|