ws-sandesha-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From dami...@apache.org
Subject svn commit: r681731 - in /webservices/sandesha/tags/sandesha2/c/worker_thread_removed-23may2008: samples/rm_ping_1_0/ src/msgprocessors/ src/util/
Date Fri, 01 Aug 2008 15:57:23 GMT
Author: damitha
Date: Fri Aug  1 08:57:23 2008
New Revision: 681731

URL: http://svn.apache.org/viewvc?rev=681731&view=rev
Log:
Fixing memory leaks. Now all samples in server and client are having only few memory leaks.
No leaks from envelopes and contexts.

Modified:
    webservices/sandesha/tags/sandesha2/c/worker_thread_removed-23may2008/samples/rm_ping_1_0/rm_ping_1_0.c
    webservices/sandesha/tags/sandesha2/c/worker_thread_removed-23may2008/src/msgprocessors/app_msg_processor.c
    webservices/sandesha/tags/sandesha2/c/worker_thread_removed-23may2008/src/msgprocessors/create_seq_msg_processor.c
    webservices/sandesha/tags/sandesha2/c/worker_thread_removed-23may2008/src/msgprocessors/terminate_seq_msg_processor.c
    webservices/sandesha/tags/sandesha2/c/worker_thread_removed-23may2008/src/util/terminate_mgr.c

Modified: webservices/sandesha/tags/sandesha2/c/worker_thread_removed-23may2008/samples/rm_ping_1_0/rm_ping_1_0.c
URL: http://svn.apache.org/viewvc/webservices/sandesha/tags/sandesha2/c/worker_thread_removed-23may2008/samples/rm_ping_1_0/rm_ping_1_0.c?rev=681731&r1=681730&r2=681731&view=diff
==============================================================================
--- webservices/sandesha/tags/sandesha2/c/worker_thread_removed-23may2008/samples/rm_ping_1_0/rm_ping_1_0.c
(original)
+++ webservices/sandesha/tags/sandesha2/c/worker_thread_removed-23may2008/samples/rm_ping_1_0/rm_ping_1_0.c
Fri Aug  1 08:57:23 2008
@@ -83,7 +83,10 @@
     options = axis2_options_create(env);
     axis2_options_set_xml_parser_reset(options, env, AXIS2_FALSE);
     if(endpoint_ref)
+    {
         axis2_options_set_to(options, env, endpoint_ref);
+    }
+
     /*axis2_options_set_action(options, env, "urn:wsrm:Ping");*/
 
     /* Set up deploy folder. It is from the deploy folder, the configuration is 
@@ -96,15 +99,17 @@
      */
     client_home = AXIS2_GETENV("AXIS2C_HOME");
     if (!client_home)
+    {
         client_home = "../../deploy";
+    }
+
     /* Create service client */
     svc_client = axis2_svc_client_create(env, client_home);
     if (!svc_client)
     {
         printf("Error creating service client\n");
-        AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI, "Stub invoke FAILED: Error code:"
-                  " %d :: %s", env->error->error_number,
-                        AXIS2_ERROR_GET_MESSAGE(env->error));
+        AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI, "Stub invoke FAILED: Error code: %d ::
%s", 
+                env->error->error_number, AXIS2_ERROR_GET_MESSAGE(env->error));
     }
 
     /* Set service client options */
@@ -113,45 +118,47 @@
     /* Engage addressing module */
     axis2_svc_client_engage_module(svc_client, env, AXIS2_MODULE_ADDRESSING);
     
-    /* Build the SOAP request message payload using OM API.*/
     axis2_svc_client_engage_module(svc_client, env, "sandesha2");
+    
     /* RM Version 1.0 */
-    property = axutil_property_create_with_args(env, 0, 0, 0, 
-        SANDESHA2_SPEC_VERSION_1_0);
+    property = axutil_property_create_with_args(env, 0, 0, 0, SANDESHA2_SPEC_VERSION_1_0);
     if(property)
     {
-        axis2_options_set_property(options, env, 
-            SANDESHA2_CLIENT_RM_SPEC_VERSION, property);
+        axis2_options_set_property(options, env, SANDESHA2_CLIENT_RM_SPEC_VERSION, property);
     }
 
     seq_key = axutil_uuid_gen(env);
     property = axutil_property_create_with_args(env, 0, 0, 0, seq_key);
     if(property)
     {
-        axis2_options_set_property(options, env, SANDESHA2_CLIENT_SEQ_KEY,
-            property);
+        axis2_options_set_property(options, env, SANDESHA2_CLIENT_SEQ_KEY, property);
     }
     
     /* Send request */
     payload = build_om_programatically(env, "ping1", seq_key);
     status = axis2_svc_client_send_robust(svc_client, env, payload);
     if(status)
+    {
         printf("\nping client invoke SUCCESSFUL!\n");
+    }
     payload = NULL;
     
     payload = build_om_programatically(env, "ping2", seq_key);
     status = axis2_svc_client_send_robust(svc_client, env, payload);
     if(status)
+    {
         printf("\nping client invoke SUCCESSFUL!\n");
+    }
     payload = NULL;
 
     property = axutil_property_create_with_args(env, 0, 0, 0, AXIS2_VALUE_TRUE);
-    axis2_options_set_property(options, env, "Sandesha2LastMessage", 
-        property);
+    axis2_options_set_property(options, env, "Sandesha2LastMessage", property);
     payload = build_om_programatically(env, "ping3", seq_key);
     status = axis2_svc_client_send_robust(svc_client, env, payload);
     if(status)
+    {
         printf("\nping client invoke SUCCESSFUL!\n");
+    }
     
      /** Wait till callback is complete. Simply keep the parent thread running
        until our on_complete or on_error is invoked */
@@ -160,12 +167,20 @@
      *messages. */
 
     AXIS2_SLEEP(SANDESHA2_SLEEP);
+    AXIS2_FREE(env->allocator, seq_key);
    
     if (svc_client)
     {
         axis2_svc_client_free(svc_client, env);
         svc_client = NULL;
     }
+    
+    if (env)
+    {
+        axutil_env_free((axutil_env_t *) env);
+        env = NULL;
+    }
+
     return 0;
 }
 

Modified: webservices/sandesha/tags/sandesha2/c/worker_thread_removed-23may2008/src/msgprocessors/app_msg_processor.c
URL: http://svn.apache.org/viewvc/webservices/sandesha/tags/sandesha2/c/worker_thread_removed-23may2008/src/msgprocessors/app_msg_processor.c?rev=681731&r1=681730&r2=681731&view=diff
==============================================================================
--- webservices/sandesha/tags/sandesha2/c/worker_thread_removed-23may2008/src/msgprocessors/app_msg_processor.c
(original)
+++ webservices/sandesha/tags/sandesha2/c/worker_thread_removed-23may2008/src/msgprocessors/app_msg_processor.c
Fri Aug  1 08:57:23 2008
@@ -239,7 +239,7 @@
     const axutil_env_t *env,
     sandesha2_msg_ctx_t *rm_msg_ctx)
 {
-    axis2_msg_ctx_t *msg_ctx = NULL;
+    axis2_msg_ctx_t *app_msg_ctx = NULL;
     axis2_char_t *processed = NULL;
     axis2_op_ctx_t *op_ctx = NULL;
     axis2_conf_ctx_t *conf_ctx = NULL;
@@ -274,8 +274,8 @@
     AXIS2_LOG_TRACE(env->log, AXIS2_LOG_SI,  
         "[sandesha2]Entry:sandesha2_app_msg_processor_process_in_msg");
  
-    msg_ctx = sandesha2_msg_ctx_get_msg_ctx(rm_msg_ctx, env);
-    if(!msg_ctx)
+    app_msg_ctx = sandesha2_msg_ctx_get_msg_ctx(rm_msg_ctx, env);
+    if(!app_msg_ctx)
     {
         AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI, 
             "[sandesha2]Message context is not set");
@@ -298,10 +298,10 @@
         return AXIS2_SUCCESS;
     }
     
-    op_ctx = axis2_msg_ctx_get_op_ctx(msg_ctx, env);
+    op_ctx = axis2_msg_ctx_get_op_ctx(app_msg_ctx, env);
     /*axis2_op_ctx_set_in_use(op_ctx, env, AXIS2_TRUE);*/
     axis2_op_ctx_set_response_written(op_ctx, env, AXIS2_TRUE);
-    conf_ctx = axis2_msg_ctx_get_conf_ctx(msg_ctx, env);
+    conf_ctx = axis2_msg_ctx_get_conf_ctx(app_msg_ctx, env);
     dbname = sandesha2_util_get_dbname(env, conf_ctx);
     storage_mgr = sandesha2_utils_get_storage_mgr(env, dbname);
     fault_ctx = sandesha2_fault_mgr_check_for_last_msg_num_exceeded(env, rm_msg_ctx, seq_prop_mgr);
@@ -340,7 +340,7 @@
         {
             axis2_engine_free(engine, env);
         }
-        axis2_msg_ctx_set_paused(msg_ctx, env, AXIS2_TRUE);
+        axis2_msg_ctx_set_paused(app_msg_ctx, env, AXIS2_TRUE);
         if(storage_mgr)
         {
             sandesha2_storage_mgr_free(storage_mgr, env);
@@ -415,7 +415,7 @@
         {
             axis2_engine_free(engine, env);
         }
-        axis2_msg_ctx_set_paused(msg_ctx, env, AXIS2_TRUE);
+        axis2_msg_ctx_set_paused(app_msg_ctx, env, AXIS2_TRUE);
 
         return AXIS2_SUCCESS;
     }
@@ -467,7 +467,7 @@
             axis2_engine_free(engine, env);
         }
 
-        axis2_msg_ctx_set_paused(msg_ctx, env, AXIS2_TRUE);
+        axis2_msg_ctx_set_paused(app_msg_ctx, env, AXIS2_TRUE);
 
         return AXIS2_SUCCESS;
     }
@@ -532,7 +532,7 @@
         axis2_char_t *client_seq_key = NULL;
         
         highest_in_msg_no = msg_no;
-        msg_id = axis2_msg_ctx_get_msg_id(msg_ctx, env);
+        msg_id = axis2_msg_ctx_get_msg_id(app_msg_ctx, env);
         highest_msg_no_bean = sandesha2_seq_property_bean_create_with_data(env, 
             rmd_sequence_id, SANDESHA2_SEQ_PROP_HIGHEST_IN_MSG_NUMBER, 
                 msg_num_str);
@@ -544,11 +544,11 @@
                 (axis2_char_t *)msg_id);
         sandesha2_storage_mgr_remove_msg_ctx(storage_mgr, env, 
             highest_in_msg_key_str, conf_ctx, -1);
-        sandesha2_storage_mgr_store_msg_ctx(storage_mgr, env, highest_in_msg_key_str, msg_ctx,

+        sandesha2_storage_mgr_store_msg_ctx(storage_mgr, env, highest_in_msg_key_str, app_msg_ctx,

                 AXIS2_TRUE);
 
-        /*response_envelope = axis2_msg_ctx_get_soap_envelope(msg_ctx, env);*/
-        property = axis2_msg_ctx_get_property(msg_ctx, env, SANDESHA2_CLIENT_SEQ_KEY);
+        /*response_envelope = axis2_msg_ctx_get_soap_envelope(app_msg_ctx, env);*/
+        property = axis2_msg_ctx_get_property(app_msg_ctx, env, SANDESHA2_CLIENT_SEQ_KEY);
         if(property)
         {
             client_seq_key = axutil_property_get_value(property, env);
@@ -672,10 +672,10 @@
     in_order_invoke = sandesha2_property_bean_is_in_order(sandesha2_utils_get_property_bean(env,

             axis2_conf_ctx_get_conf(conf_ctx, env)), env);
     /* test code */
-    if(axis2_msg_ctx_get_server_side(msg_ctx, env))
+    if(axis2_msg_ctx_get_server_side(app_msg_ctx, env))
     {
         sandesha2_last_msg_t *last_msg = sandesha2_seq_get_last_msg(seq, env);
-        axis2_char_t *msg_id = (axis2_char_t *)axis2_msg_ctx_get_msg_id(msg_ctx, env);
+        axis2_char_t *msg_id = (axis2_char_t *)axis2_msg_ctx_get_msg_id(app_msg_ctx, env);
         if(last_msg)
         {
             sandesha2_seq_property_bean_t *seq_prop_bean = NULL;
@@ -692,9 +692,9 @@
      * the sender wanted to signal the last message, but didn't have an application
      * message to send) then we do not need to send the message on to the application.
      */
-    str_soap_action = axis2_msg_ctx_get_soap_action(msg_ctx, env);
+    str_soap_action = axis2_msg_ctx_get_soap_action(app_msg_ctx, env);
     soap_action = axutil_string_get_buffer(str_soap_action, env);
-    wsa_action = axis2_msg_ctx_get_wsa_action(msg_ctx, env);
+    wsa_action = axis2_msg_ctx_get_wsa_action(app_msg_ctx, env);
     if(!axutil_strcmp(SANDESHA2_SPEC_2005_02_ACTION_LAST_MESSAGE, wsa_action) || 0 == axutil_strcmp(
                 SANDESHA2_SPEC_2005_02_SOAP_ACTION_LAST_MESSAGE, soap_action)) 
     {
@@ -724,7 +724,7 @@
         return AXIS2_SUCCESS;
     }
 
-    if(axis2_msg_ctx_get_server_side(msg_ctx, env) && in_order_invoke)
+    if(axis2_msg_ctx_get_server_side(app_msg_ctx, env) && in_order_invoke)
     {
         sandesha2_seq_property_bean_t *incoming_seq_list_bean = NULL;
         axutil_array_list_t *incoming_seq_list = NULL;
@@ -800,7 +800,7 @@
         }
         /* save the message */
         str_key = axutil_uuid_gen(env);
-        sandesha2_storage_mgr_store_msg_ctx(storage_mgr, env, str_key, msg_ctx, AXIS2_TRUE);
+        sandesha2_storage_mgr_store_msg_ctx(storage_mgr, env, str_key, app_msg_ctx, AXIS2_TRUE);
         invoker_bean = sandesha2_invoker_bean_create_with_data(env, str_key,
             msg_no, rmd_sequence_id, AXIS2_FALSE);
         if(str_key)
@@ -1586,7 +1586,11 @@
     if(!axis2_msg_ctx_get_soap_action(msg_ctx, env))
     {
         axutil_string_t *soap_action = axutil_string_create(env, to_addr);
-        axis2_msg_ctx_set_soap_action(msg_ctx, env, soap_action);
+        if(soap_action)
+        {
+            axis2_msg_ctx_set_soap_action(msg_ctx, env, soap_action);
+            axutil_string_free(soap_action, env);
+        }
     }
     
     if(!dummy_msg)
@@ -3017,6 +3021,8 @@
     axis2_engine_t *engine = NULL;
     axis2_status_t status = AXIS2_FAILURE;
     axutil_property_t *property = NULL;
+    axis2_op_ctx_t *op_ctx = NULL;
+    const axis2_char_t *mep = NULL;
  
     AXIS2_LOG_TRACE(env->log, AXIS2_LOG_SI,
         "[sandesha2] Entry:sandesha2_app_msg_processor_process_app_msg_response");
@@ -3086,13 +3092,27 @@
         axis2_engine_free(engine, env);
     }
 
-    /* Note that as explained above this message context is not added to the operation context,

-     * therefore will not be freed when operation context's msg_ctx_map is freed. So we need
to 
-     * free the response message here. Note that we copied this response soap envelope from
the
-     * outgoing message context from application client. This response envelope will be freed
-     * at operation client. So to avoid double freeing we increment its ref.
-     */
-    axiom_soap_envelope_increment_ref(response_envelope, env);
+    op_ctx = axis2_msg_ctx_get_op_ctx(msg_ctx, env);
+    if(op_ctx)
+    {
+        axis2_op_t *op = NULL;
+
+        op = axis2_op_ctx_get_op(op_ctx, env);
+        mep = axis2_op_get_msg_exchange_pattern(op, env);
+    }
+    
+    if(!axutil_strcmp(mep, AXIS2_MEP_URI_OUT_IN))
+    {
+        /* Note that as explained above this message context is not added to the operation
context, 
+         * therefore will not be freed when operation context's msg_ctx_map is freed. So
we need to 
+         * free the response message here. Note that we copied this response soap envelope
from the
+         * outgoing message context from application client. This response envelope will
be freed
+         * at operation client. So to avoid double freeing we increment its ref.
+         */
+        AXIS2_LOG_DEBUG(env->log, AXIS2_LOG_SI, "[sandesha2] Increment the soap envelope
ref counter");
+        axiom_soap_envelope_increment_ref(response_envelope, env);
+    }
+    
     axis2_msg_ctx_free(response_msg_ctx, env);
 
     AXIS2_LOG_TRACE(env->log, AXIS2_LOG_SI,

Modified: webservices/sandesha/tags/sandesha2/c/worker_thread_removed-23may2008/src/msgprocessors/create_seq_msg_processor.c
URL: http://svn.apache.org/viewvc/webservices/sandesha/tags/sandesha2/c/worker_thread_removed-23may2008/src/msgprocessors/create_seq_msg_processor.c?rev=681731&r1=681730&r2=681731&view=diff
==============================================================================
--- webservices/sandesha/tags/sandesha2/c/worker_thread_removed-23may2008/src/msgprocessors/create_seq_msg_processor.c
(original)
+++ webservices/sandesha/tags/sandesha2/c/worker_thread_removed-23may2008/src/msgprocessors/create_seq_msg_processor.c
Fri Aug  1 08:57:23 2008
@@ -154,7 +154,7 @@
     const axutil_env_t *env,
     sandesha2_msg_ctx_t *rm_msg_ctx)
 {
-    axis2_msg_ctx_t *msg_ctx = NULL;
+    axis2_msg_ctx_t *create_seq_msg_ctx = NULL;
     sandesha2_create_seq_t *create_seq_part = NULL;
     axis2_conf_ctx_t *conf_ctx = NULL;
     sandesha2_msg_ctx_t *fault_rm_msg_ctx = NULL;
@@ -176,13 +176,19 @@
     axis2_op_ctx_t *op_ctx = NULL;
     axis2_char_t *dbname = NULL;
     sandesha2_create_seq_mgr_t *create_seq_mgr = NULL;
+    axis2_msg_ctx_t **msg_ctx_map = NULL;
      
     AXIS2_LOG_TRACE(env->log, AXIS2_LOG_SI,  
         "[sandesha2] Start:sandesha2_create_seq_msg_processor_process_in_msg");
     
     AXIS2_PARAM_CHECK(env->error, rm_msg_ctx, AXIS2_FAILURE);
     
-    msg_ctx = sandesha2_msg_ctx_get_msg_ctx(rm_msg_ctx, env);
+    create_seq_msg_ctx = sandesha2_msg_ctx_get_msg_ctx(rm_msg_ctx, env);
+    
+    op_ctx = axis2_msg_ctx_get_op_ctx(create_seq_msg_ctx, env);
+    msg_ctx_map = axis2_op_ctx_get_msg_ctx_map(op_ctx, env);
+    msg_ctx_map[AXIS2_WSDL_MESSAGE_LABEL_IN] = create_seq_msg_ctx;
+
     create_seq_part = sandesha2_msg_ctx_get_create_seq(rm_msg_ctx, env);
     if(!create_seq_part)
     {
@@ -191,13 +197,13 @@
         return AXIS2_FAILURE;
     }
 
-    conf_ctx = axis2_msg_ctx_get_conf_ctx(msg_ctx, env);
+    conf_ctx = axis2_msg_ctx_get_conf_ctx(create_seq_msg_ctx, env);
     dbname = sandesha2_util_get_dbname(env, conf_ctx);
     seq_prop_mgr = sandesha2_permanent_seq_property_mgr_create(env, dbname);
     create_seq_mgr = sandesha2_permanent_create_seq_mgr_create(env, dbname);
     next_msg_mgr = sandesha2_permanent_next_msg_mgr_create(env, dbname);
     
-    fault_rm_msg_ctx = sandesha2_fault_mgr_check_for_create_seq_refused(env, msg_ctx, seq_prop_mgr);
+    fault_rm_msg_ctx = sandesha2_fault_mgr_check_for_create_seq_refused(env, create_seq_msg_ctx,
seq_prop_mgr);
     if(fault_rm_msg_ctx)
     {
         axis2_engine_t *engine = NULL;
@@ -217,7 +223,7 @@
             engine = NULL;
         }
 
-        axis2_msg_ctx_set_paused(msg_ctx, env, AXIS2_TRUE);
+        axis2_msg_ctx_set_paused(create_seq_msg_ctx, env, AXIS2_TRUE);
 
         if(seq_prop_mgr)
         {
@@ -235,7 +241,7 @@
         return AXIS2_SUCCESS;
     }
 
-    out_msg_ctx = sandesha2_utils_create_out_msg_ctx(env, msg_ctx);
+    out_msg_ctx = sandesha2_utils_create_out_msg_ctx(env, create_seq_msg_ctx);
 
     rmd_sequence_id = sandesha2_seq_mgr_setup_new_rmd_sequence(env, rm_msg_ctx, 
             seq_prop_mgr, next_msg_mgr);
@@ -393,7 +399,6 @@
 
     sandesha2_seq_property_mgr_insert(seq_prop_mgr, env, acks_to_bean);
 
-    op_ctx = axis2_msg_ctx_get_op_ctx(msg_ctx, env);
     axis2_op_ctx_set_response_written(op_ctx, env, AXIS2_TRUE);
     sandesha2_seq_mgr_update_last_activated_time(env, rmd_sequence_id, seq_prop_mgr);
 
@@ -407,6 +412,12 @@
         axis2_engine_free(engine, env);
     }
 
+    if(out_msg_ctx)
+    {
+        axis2_core_utils_reset_out_msg_ctx(env, out_msg_ctx);
+        axis2_msg_ctx_free(out_msg_ctx, env);
+    }
+
     to_bean = sandesha2_seq_property_mgr_retrieve(seq_prop_mgr, env, rmd_sequence_id, 
             SANDESHA2_SEQ_PROP_TO_EPR);
     if(!to_bean)
@@ -438,7 +449,6 @@
         AXIS2_FREE(env->allocator, addr_ns_uri);
     }
     
-    op_ctx = axis2_msg_ctx_get_op_ctx(msg_ctx, env);
     if(sandesha2_utils_is_anon_uri(env, to_addr))
     {
         axis2_op_ctx_set_response_written(op_ctx, env, AXIS2_TRUE);

Modified: webservices/sandesha/tags/sandesha2/c/worker_thread_removed-23may2008/src/msgprocessors/terminate_seq_msg_processor.c
URL: http://svn.apache.org/viewvc/webservices/sandesha/tags/sandesha2/c/worker_thread_removed-23may2008/src/msgprocessors/terminate_seq_msg_processor.c?rev=681731&r1=681730&r2=681731&view=diff
==============================================================================
--- webservices/sandesha/tags/sandesha2/c/worker_thread_removed-23may2008/src/msgprocessors/terminate_seq_msg_processor.c
(original)
+++ webservices/sandesha/tags/sandesha2/c/worker_thread_removed-23may2008/src/msgprocessors/terminate_seq_msg_processor.c
Fri Aug  1 08:57:23 2008
@@ -166,7 +166,7 @@
     const axutil_env_t *env,
     sandesha2_msg_ctx_t *rm_msg_ctx)
 {
-    axis2_msg_ctx_t *msg_ctx = NULL;
+    axis2_msg_ctx_t *terminate_msg_ctx = NULL;
     sandesha2_terminate_seq_t *term_seq = NULL;
     axis2_char_t *rmd_sequence_id = NULL;
     axis2_conf_ctx_t *conf_ctx = NULL;
@@ -179,6 +179,7 @@
     axis2_char_t *spec_version = NULL;
     axis2_char_t *dbname = NULL;
     sandesha2_seq_ack_t *seq_ack = NULL;
+    axis2_op_ctx_t *op_ctx = NULL;
     /*sandesha2_seq_property_bean_t *term_rcvd_bean = NULL;*/
   
     AXIS2_LOG_TRACE(env->log, AXIS2_LOG_SI,  
@@ -186,7 +187,16 @@
 
     AXIS2_PARAM_CHECK(env->error, rm_msg_ctx, AXIS2_FAILURE);
 
-    msg_ctx = sandesha2_msg_ctx_get_msg_ctx(rm_msg_ctx, env);
+    terminate_msg_ctx = sandesha2_msg_ctx_get_msg_ctx(rm_msg_ctx, env);
+
+    if(axis2_msg_ctx_get_server_side(terminate_msg_ctx, env))
+    {
+        axis2_msg_ctx_t **msg_ctx_map = NULL;
+
+        op_ctx = axis2_msg_ctx_get_op_ctx(terminate_msg_ctx, env);
+        msg_ctx_map = axis2_op_ctx_get_msg_ctx_map(op_ctx, env);
+        msg_ctx_map[AXIS2_WSDL_MESSAGE_LABEL_IN] = terminate_msg_ctx;
+    }
     
     term_seq = sandesha2_msg_ctx_get_terminate_seq(rm_msg_ctx, env);
     if(!term_seq)
@@ -196,6 +206,7 @@
         AXIS2_ERROR_SET(env->error, SANDESHA2_ERROR_REQD_MSG_PART_MISSING, AXIS2_FAILURE);
         return AXIS2_FAILURE;
     }
+
     rmd_sequence_id = sandesha2_identifier_get_identifier(sandesha2_terminate_seq_get_identifier(
                 term_seq, env), env);
     if(!rmd_sequence_id || 0 == axutil_strlen(rmd_sequence_id))
@@ -204,7 +215,7 @@
         return AXIS2_FAILURE;
     }
 
-    conf_ctx = axis2_msg_ctx_get_conf_ctx(msg_ctx, env);
+    conf_ctx = axis2_msg_ctx_get_conf_ctx(terminate_msg_ctx, env);
     dbname = sandesha2_util_get_dbname(env, conf_ctx);
     storage_mgr = sandesha2_utils_get_storage_mgr(env, dbname);
     seq_prop_mgr = sandesha2_permanent_seq_property_mgr_create(env, dbname);
@@ -219,7 +230,9 @@
         axis2_engine_t *engine = NULL;
 
         engine = axis2_engine_create(env, conf_ctx);
+
         AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI, "[sandesha2] Send fault occurred");
+
         axis2_engine_send_fault(engine, env, sandesha2_msg_ctx_get_msg_ctx(fault_ctx, env));
         sandesha2_msg_ctx_free(fault_ctx, env);
         if(engine)
@@ -227,7 +240,7 @@
             axis2_engine_free(engine, env);
         }
 
-        axis2_msg_ctx_set_paused(msg_ctx, env, AXIS2_TRUE);
+        axis2_msg_ctx_set_paused(terminate_msg_ctx, env, AXIS2_TRUE);
 
         if(seq_prop_mgr)
         {
@@ -314,7 +327,9 @@
             if(completed)
             {
                 AXIS2_LOG_DEBUG(env->log, AXIS2_LOG_SI, 
-                        "[sandesha2]Sequence %s is completed. So adding terminate msg", rms_sequence_id);

+                        "[sandesha2]Sequence %s is completed. So adding terminate msg", 
+                        rms_sequence_id); 
+
                 sandesha2_terminate_mgr_send_terminate_seq_msg(env, rm_msg_ctx, rms_sequence_id,

                         internal_sequence_id, storage_mgr, seq_prop_mgr, create_seq_mgr,
sender_mgr);
             }
@@ -338,17 +353,33 @@
     sandesha2_msg_ctx_set_paused(rm_msg_ctx, env, AXIS2_TRUE);
 
     if(seq_prop_mgr)
+    {
         sandesha2_seq_property_mgr_free(seq_prop_mgr, env);
+    }
+
     if(create_seq_mgr)
+    {
         sandesha2_create_seq_mgr_free(create_seq_mgr, env);
+    }
+
     if(sender_mgr)
+    {
         sandesha2_sender_mgr_free(sender_mgr, env);
+    }
+
     if(next_msg_mgr)
+    {
         sandesha2_next_msg_mgr_free(next_msg_mgr, env);
+    }
+
     if(storage_mgr)
+    {
         sandesha2_storage_mgr_free(storage_mgr, env);
+    }
+
     AXIS2_LOG_TRACE(env->log, AXIS2_LOG_SI,  
         "[sandesha2]Exit:sandesha2_terminate_seq_msg_processor_process_in_msg");
+
     return AXIS2_SUCCESS;
 }
 
@@ -529,36 +560,36 @@
     
     msg_ctx = sandesha2_msg_ctx_get_msg_ctx(rm_msg_ctx, env);
     out_msg_ctx = sandesha2_utils_create_out_msg_ctx(env, msg_ctx);
-    out_rm_msg = sandesha2_msg_creator_create_terminate_seq_res_msg(env, 
-        rm_msg_ctx, out_msg_ctx, seq_prop_mgr);
+    out_rm_msg = sandesha2_msg_creator_create_terminate_seq_res_msg(env, rm_msg_ctx, out_msg_ctx,

+            seq_prop_mgr);
     if(!out_rm_msg)
+    {
         return AXIS2_FAILURE;
-    ack_rm_msg = sandesha2_ack_mgr_generate_ack_msg(env, rm_msg_ctx, seq_id,
-        seq_prop_mgr);
+    }
+
+    ack_rm_msg = sandesha2_ack_mgr_generate_ack_msg(env, rm_msg_ctx, seq_id, seq_prop_mgr);
     if(ack_rm_msg)
     {
         seq_ack = sandesha2_msg_ctx_get_seq_ack(ack_rm_msg, env);
         sandesha2_msg_ctx_set_seq_ack(out_rm_msg, env, seq_ack);
     }
+
     sandesha2_msg_ctx_add_soap_envelope(out_rm_msg, env);
     sandesha2_msg_ctx_set_flow(out_rm_msg, env, AXIS2_OUT_FLOW);
     
-    property = axutil_property_create_with_args(env, 0, 0, 0, 
-        AXIS2_VALUE_TRUE);
-    axis2_msg_ctx_set_property(out_msg_ctx, env, 
-        SANDESHA2_APPLICATION_PROCESSING_DONE, property);
+    property = axutil_property_create_with_args(env, 0, 0, 0, AXIS2_VALUE_TRUE);
+    axis2_msg_ctx_set_property(out_msg_ctx, env, SANDESHA2_APPLICATION_PROCESSING_DONE, property);
+
     /* test code */
     /*
     to_epr = axis2_msg_ctx_get_to(out_msg_ctx, env);
     if(to_epr && !sandesha2_utils_is_anon_uri(env, 
         axis2_endpoint_ref_get_address(to_epr, env)))
     {   
-        axis2_msg_ctx_t *tsr_msg_ctx = axis2_core_utils_create_out_msg_ctx(
-                env, msg_ctx);
+        axis2_msg_ctx_t *tsr_msg_ctx = axis2_core_utils_create_out_msg_ctx(env, msg_ctx);
         orig_trans_out = axis2_msg_ctx_get_transport_out_desc(tsr_msg_ctx, env);
         property = axutil_property_create_with_args(env, 0, 0, 0, orig_trans_out);
-        axis2_msg_ctx_set_property(tsr_msg_ctx, env,
-            SANDESHA2_ORIGINAL_TRANSPORT_OUT_DESC, property);
+        axis2_msg_ctx_set_property(tsr_msg_ctx, env, SANDESHA2_ORIGINAL_TRANSPORT_OUT_DESC,
property);
         trans_out = sandesha2_utils_get_transport_out(env);
         axis2_msg_ctx_set_transport_out_desc(tsr_msg_ctx, env, trans_out);
 
@@ -566,23 +597,19 @@
         term_res_bean = sandesha2_sender_bean_create(env);
         sandesha2_sender_bean_set_msg_ctx_ref_key(term_res_bean, env, key);
         property = axutil_property_create_with_args(env, 0, 0, 0, key);
-        axis2_msg_ctx_set_property(tsr_msg_ctx, env, SANDESHA2_MESSAGE_STORE_KEY, 
-            property);
+        axis2_msg_ctx_set_property(tsr_msg_ctx, env, SANDESHA2_MESSAGE_STORE_KEY, property);
         sandesha2_storage_mgr_store_msg_ctx(storage_mgr, env, key, tsr_msg_ctx);
         */  
         /* TODO: refine the terminate delay */
         /*
-        sandesha2_sender_bean_set_time_to_send(term_res_bean, env,
-            sandesha2_utils_get_current_time_in_millis(env) +
-            SANDESHA2_TERMINATE_DELAY);
+        sandesha2_sender_bean_set_time_to_send(term_res_bean, env, 
+            sandesha2_utils_get_current_time_in_millis(env) + SANDESHA2_TERMINATE_DELAY);
         sandesha2_sender_bean_set_msg_id(term_res_bean, env,
             (axis2_char_t *) axis2_msg_ctx_get_msg_id(tsr_msg_ctx, env));
         sandesha2_sender_bean_set_send(term_res_bean, env, AXIS2_TRUE);
 
-        property = axutil_property_create_with_args(env, 0, 0, 0, 
-            AXIS2_VALUE_TRUE);
-        axis2_msg_ctx_set_property(msg_ctx, env, SANDESHA2_QUALIFIED_FOR_SENDING,
-            property);
+        property = axutil_property_create_with_args(env, 0, 0, 0, AXIS2_VALUE_TRUE);
+        axis2_msg_ctx_set_property(msg_ctx, env, SANDESHA2_QUALIFIED_FOR_SENDING, property);
         sandesha2_sender_bean_set_resend(term_res_bean, env, AXIS2_FALSE);
         retrans_mgr = sandesha2_storage_mgr_get_retrans_mgr(storage_mgr, env);
         sandesha2_sender_mgr_insert(retrans_mgr, env, term_res_bean);
@@ -609,12 +636,20 @@
     {
         axis2_op_ctx_set_response_written(op_ctx, env, AXIS2_TRUE);
     }
+
     if(engine)
+    {
         axis2_engine_free(engine, env);
+    }
+
     if(out_rm_msg)
+    {
         sandesha2_msg_ctx_free(out_rm_msg, env);
-    AXIS2_LOG_TRACE(env->log, AXIS2_LOG_SI, "[sandesha2]Exit:sandesha2_"\
-        "terminate_seq_msg_processor_add_terminate_seq_res");
+    }
+
+    AXIS2_LOG_TRACE(env->log, AXIS2_LOG_SI, 
+            "[sandesha2] Exit:sandesha2_terminate_seq_msg_processor_add_terminate_seq_res");
+
     return AXIS2_SUCCESS;
 }
 
@@ -668,37 +703,51 @@
         axis2_msg_ctx_get_to(msg_ctx, env), env);
     property = axis2_msg_ctx_get_property(msg_ctx, env, SANDESHA2_CLIENT_SEQ_KEY);
     if(property)
+    {
         seq_key = axutil_property_get_value(property, env);
+    }
+
     int_seq_id = sandesha2_utils_get_client_internal_sequence_id(env, to_address, seq_key);
     out_seq_id = sandesha2_utils_get_seq_property(env, int_seq_id, 
         SANDESHA2_SEQUENCE_PROPERTY_RMS_SEQ_ID, seq_prop_mgr);
     if(!out_seq_id)
     {
-        AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI, "[sandesha2]seq_id was not"
-            " found. Cannot send the terminate message");
-        AXIS2_ERROR_SET(env->error, SANDESHA2_ERROR_CANNOT_FIND_SEQ_ID,
-            AXIS2_FAILURE);
+        AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI, 
+                "[sandesha2]seq_id was not found. Cannot send the terminate message");
+        AXIS2_ERROR_SET(env->error, SANDESHA2_ERROR_CANNOT_FIND_SEQ_ID, AXIS2_FAILURE);
         if(seq_prop_mgr)
+        {
             sandesha2_seq_property_mgr_free(seq_prop_mgr, env);
+        }
         if(create_seq_mgr)
+        {
             sandesha2_create_seq_mgr_free(create_seq_mgr, env);
+        }
         if(sender_mgr)
+        {
             sandesha2_sender_mgr_free(sender_mgr, env);
+        }
         if(storage_mgr)
+        {
             sandesha2_storage_mgr_free(storage_mgr, env);
+        }
+
         return AXIS2_FAILURE;
     }
-    terminated = sandesha2_utils_get_seq_property(env, int_seq_id,
-        SANDESHA2_SEQ_PROP_TERMINATE_ADDED, seq_prop_mgr);
+
+    terminated = sandesha2_utils_get_seq_property(env, int_seq_id, 
+            SANDESHA2_SEQ_PROP_TERMINATE_ADDED, seq_prop_mgr);
     old_op = axis2_msg_ctx_get_op(msg_ctx, env);
     
     qname = axutil_qname_create(env, "temp", NULL, NULL); 
     out_in_op = axis2_op_create_with_qname(env, qname);
     if(qname)
+    {
         axutil_qname_free(qname, env);
+    }
+
     axis2_op_set_msg_exchange_pattern(out_in_op, env, AXIS2_MEP_URI_OUT_IN);
-    axis2_op_set_in_flow(out_in_op, env, 
-         axis2_op_get_in_flow(old_op, env));
+    axis2_op_set_in_flow(out_in_op, env, axis2_op_get_in_flow(old_op, env));
 
     /*axutil_allocator_switch_to_global_pool(env->allocator);
     op_ctx = axis2_op_ctx_create(env, out_in_op, NULL);
@@ -709,56 +758,93 @@
     
     if(terminated && 0 == axutil_strcmp(terminated, AXIS2_VALUE_TRUE))
     {
-        AXIS2_LOG_DEBUG(env->log, AXIS2_LOG_SI, 
-            "[sandesha2]Terminate was added previously");
+        AXIS2_LOG_DEBUG(env->log, AXIS2_LOG_SI, "[sandesha2] Terminate was added previously");
         if(terminated)
+        {
             AXIS2_FREE(env->allocator, terminated);
+        }
+
         if(out_seq_id)
+        {
             AXIS2_FREE(env->allocator, out_seq_id);
+        }
+
         if(seq_prop_mgr)
+        {
             sandesha2_seq_property_mgr_free(seq_prop_mgr, env);
+        }
+
         if(create_seq_mgr)
+        {
             sandesha2_create_seq_mgr_free(create_seq_mgr, env);
+        }
+
         if(sender_mgr)
+        {
             sandesha2_sender_mgr_free(sender_mgr, env);
+        }
+
         if(storage_mgr)
+        {
             sandesha2_storage_mgr_free(storage_mgr, env);
+        }
+
         return AXIS2_SUCCESS;
     }
+
     if(terminated)
+    {
         AXIS2_FREE(env->allocator, terminated);
+    }
+
     term_seq_part = sandesha2_msg_ctx_get_terminate_seq(rm_msg_ctx, env);
     sandesha2_identifier_set_identifier(sandesha2_terminate_seq_get_identifier(
          term_seq_part, env), env, out_seq_id);
     sandesha2_msg_ctx_set_flow(rm_msg_ctx, env, AXIS2_OUT_FLOW);
     property = axutil_property_create_with_args(env, 0, 0, 0, AXIS2_VALUE_TRUE);
-    axis2_msg_ctx_set_property(msg_ctx, env, SANDESHA2_APPLICATION_PROCESSING_DONE, 
-        property);
+    axis2_msg_ctx_set_property(msg_ctx, env, SANDESHA2_APPLICATION_PROCESSING_DONE, property);
     axis2_msg_ctx_set_to(msg_ctx, env, axis2_endpoint_ref_create(env, to_address));
     rm_version = sandesha2_utils_get_rm_version(env, int_seq_id, seq_prop_mgr);
     if(!rm_version)
     {
         AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI, 
-            "[sandesha2]Cant find the rm_version of the given message");
+                "[sandesha2] Cant find the rm_version of the given message");
+
         if(out_seq_id)
+        {
             AXIS2_FREE(env->allocator, out_seq_id);
+        }
+
         if(seq_prop_mgr)
+        {
             sandesha2_seq_property_mgr_free(seq_prop_mgr, env);
+        }
+
         if(create_seq_mgr)
+        {
             sandesha2_create_seq_mgr_free(create_seq_mgr, env);
+        }
+
         if(sender_mgr)
+        {
             sandesha2_sender_mgr_free(sender_mgr, env);
+        }
+
         if(storage_mgr)
+        {
             sandesha2_storage_mgr_free(storage_mgr, env);
+        }
+
         return AXIS2_FAILURE;
     }
     axis2_msg_ctx_set_wsa_action(msg_ctx, env, 
-        sandesha2_spec_specific_consts_get_terminate_seq_action(
-        env, rm_version));
-    temp_action = sandesha2_spec_specific_consts_get_terminate_seq_soap_action
-        (env, rm_version);
+            sandesha2_spec_specific_consts_get_terminate_seq_action(env, rm_version));
+    temp_action = sandesha2_spec_specific_consts_get_terminate_seq_soap_action(env, rm_version);
     if(rm_version)
+    {
         AXIS2_FREE(env->allocator, rm_version);
+    }
+
     soap_action = axutil_string_create(env, temp_action);
     axis2_msg_ctx_set_soap_action(msg_ctx, env, soap_action);
     transport_to = sandesha2_utils_get_seq_property(env, int_seq_id, 
@@ -794,26 +880,41 @@
     sandesha2_sender_mgr_insert(retrans_mgr, env, term_bean);*/
     
     term_added = sandesha2_seq_property_bean_create(env);
-    sandesha2_seq_property_bean_set_name(term_added, env, 
-        SANDESHA2_SEQ_PROP_TERMINATE_ADDED);
+    sandesha2_seq_property_bean_set_name(term_added, env, SANDESHA2_SEQ_PROP_TERMINATE_ADDED);
     sandesha2_seq_property_bean_set_seq_id(term_added, env, out_seq_id);
     if(out_seq_id)
+    {
         AXIS2_FREE(env->allocator, out_seq_id);
+    }
+
     sandesha2_seq_property_bean_set_value(term_added, env, AXIS2_VALUE_TRUE); 
     sandesha2_seq_property_mgr_insert(seq_prop_mgr, env, term_added);
     sandesha2_terminate_mgr_terminate_sending_side(env, conf_ctx, int_seq_id, 
         axis2_msg_ctx_get_server_side(msg_ctx, env), storage_mgr, seq_prop_mgr,
         create_seq_mgr, sender_mgr);
     if(seq_prop_mgr)
+    {
         sandesha2_seq_property_mgr_free(seq_prop_mgr, env);
+    }
+
     if(create_seq_mgr)
+    {
         sandesha2_create_seq_mgr_free(create_seq_mgr, env);
+    }
+
     if(sender_mgr)
+    {
         sandesha2_sender_mgr_free(sender_mgr, env);
+    }
+
     if(storage_mgr)
+    {
         sandesha2_storage_mgr_free(storage_mgr, env);
+    }
+
     AXIS2_LOG_TRACE(env->log, AXIS2_LOG_SI,  
-        "[sandesha2]Exit:sandesha2_terminate_msg_processor_process_out_msg");
+        "[sandesha2] Exit:sandesha2_terminate_msg_processor_process_out_msg");
+
     return AXIS2_SUCCESS;
 }
 

Modified: webservices/sandesha/tags/sandesha2/c/worker_thread_removed-23may2008/src/util/terminate_mgr.c
URL: http://svn.apache.org/viewvc/webservices/sandesha/tags/sandesha2/c/worker_thread_removed-23may2008/src/util/terminate_mgr.c?rev=681731&r1=681730&r2=681731&view=diff
==============================================================================
--- webservices/sandesha/tags/sandesha2/c/worker_thread_removed-23may2008/src/util/terminate_mgr.c
(original)
+++ webservices/sandesha/tags/sandesha2/c/worker_thread_removed-23may2008/src/util/terminate_mgr.c
Fri Aug  1 08:57:23 2008
@@ -1213,7 +1213,7 @@
     
     axis2_msg_ctx_set_soap_envelope(response_msg_ctx, env, response_envelope);
 
-    axis2_msg_ctx_set_server_side(response_msg_ctx, env, AXIS2_TRUE);
+    /*axis2_msg_ctx_set_server_side(response_msg_ctx, env, AXIS2_TRUE);*/
 
     axis2_msg_ctx_set_op_ctx(response_msg_ctx, env, axis2_msg_ctx_get_op_ctx(msg_ctx, env));
     axis2_msg_ctx_set_svc_ctx(response_msg_ctx, env, axis2_msg_ctx_get_svc_ctx(msg_ctx, env));



---------------------------------------------------------------------
To unsubscribe, e-mail: sandesha-dev-unsubscribe@ws.apache.org
For additional commands, e-mail: sandesha-dev-help@ws.apache.org


Mime
View raw message