You are viewing a plain text version of this content. The canonical link for it is here.
Posted to c-user@axis.apache.org by Damitha Kumarage <da...@wso2.com> on 2012/01/02 08:03:12 UTC
Re: Do not want some application code to be executed for each request
On 12/30/2011 03:59 PM, Pankaj Kharwal wrote:
>
> Dear all,
>
> I have an application written in C/C++ (runs as a webservice) which
> was previously running on some other platform. Now, the application
> has been ported to Linux and now we are using AXIS2C 1.6.0. So far, I
> have been successful in running the application on AXIS2C with minor
> glitches.
>
> However, the application has some constructors which query tables
> (heavy SELECTS) and based on the data read from the tables, the
> application processes the request. The problem is that when I fire a
> request, AXIS2C executes these constructors for each request. This is
> not desirable because I do not want these heavy SELECTs to be executed
> each time the request comes to AXIS since it takes upto 3 seconds for
> the constructors to execute the SQL SELECTs.
>
> Is there any way to call these constructors only at the start of AXIS
> engine and save this as a context to be used by the upcoming requests?
>
try using AXIS2_SVC_SKELETON_INIT_WITH_CONF.
Use this just like AXIS2_SVC_SKELETON_INIT method except that axis2_conf
struct is passed to this method. Store whatever things you need to
keep between requests as parameter in axis2_conf struct.
See a sample service like math to see how init function can be used.
init and init_with_conf are called only at service load time.
Damitha
>
> Thanks and Regards,
>
> Pankaj Kharwal
>
> Stockholm, Sweden
>
>
> ______________________________________________________________________
> This email has been scanned by the Symantec Email Security.cloud service.
> For more information please visit http://www.symanteccloud.com
> ______________________________________________________________________
--
__________________________________________________________________
Damitha Kumarage
Technical Lead; WSO2 Inc.
email:damitha@wso2.com; phone:+94 332262389; cell:+94 719169327
"Oxygenating the Web Service Platform; " http://www.wso2.com/
blog: " http://damithakumarage.wordpress.com/
__________________________________________________________________
SV: Do not want some application code to be executed for each
request
Posted by Pankaj Kharwal <Pa...@kf.se>.
Hi Damitha,
Since, so far, I was not successful in implemeting init_with_conf(), I tried creating the object in the init() method only. This seems to work but the object creation happens 3 times. For first two times, it is happening even before init() is called. Third time, it is the desired call. Although, the object creation is implemented inside init(), I don't know why AXIS internals create this object twice even before init() is called.
I tried using init_with_conf, but the function does not seem to be called ever by Axis engine. I am sure I am causing some blunder, but so far I have not been successful. Could you please direct me to some implementation example where this function is successfully used. Moreover, would it be possible to pass a C++ object into the configuration context structure. If yes, how?
Thanks and Regards,
Pankaj Kharwal
Stockholm, Sweden
Från: Pankaj Kharwal [mailto:Pankaj.Kharwal@kf.se]
Skickat: den 2 januari 2012 18:42
Till: Apache AXIS C User List
Kopia: Damitha Kumarage
Ämne: SV: Do not want some application code to be executed for each request
Thanks a lot Damitha. I will try this out and post my results soon.
Warm Regards,
Pankaj Kharwal
Stockholm, Sweden
Från: Damitha Kumarage [mailto:damitha@wso2.com]
Skickat: den 2 januari 2012 08:03
Till: c-user@axis.apache.org
Ämne: Re: Do not want some application code to be executed for each request
On 12/30/2011 03:59 PM, Pankaj Kharwal wrote:
Dear all,
I have an application written in C/C++ (runs as a webservice) which was previously running on some other platform. Now, the application has been ported to Linux and now we are using AXIS2C 1.6.0. So far, I have been successful in running the application on AXIS2C with minor glitches.
However, the application has some constructors which query tables (heavy SELECTS) and based on the data read from the tables, the application processes the request. The problem is that when I fire a request, AXIS2C executes these constructors for each request. This is not desirable because I do not want these heavy SELECTs to be executed each time the request comes to AXIS since it takes upto 3 seconds for the constructors to execute the SQL SELECTs.
Is there any way to call these constructors only at the start of AXIS engine and save this as a context to be used by the upcoming requests?
try using AXIS2_SVC_SKELETON_INIT_WITH_CONF.
Use this just like AXIS2_SVC_SKELETON_INIT method except that axis2_conf struct is passed to this method. Store whatever things you need to
keep between requests as parameter in axis2_conf struct.
See a sample service like math to see how init function can be used. init and init_with_conf are called only at service load time.
Damitha
Thanks and Regards,
Pankaj Kharwal
Stockholm, Sweden
______________________________________________________________________
This email has been scanned by the Symantec Email Security.cloud service.
For more information please visit http://www.symanteccloud.com
______________________________________________________________________
--
__________________________________________________________________
Damitha Kumarage
Technical Lead; WSO2 Inc.
email:damitha@wso2.com<ma...@wso2.com>; phone:+94 332262389; cell:+94 719169327
"Oxygenating the Web Service Platform; " http://www.wso2.com/
blog: " http://damithakumarage.wordpress.com/
__________________________________________________________________
______________________________________________________________________
This email has been scanned by the Symantec Email Security.cloud service.
For more information please visit http://www.symanteccloud.com
______________________________________________________________________
______________________________________________________________________
This email has been scanned by the Symantec Email Security.cloud service.
For more information please visit http://www.symanteccloud.com
______________________________________________________________________
______________________________________________________________________
This email has been scanned by the Symantec Email Security.cloud service.
For more information please visit http://www.symanteccloud.com
______________________________________________________________________
______________________________________________________________________
This email has been scanned by the Symantec Email Security.cloud service.
For more information please visit http://www.symanteccloud.com
______________________________________________________________________
SV: Do not want some application code to be executed for each
request
Posted by Pankaj Kharwal <Pa...@kf.se>.
Thanks a lot Damitha. I will try this out and post my results soon.
Warm Regards,
Pankaj Kharwal
Stockholm, Sweden
Från: Damitha Kumarage [mailto:damitha@wso2.com]
Skickat: den 2 januari 2012 08:03
Till: c-user@axis.apache.org
Ämne: Re: Do not want some application code to be executed for each request
On 12/30/2011 03:59 PM, Pankaj Kharwal wrote:
Dear all,
I have an application written in C/C++ (runs as a webservice) which was previously running on some other platform. Now, the application has been ported to Linux and now we are using AXIS2C 1.6.0. So far, I have been successful in running the application on AXIS2C with minor glitches.
However, the application has some constructors which query tables (heavy SELECTS) and based on the data read from the tables, the application processes the request. The problem is that when I fire a request, AXIS2C executes these constructors for each request. This is not desirable because I do not want these heavy SELECTs to be executed each time the request comes to AXIS since it takes upto 3 seconds for the constructors to execute the SQL SELECTs.
Is there any way to call these constructors only at the start of AXIS engine and save this as a context to be used by the upcoming requests?
try using AXIS2_SVC_SKELETON_INIT_WITH_CONF.
Use this just like AXIS2_SVC_SKELETON_INIT method except that axis2_conf struct is passed to this method. Store whatever things you need to
keep between requests as parameter in axis2_conf struct.
See a sample service like math to see how init function can be used. init and init_with_conf are called only at service load time.
Damitha
Thanks and Regards,
Pankaj Kharwal
Stockholm, Sweden
______________________________________________________________________
This email has been scanned by the Symantec Email Security.cloud service.
For more information please visit http://www.symanteccloud.com
______________________________________________________________________
--
__________________________________________________________________
Damitha Kumarage
Technical Lead; WSO2 Inc.
email:damitha@wso2.com<ma...@wso2.com>; phone:+94 332262389; cell:+94 719169327
"Oxygenating the Web Service Platform; " http://www.wso2.com/
blog: " http://damithakumarage.wordpress.com/
__________________________________________________________________
______________________________________________________________________
This email has been scanned by the Symantec Email Security.cloud service.
For more information please visit http://www.symanteccloud.com
______________________________________________________________________
______________________________________________________________________
This email has been scanned by the Symantec Email Security.cloud service.
For more information please visit http://www.symanteccloud.com
______________________________________________________________________