samisa 2004/09/22 19:59:54
Modified: c/include/axis/client Call.h
c/src/engine/client Call.cpp
c/src/engine Axis.cpp
Log:
Changed the way static variables are initialized.
Now if one wants, the initialize_module and uninitialize_module can be called
fom outside a Stub and if initialize_module has been already callsed, Call class
would not call it again.
This is useful in case of thread safety.
Revision Changes Path
1.28 +7 -0 ws-axis/c/include/axis/client/Call.h
Index: Call.h
===================================================================
RCS file: /home/cvs/ws-axis/c/include/axis/client/Call.h,v
retrieving revision 1.27
retrieving revision 1.28
diff -u -r1.27 -r1.28
--- Call.h 1 Sep 2004 09:10:18 -0000 1.27
+++ Call.h 23 Sep 2004 02:59:53 -0000 1.28
@@ -829,6 +829,13 @@
* Use Proxy or not?
*/
bool m_bUseProxy;
+
+ /**
+ * If this object calls initialize_module, this will be set to true.
+ * Helps keep track of whether to call uninitialize_module in destructor.
+ * It is possible that initialize_module could have been called already.
+ */
+ bool m_bModuleInitialized;
};
AXIS_CPP_NAMESPACE_END
1.59 +11 -3 ws-axis/c/src/engine/client/Call.cpp
Index: Call.cpp
===================================================================
RCS file: /home/cvs/ws-axis/c/src/engine/client/Call.cpp,v
retrieving revision 1.58
retrieving revision 1.59
diff -u -r1.58 -r1.59
--- Call.cpp 8 Sep 2004 13:25:21 -0000 1.58
+++ Call.cpp 23 Sep 2004 02:59:53 -0000 1.59
@@ -40,19 +40,26 @@
extern "C" int initialize_module (int bServer);
extern "C" int uninitialize_module ();
+extern "C" bool g_bModuleInitialize;
+
AXIS_CPP_NAMESPACE_USE
bool CallBase::bInitialized = false;
CallFunctions CallBase::ms_VFtable;
Call::Call ()
-:m_strProxyHost(""), m_uiProxyPort(0), m_bUseProxy(false)
+:m_strProxyHost(""), m_uiProxyPort(0), m_bUseProxy(false), m_bModuleInitialized(false)
{
m_pAxisEngine = NULL;
m_pMsgData = NULL;
m_pIWSSZ = NULL;
m_pIWSDZ = NULL;
- initialize_module (0);
+ if (!g_bModuleInitialize)
+ {
+ initialize_module (0);
+ m_bModuleInitialized = true;
+ }
+
m_pTransport = NULL;
m_nStatus = AXIS_SUCCESS;
m_pcEndPointUri = 0;
@@ -60,7 +67,8 @@
Call::~Call ()
{
- uninitialize_module();
+ if (m_bModuleInitialized)
+ uninitialize_module();
free(m_pcEndPointUri);
}
1.70 +6 -3 ws-axis/c/src/engine/Axis.cpp
Index: Axis.cpp
===================================================================
RCS file: /home/cvs/ws-axis/c/src/engine/Axis.cpp,v
retrieving revision 1.69
retrieving revision 1.70
diff -u -r1.69 -r1.70
--- Axis.cpp 7 Sep 2004 09:40:40 -0000 1.69
+++ Axis.cpp 23 Sep 2004 02:59:54 -0000 1.70
@@ -85,6 +85,8 @@
AxisConfig* g_pConfig;
AxisTrace* g_pAT;
+//Keeps track of whether initialize_module/uninitialize_module was called
+bool g_bModuleInitialize;
#ifndef AXIS_CLIENT_LIB
@@ -190,7 +192,7 @@
}
pStream->sendBytes("</tbody></table>", NULL);
pStream->sendBytes
- ("<br><p align=\"center\">Copyright © 2001-2003 The
Apache Software Foundation<br></p></body></html>", NULL);
+ ("<br><p align=\"center\">Copyright 2001-2003 The
Apache Software Foundation<br></p></body></html>", NULL);
Status = AXIS_SUCCESS;
}
else
@@ -235,6 +237,7 @@
extern "C" int initialize_module (int bServer)
{
+ g_bModuleInitialize = true;
int status = 0;
// order of these initialization method invocation should not be changed
AxisEngine::m_bServer = bServer;
@@ -338,6 +341,7 @@
extern "C" int uninitialize_module ()
{
+ g_bModuleInitialize = false;
SOAPTransportFactory::uninitialize();
ModuleUnInitialize ();
SoapKeywordMapping::uninitialize ();
@@ -355,7 +359,7 @@
}
void ModuleInitialize ()
-{
+{
// synchronized global variables.
g_pHandlerLoader = new HandlerLoader ();
g_pAppScopeHandlerPool = new AppScopeHandlerPool ();
@@ -384,5 +388,4 @@
delete g_pWSDDDeployment;
delete g_pConfig;
delete g_pAT;
-
}
|