Paulo Vicentini wrote:
For instance:
My service needs to mmap a file but I wouldn't like to call mmap for
every request…
So I would like to keep the address returned by mmap functional
between requests.
As Samisa suggested, you can keep this information in service context.
You can see an example implementation in [1], which is calling a method
"sct_provider_get_sct_hash" in line 180. (The method is implemented in
[2] line 158). "sct_provider_get_sct_hash" method is creating an
axutil_hash_t and store it in conf_ctx. You can easily change it to
store it in service context.
In apache prefork MPM(this is default in apache in linux), multiple
httpd processes will be created. So you will have multiple process
address space. In that case, even if you create it in service context,
it will be in a single process address space. So, if a request hits
another httpd process, information stored in first httpd address space
cannot be accessed from second httpd process. To overcome this, you have
to enable shared global pool by giving a positive value for
"Axis2GlobalPoolSize" option in httpd.conf. Please refer [3]. Then
before creating/accessing a persistence object, you have to switch to
global pool. Once finished accessing it, you have to switch back to
local pool (you can see this in [1] line 128 and 190)
Regards,
Shankar
[1]
http://svn.apache.org/repos/asf/webservices/rampart/trunk/c/samples/server/secconv_echo/echo.c
[2]
http://svn.apache.org/repos/asf/webservices/rampart/trunk/c/src/secconv/sct_provider.c
[3] http://ws.apache.org/axis2/c/docs/axis2c_manual.html#mod_axis2
Tks
Paulo
On Mon, May 5, 2008 at 4:23 PM, Samisa Abeysinghe <[EMAIL PROTECTED]
<mailto:[EMAIL PROTECTED]>> wrote:
Paulo Vicentini wrote:
Hi,
What is the approach in order to keep in memory data
information between service requests?
You can use service context. Please gave a look into the sg_math
sample. There are other ways of doing this as well, like the use
of shared memory. Shankar, can you comment please?
Be my service: myservice.so deployed in axis2/c.
What about its life-cycle after deploying it?
It lives, till you shutdown the server.
If I allocate resources (pointers, files descriptors, mapped
files,etc) during my service invocation and I don't free
explicitly those resources , will they remain available
between requests?
They will not be available. And if you are using simple axis
server, this would lead to memory leaks.
Do all requests over my service remain to the same process
address space?
If you are using simple axis server, yes. But if you are using
httpd, may be yea, may be not, based on the MPM in use.
Samisa...
Thanks
Paulo
------------------------------------------------------------------------
No virus found in this incoming message.
Checked by AVG. Version: 7.5.524 / Virus Database:
269.23.8/1413 - Release Date: 5/3/2008 11:22 AM
--
Samisa Abeysinghe Director, Engineering; WSO2 Inc.
http://www.wso2.com/ - "The Open Source SOA Company"
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
<mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: [EMAIL PROTECTED]
<mailto:[EMAIL PROTECTED]>
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]