You are viewing a plain text version of this content. The canonical link for it is here.
Posted to fx-dev@ws.apache.org by da...@apache.org on 2007/03/05 07:06:57 UTC

svn commit: r514561 - in /webservices/sandesha/trunk/c: config/ include/ samples/rm_echo_single_1_0/ samples/rm_mtom_1_0/ samples/rm_ping_1_0/ samples/rm_report/ src/client/ src/handlers/ src/msgprocessors/ src/storage/ src/storage/inmemory/ src/storag...

Author: damitha
Date: Sun Mar  4 22:06:56 2007
New Revision: 514561

URL: http://svn.apache.org/viewvc?view=rev&rev=514561
Log:
Please refer SANDESHA2C-25 and SANDESHA2C-26

Modified:
    webservices/sandesha/trunk/c/config/module.xml
    webservices/sandesha/trunk/c/include/sandesha2_report.h
    webservices/sandesha/trunk/c/include/sandesha2_sender_mgr.h
    webservices/sandesha/trunk/c/include/sandesha2_sender_worker.h
    webservices/sandesha/trunk/c/samples/rm_echo_single_1_0/rm_echo_single.c
    webservices/sandesha/trunk/c/samples/rm_mtom_1_0/rm_mtom_1_0.c
    webservices/sandesha/trunk/c/samples/rm_ping_1_0/rm_ping_1_0.c
    webservices/sandesha/trunk/c/samples/rm_report/report.c
    webservices/sandesha/trunk/c/src/client/client.c
    webservices/sandesha/trunk/c/src/client/report.c
    webservices/sandesha/trunk/c/src/client/sequence_report.c
    webservices/sandesha/trunk/c/src/handlers/sandesha2_out_handler.c
    webservices/sandesha/trunk/c/src/msgprocessors/ack_req_msg_processor.c
    webservices/sandesha/trunk/c/src/msgprocessors/app_msg_processor.c
    webservices/sandesha/trunk/c/src/storage/inmemory/inmemory_sender_mgr.c
    webservices/sandesha/trunk/c/src/storage/permanent/permanent_sender_mgr.c
    webservices/sandesha/trunk/c/src/storage/permanent/permanent_transaction.c
    webservices/sandesha/trunk/c/src/storage/sender_mgr.c
    webservices/sandesha/trunk/c/src/util/ack_mgr.c
    webservices/sandesha/trunk/c/src/util/msg_retrans_adjuster.c
    webservices/sandesha/trunk/c/src/util/sandesha2_utils.c
    webservices/sandesha/trunk/c/src/util/terminate_mgr.c
    webservices/sandesha/trunk/c/src/workers/sender.c
    webservices/sandesha/trunk/c/src/workers/sender_worker.c

Modified: webservices/sandesha/trunk/c/config/module.xml
URL: http://svn.apache.org/viewvc/webservices/sandesha/trunk/c/config/module.xml?view=diff&rev=514561&r1=514560&r2=514561
==============================================================================
--- webservices/sandesha/trunk/c/config/module.xml (original)
+++ webservices/sandesha/trunk/c/config/module.xml Sun Mar  4 22:06:56 2007
@@ -68,15 +68,16 @@
     </operation>
 
    <!-- Database connection parameters -->
-   <parameter name="sandesha2_db" locked="false">/tmp</parameter>
+   <parameter name="sandesha2_db" locked="false">/axis2c/deploy</parameter>
    <!-- General parameters -->
     <parameter name="ExponentialBackoff" locked="false">AXIS2_TRUE</parameter>
-    <parameter name="RetransmissionInterval" locked="false">20000</parameter>
+    <parameter name="RetransmissionInterval" locked="false">4000</parameter>
     <parameter name="AcknowledgementInterval" locked="false">4000</parameter>
-    <parameter name="InactivityTimeout" locked="false">60000</parameter>
+    <!--parameter name="InactivityTimeout" locked="false">60000</parameter-->
+    <parameter name="InactivityTimeout" locked="false">100</parameter>
     <parameter name="StorageManager" locked="false">persistent</parameter>
     <parameter name="InvokeInOrder" locked="false">AXIS2_FALSE</parameter>
     <parameter name="MessageTypesToDrop" locked="false">none</parameter>
-    <parameter name="MaxRetransCount" locked="false">10</parameter>
+    <parameter name="MaxRetransCount" locked="false">2</parameter>
 
 </module>

Modified: webservices/sandesha/trunk/c/include/sandesha2_report.h
URL: http://svn.apache.org/viewvc/webservices/sandesha/trunk/c/include/sandesha2_report.h?view=diff&rev=514561&r1=514560&r2=514561
==============================================================================
--- webservices/sandesha/trunk/c/include/sandesha2_report.h (original)
+++ webservices/sandesha/trunk/c/include/sandesha2_report.h Sun Mar  4 22:06:56 2007
@@ -51,69 +51,69 @@
      */
     axis2_status_t (AXIS2_CALL *
     free) (
-            void *report,
-            const axis2_env_t *env);
+        void *report,
+        const axis2_env_t *env);
        
     long (AXIS2_CALL *
     get_completed_msgs_count) (
-            sandesha2_report_t *report,
-            const axis2_env_t *env,
-            axis2_char_t *seq_id);
+        sandesha2_report_t *report,
+        const axis2_env_t *env,
+        axis2_char_t *seq_id);
 
     axis2_array_list_t *(AXIS2_CALL *
     get_incoming_seq_list) (
-            sandesha2_report_t *report,
-            const axis2_env_t *env);
+        sandesha2_report_t *report,
+        const axis2_env_t *env);
 
     axis2_array_list_t *(AXIS2_CALL *
     get_outgoing_seq_list) (
-            sandesha2_report_t *report,
-            const axis2_env_t *env);
+        sandesha2_report_t *report,
+        const axis2_env_t *env);
 
     axis2_char_t (AXIS2_CALL *
     get_seq_status_map) (
-            sandesha2_report_t *report,
-            const axis2_env_t *env,
-            axis2_char_t *seq_id);
+        sandesha2_report_t *report,
+        const axis2_env_t *env,
+        axis2_char_t *seq_id);
 
     axis2_status_t (AXIS2_CALL *
     add_to_incoming_seq_list) (
-            sandesha2_report_t *report,
-            const axis2_env_t *env,
-            axis2_char_t *incoming_seq_id);
+        sandesha2_report_t *report,
+        const axis2_env_t *env,
+        axis2_char_t *incoming_seq_id);
 
     axis2_status_t (AXIS2_CALL *
     add_to_outgoing_seq_list) (
-            sandesha2_report_t *report,
-            const axis2_env_t *env,
-            axis2_char_t *out_seq_id);
+        sandesha2_report_t *report,
+        const axis2_env_t *env,
+        axis2_char_t *out_seq_id);
 
     axis2_status_t (AXIS2_CALL *
     add_to_no_of_completed_msgs_map) (
-            sandesha2_report_t *report,
-            const axis2_env_t *env,
-            axis2_char_t *id,
-            long no_of_msgs);
+        sandesha2_report_t *report,
+        const axis2_env_t *env,
+        axis2_char_t *id,
+        long no_of_msgs);
         
     axis2_status_t (AXIS2_CALL *
     add_to_seq_status_map) (
-            sandesha2_report_t *report,
-            const axis2_env_t *env,
-            axis2_char_t *id,
-            axis2_char_t status);
+        sandesha2_report_t *report,
+        const axis2_env_t *env,
+        axis2_char_t *id,
+        axis2_char_t status);
 
     axis2_char_t *(AXIS2_CALL *
     get_internal_seq_id_of_out_seq) (
-            sandesha2_report_t *report,
-            const axis2_env_t *env,
-            axis2_char_t *out_seq_id);
+        sandesha2_report_t *report,
+        const axis2_env_t *env,
+        axis2_char_t *out_seq_id);
 
     axis2_status_t (AXIS2_CALL *
     add_to_outgoing_internal_seq_map) (
-            sandesha2_report_t *report,
-            const axis2_env_t *env,
-            axis2_char_t *out_seq_id,
-            axis2_char_t *internal_seq_id);
+        sandesha2_report_t *report,
+        const axis2_env_t *env,
+        axis2_char_t *out_seq_id,
+        axis2_char_t *internal_seq_id);
 };
 
 struct sandesha2_report

Modified: webservices/sandesha/trunk/c/include/sandesha2_sender_mgr.h
URL: http://svn.apache.org/viewvc/webservices/sandesha/trunk/c/include/sandesha2_sender_mgr.h?view=diff&rev=514561&r1=514560&r2=514561
==============================================================================
--- webservices/sandesha/trunk/c/include/sandesha2_sender_mgr.h (original)
+++ webservices/sandesha/trunk/c/include/sandesha2_sender_mgr.h Sun Mar  4 22:06:56 2007
@@ -99,7 +99,8 @@
     sandesha2_sender_bean_t *(AXIS2_CALL *
             get_next_msg_to_send)(
                 sandesha2_sender_mgr_t *sender,
-                const axis2_env_t *env);
+                const axis2_env_t *env,
+                const axis2_char_t *seq_id);
 };
 
 AXIS2_DECLARE_DATA struct sandesha2_sender_mgr
@@ -162,7 +163,8 @@
 sandesha2_sender_bean_t *AXIS2_CALL
 sandesha2_sender_mgr_get_next_msg_to_send(
     sandesha2_sender_mgr_t *sender,
-    const axis2_env_t *env);
+    const axis2_env_t *env,
+    const axis2_char_t *seq_id);
 
 /** @} */
 #ifdef __cplusplus

Modified: webservices/sandesha/trunk/c/include/sandesha2_sender_worker.h
URL: http://svn.apache.org/viewvc/webservices/sandesha/trunk/c/include/sandesha2_sender_worker.h?view=diff&rev=514561&r1=514560&r2=514561
==============================================================================
--- webservices/sandesha/trunk/c/include/sandesha2_sender_worker.h (original)
+++ webservices/sandesha/trunk/c/include/sandesha2_sender_worker.h Sun Mar  4 22:06:56 2007
@@ -99,10 +99,6 @@
     const axis2_env_t *env,
     axis2_transport_out_desc_t *transport_out);
 
-axis2_status_t AXIS2_CALL
-sandesha2_sender_worker_check_for_sync_res(
-    const axis2_env_t *env, 
-    axis2_msg_ctx_t *msg_ctx);
                         
 /** @} */
 #ifdef __cplusplus

Modified: webservices/sandesha/trunk/c/samples/rm_echo_single_1_0/rm_echo_single.c
URL: http://svn.apache.org/viewvc/webservices/sandesha/trunk/c/samples/rm_echo_single_1_0/rm_echo_single.c?view=diff&rev=514561&r1=514560&r2=514561
==============================================================================
--- webservices/sandesha/trunk/c/samples/rm_echo_single_1_0/rm_echo_single.c (original)
+++ webservices/sandesha/trunk/c/samples/rm_echo_single_1_0/rm_echo_single.c Sun Mar  4 22:06:56 2007
@@ -28,6 +28,7 @@
 #include <sandesha2_constants.h>
 #include <sandesha2_client.h>
 #include <axis2_addr.h>
+#include <axis2_options.h>
 #include <ctype.h>
 
 #define SANDESHA2_MAX_COUNT 4
@@ -120,7 +121,6 @@
     /* Seperate listner needs addressing, hence addressing stuff in options */
     AXIS2_OPTIONS_SET_ACTION(options, env,
         "http://127.0.0.1:8080/axis2/services/RMSampleService/anonOutInOp");
-    AXIS2_OPTIONS_SET_TIMEOUT_IN_MILLI_SECONDS(options, env, 8000000);
     reply_to = axis2_endpoint_ref_create(env, AXIS2_WSA_ANONYMOUS_URL);
     /*AXIS2_OPTIONS_SET_REPLY_TO(options, env, reply_to);*/
 
@@ -183,9 +183,14 @@
             property);
     }
      
+    property = axis2_property_create_with_args(env, 0, 0, 0, "4");
+    if(property)
+    {
+        AXIS2_OPTIONS_SET_PROPERTY(options, env, AXIS2_TIMEOUT_IN_SECONDS, 
+            property);
+    }
     payload = build_om_payload_for_echo_svc(env, "echo1", "sequence1");
     result = AXIS2_SVC_CLIENT_SEND_RECEIVE(svc_client, env, payload);
-    AXIS2_SLEEP(SANDESHA2_MAX_COUNT);
 
     /*svc_ctx = AXIS2_SVC_CLIENT_GET_SVC_CTX(svc_client, env);
     conf_ctx = axis2_svc_ctx_get_conf_ctx(svc_ctx, env);
@@ -207,9 +212,14 @@
     }
     payload = NULL;
    
+    property = axis2_property_create_with_args(env, 0, 0, 0, "4");
+    if(property)
+    {
+        AXIS2_OPTIONS_SET_PROPERTY(options, env, AXIS2_TIMEOUT_IN_SECONDS, 
+            property);
+    }
     payload = build_om_payload_for_echo_svc(env, "echo2", "sequence1");
     result = AXIS2_SVC_CLIENT_SEND_RECEIVE(svc_client, env, payload);
-    AXIS2_SLEEP(SANDESHA2_MAX_COUNT);
 
     /*result = sandesha2_client_get_response_envelope(env, conf_ctx, svc_client, 2);*/
     if(result)
@@ -229,11 +239,16 @@
     }
     payload = NULL;
 
+    property = axis2_property_create_with_args(env, 0, 0, 0, "4");
+    if(property)
+    {
+        AXIS2_OPTIONS_SET_PROPERTY(options, env, AXIS2_TIMEOUT_IN_SECONDS, 
+            property);
+    }
     property = axis2_property_create_with_args(env, 0, 0, 0, AXIS2_VALUE_TRUE);
     AXIS2_OPTIONS_SET_PROPERTY(options, env, "Sandesha2LastMessage", property);
     payload = build_om_payload_for_echo_svc(env, "echo3", "sequence1");
     result = AXIS2_SVC_CLIENT_SEND_RECEIVE(svc_client, env, payload);
-    AXIS2_SLEEP(SANDESHA2_MAX_COUNT);
     /*result = sandesha2_client_get_response_envelope(env, conf_ctx, svc_client, 3);*/
     if(result)
     {

Modified: webservices/sandesha/trunk/c/samples/rm_mtom_1_0/rm_mtom_1_0.c
URL: http://svn.apache.org/viewvc/webservices/sandesha/trunk/c/samples/rm_mtom_1_0/rm_mtom_1_0.c?view=diff&rev=514561&r1=514560&r2=514561
==============================================================================
--- webservices/sandesha/trunk/c/samples/rm_mtom_1_0/rm_mtom_1_0.c (original)
+++ webservices/sandesha/trunk/c/samples/rm_mtom_1_0/rm_mtom_1_0.c Sun Mar  4 22:06:56 2007
@@ -133,10 +133,16 @@
             property);
     svc_ctx = AXIS2_SVC_CLIENT_GET_SVC_CTX(svc_client, env);
     conf_ctx = axis2_svc_ctx_get_conf_ctx(svc_ctx, env);
+    property = axis2_property_create_with_args(env, 0, 0, 0, "4");
+    
+    if(property)
+    {
+        AXIS2_OPTIONS_SET_PROPERTY(options, env, AXIS2_TIMEOUT_IN_SECONDS, 
+            property);
+    }
     payload = build_om_payload_for_mtom(env, image_name, "test1.jpg");
-    AXIS2_SVC_CLIENT_SEND_RECEIVE(svc_client, env, payload);
-    AXIS2_SLEEP(SANDESHA2_MAX_COUNT); 
-    /*result = sandesha2_client_get_response_envelope(env, conf_ctx, svc_client, 1);
+    result = AXIS2_SVC_CLIENT_SEND_RECEIVE(svc_client, env, payload);
+    /*result = sandesha2_client_get_response_envelope(env, conf_ctx, svc_client, 1);*/
     if(result)
     {
         axis2_char_t *om_str = NULL;
@@ -151,12 +157,17 @@
     else
     {
         printf("\necho client two way single channel invoke FAILED!\n");
-    }*/
+    }
 
+    property = axis2_property_create_with_args(env, 0, 0, 0, "4");
+    if(property)
+    {
+        AXIS2_OPTIONS_SET_PROPERTY(options, env, AXIS2_TIMEOUT_IN_SECONDS, 
+            property);
+    }
     payload = build_om_payload_for_mtom(env, image_name, "test2.jpg");
-    AXIS2_SVC_CLIENT_SEND_RECEIVE(svc_client, env, payload);
-    AXIS2_SLEEP(SANDESHA2_MAX_COUNT); 
-    /*result = sandesha2_client_get_response_envelope(env, conf_ctx, svc_client, 1);
+    result = AXIS2_SVC_CLIENT_SEND_RECEIVE(svc_client, env, payload);
+    /*result = sandesha2_client_get_response_envelope(env, conf_ctx, svc_client, 1);*/
     if(result)
     {
         axis2_char_t *om_str = NULL;
@@ -171,15 +182,20 @@
     else
     {
         printf("\necho client two way single channel invoke FAILED!\n");
-    }*/
+    }
 
+    property = axis2_property_create_with_args(env, 0, 0, 0, "4");
+    if(property)
+    {
+        AXIS2_OPTIONS_SET_PROPERTY(options, env, AXIS2_TIMEOUT_IN_SECONDS, 
+            property);
+    }
     payload = build_om_payload_for_mtom(env, image_name, "test3.jpg");
     property = axis2_property_create_with_args(env, 0, 0, 0, AXIS2_VALUE_TRUE);
     AXIS2_OPTIONS_SET_PROPERTY(options, env, "Sandesha2LastMessage", 
         property);
-    AXIS2_SVC_CLIENT_SEND_RECEIVE(svc_client, env, payload);
-    AXIS2_SLEEP(SANDESHA2_MAX_COUNT); 
-    /*result = sandesha2_client_get_response_envelope(env, conf_ctx, svc_client, 1);
+    result = AXIS2_SVC_CLIENT_SEND_RECEIVE(svc_client, env, payload);
+    /*result = sandesha2_client_get_response_envelope(env, conf_ctx, svc_client, 1);*/
     if(result)
     {
         axis2_char_t *om_str = NULL;
@@ -194,9 +210,9 @@
     else
     {
         printf("\necho client two way single channel invoke FAILED!\n");
-    }*/
+    }
 
-    AXIS2_SLEEP(SANDESHA2_MAX_COUNT); 
+    AXIS2_SLEEP(2 * SANDESHA2_MAX_COUNT); 
     if (svc_client)
     {
         /*AXIS2_SVC_CLIENT_FREE(svc_client, env);*/

Modified: webservices/sandesha/trunk/c/samples/rm_ping_1_0/rm_ping_1_0.c
URL: http://svn.apache.org/viewvc/webservices/sandesha/trunk/c/samples/rm_ping_1_0/rm_ping_1_0.c?view=diff&rev=514561&r1=514560&r2=514561
==============================================================================
--- webservices/sandesha/trunk/c/samples/rm_ping_1_0/rm_ping_1_0.c (original)
+++ webservices/sandesha/trunk/c/samples/rm_ping_1_0/rm_ping_1_0.c Sun Mar  4 22:06:56 2007
@@ -167,7 +167,7 @@
    
     if (svc_client)
     {
-        AXIS2_SVC_CLIENT_FREE(svc_client, env);
+        /*AXIS2_SVC_CLIENT_FREE(svc_client, env);*/
         svc_client = NULL;
     }
     return 0;

Modified: webservices/sandesha/trunk/c/samples/rm_report/report.c
URL: http://svn.apache.org/viewvc/webservices/sandesha/trunk/c/samples/rm_report/report.c?view=diff&rev=514561&r1=514560&r2=514561
==============================================================================
--- webservices/sandesha/trunk/c/samples/rm_report/report.c (original)
+++ webservices/sandesha/trunk/c/samples/rm_report/report.c Sun Mar  4 22:06:56 2007
@@ -27,6 +27,7 @@
 #include <sandesha2_client_constants.h>
 #include <sandesha2_constants.h>
 #include <sandesha2_client.h>
+#include <sandesha2_report.h>
 #include <axis2_addr.h>
 #include <axis2_options.h>
 #include <ctype.h>
@@ -70,6 +71,7 @@
     axis2_listener_manager_t *listener_manager = NULL;
     axis2_char_t *offered_seq_id = NULL;
     axiom_soap_envelope_t *result = NULL;
+    sandesha2_seq_report_t *report = NULL;
     int c;
     int i = 0, size = 0;
    
@@ -121,12 +123,6 @@
     /* Seperate listner needs addressing, hence addressing stuff in options */
     AXIS2_OPTIONS_SET_ACTION(options, env,
         "http://127.0.0.1:8080/axis2/services/RMSampleService/anonOutInOp");
-    property = axis2_property_create_with_args(env, 3, 0, 0, "4");
-    if(property)
-    {
-        AXIS2_OPTIONS_SET_PROPERTY(options, env, AXIS2_TIMEOUT_IN_SECONDS, 
-            property);
-    }
     reply_to = axis2_endpoint_ref_create(env, AXIS2_WSA_ANONYMOUS_URL);
     /*AXIS2_OPTIONS_SET_REPLY_TO(options, env, reply_to);*/
 
@@ -189,10 +185,15 @@
             property);
     }
      
-    /*svc_ctx = AXIS2_SVC_CLIENT_GET_SVC_CTX(svc_client, env);
+    svc_ctx = AXIS2_SVC_CLIENT_GET_SVC_CTX(svc_client, env);
     conf_ctx = axis2_svc_ctx_get_conf_ctx(svc_ctx, env);
-    result = sandesha2_client_get_response_envelope(env, conf_ctx, svc_client, 1);*/
    
+    property = axis2_property_create_with_args(env, 0, 0, 0, "4");
+    if(property)
+    {
+        AXIS2_OPTIONS_SET_PROPERTY(options, env, AXIS2_TIMEOUT_IN_SECONDS, 
+            property);
+    }
     payload = build_om_payload_for_echo_svc(env, "echo1", "sequence1");
     result = AXIS2_SVC_CLIENT_SEND_RECEIVE(svc_client, env, payload);
 
@@ -213,7 +214,40 @@
         printf("\necho client two way single channel invoke FAILED!\n");
     }
     payload = NULL;
-
+    report = sandesha2_client_get_report(env, conf_ctx);
+    if(report)
+    {
+        int i = 0, size = 0;
+        axis2_array_list_t *incoming_seq_list = NULL;
+        axis2_array_list_t *outgoing_seq_list = NULL;
+        incoming_seq_list = SANDESHA2_REPORT_GET_INCOMING_SEQ_LIST(report, env);
+        if(incoming_seq_list)
+            size = axis2_array_list_size(incoming_seq_list, env);
+        for(i = 0; i < size; i++)
+        {
+            axis2_char_t *seq_id = axis2_array_list_get(incoming_seq_list, env, i);
+            if(seq_id)
+            {
+                printf("incoming seq_id %d:%s\n", i+1, seq_id);
+            }
+        }
+        size = 0;
+        outgoing_seq_list = SANDESHA2_REPORT_GET_OUTGOING_SEQ_LIST(report, env);
+        if(outgoing_seq_list)
+            size = axis2_array_list_size(outgoing_seq_list, env);
+        for(i = 0; i < size; i++)
+        {
+            axis2_char_t *seq_id = axis2_array_list_get(outgoing_seq_list, env, i);
+            if(seq_id)
+            {
+                long completed_msgs_count = -1; 
+                printf("outgoing seq_id %d:%s\n", i+1, seq_id);
+                completed_msgs_count = SANDESHA2_REPORT_GET_COMPLETED_MSGS_COUNT(
+                    report, env, seq_id);
+                printf("completed_msgs_count:%d\n", completed_msgs_count);
+            }
+        }
+    }
     property = axis2_property_create_with_args(env, 0, 0, 0, AXIS2_VALUE_TRUE);
     AXIS2_OPTIONS_SET_PROPERTY(options, env, "Sandesha2LastMessage", property);
     payload = build_om_payload_for_echo_svc(env, "echo2", "sequence1");

Modified: webservices/sandesha/trunk/c/src/client/client.c
URL: http://svn.apache.org/viewvc/webservices/sandesha/trunk/c/src/client/client.c?view=diff&rev=514561&r1=514560&r2=514561
==============================================================================
--- webservices/sandesha/trunk/c/src/client/client.c (original)
+++ webservices/sandesha/trunk/c/src/client/client.c Sun Mar  4 22:06:56 2007
@@ -49,6 +49,8 @@
 #include <axiom_element.h>
 #include <axiom_soap_const.h>
 
+static sandesha2_transaction_t *client_report_transaction = NULL;
+
 /**
  * Caller must free the returned internal_seq_id
  * @param to
@@ -161,18 +163,18 @@
     if(options == NULL)
     {
         AXIS2_ERROR_SET(env->error, SANDESHA2_ERROR_OPTIONS_OBJECT_NOT_SET, 
-                AXIS2_FAILURE);
+            AXIS2_FAILURE);
         AXIS2_LOG_DEBUG(env->log, AXIS2_LOG_SI, 
-                "Options object of the service client not set.");
+            "Options object of the service client not set.");
         return NULL;
     }
     to_epr = AXIS2_OPTIONS_GET_TO(options, env);
     if(to_epr == NULL)
     {
         AXIS2_ERROR_SET(env->error, 
-                SANDESHA2_ERROR_TO_ADDRESS_NOT_SET, AXIS2_FAILURE);
+            SANDESHA2_ERROR_TO_ADDRESS_NOT_SET, AXIS2_FAILURE);
         AXIS2_LOG_DEBUG(env->log, AXIS2_LOG_SI, 
-                "To address is not set.");
+            "To address is not set.");
     }
     to = (axis2_char_t*)axis2_endpoint_ref_get_address(to_epr, env);
     property = (axis2_property_t *) AXIS2_OPTIONS_GET_PROPERTY(options, env, 
@@ -182,27 +184,26 @@
     if(svc_ctx == NULL)
     {
         AXIS2_ERROR_SET(env->error, SANDESHA2_ERROR_SVC_CTX_NULL, 
-                AXIS2_FAILURE);
+            AXIS2_FAILURE);
         AXIS2_LOG_DEBUG(env->log, AXIS2_LOG_SI, 
-                "Service Context is NULL.");
+            "Service Context is NULL.");
         
     }
     conf_ctx = AXIS2_SVC_CTX_GET_CONF_CTX(svc_ctx, env);    
-    internal_seq_id = sandesha2_client_get_internal_seq_id(
-            env, to, seq_key);
+    internal_seq_id = sandesha2_client_get_internal_seq_id(env, to, seq_key);
 
     return (sandesha2_seq_report_t *) 
-            sandesha2_client_get_outgoing_seq_report_with_internal_seq_id(env, 
-            internal_seq_id, conf_ctx);
+        sandesha2_client_get_outgoing_seq_report_with_internal_seq_id(env, 
+        internal_seq_id, conf_ctx);
 
 }
 
 sandesha2_seq_report_t *AXIS2_CALL
 sandesha2_client_get_outgoing_seq_report_with_seq_key(
-        const axis2_env_t *env,
-        axis2_char_t *to,
-        axis2_char_t *seq_key,
-        axis2_conf_ctx_t *conf_ctx)
+    const axis2_env_t *env,
+    axis2_char_t *to,
+    axis2_char_t *seq_key,
+    axis2_conf_ctx_t *conf_ctx)
 {
     axis2_char_t *internal_seq_id = NULL;
     
@@ -213,8 +214,8 @@
 
     internal_seq_id = sandesha2_utils_get_internal_seq_id(env, to, seq_key);
     return (sandesha2_seq_report_t *) 
-            sandesha2_client_get_outgoing_seq_report_with_internal_seq_id(env, 
-            internal_seq_id, conf_ctx);
+        sandesha2_client_get_outgoing_seq_report_with_internal_seq_id(env, 
+        internal_seq_id, conf_ctx);
 }
 
 sandesha2_seq_report_t *AXIS2_CALL
@@ -236,6 +237,7 @@
     sandesha2_transaction_t *report_transaction = NULL;
     axis2_char_t *within_transaction_str = NULL;
     axis2_char_t *out_seq_id = NULL;
+    axis2_bool_t commit = AXIS2_TRUE;
     
     AXIS2_ENV_CHECK(env, NULL);
     AXIS2_PARAM_CHECK(env->error, internal_seq_id, NULL);
@@ -250,20 +252,29 @@
     seq_prop_mgr = sandesha2_storage_mgr_get_seq_property_mgr(storage_mgr, env); 
     create_seq_mgr = sandesha2_storage_mgr_get_create_seq_mgr(storage_mgr, env); 
     ctx = AXIS2_CONF_CTX_GET_BASE(conf_ctx, env);
-    property = axis2_ctx_get_property(ctx, env, SANDESHA2_WITHIN_TRANSACTION, 
-        AXIS2_FALSE);
-    if(property)
-        within_transaction_str = (axis2_char_t *) AXIS2_PROPERTY_GET_VALUE(
-            property, env);
-    if(within_transaction_str && 0 == axis2_strcmp(within_transaction_str, 
-        SANDESHA2_VALUE_TRUE))
+    if(client_report_transaction)
     {
-        within_transaction = AXIS2_TRUE;
+        report_transaction = client_report_transaction;
+        commit = AXIS2_FALSE;
     }
-    if(!within_transaction)
+    else
     {
-        report_transaction = sandesha2_storage_mgr_get_transaction(storage_mgr, 
-            env);
+        property = axis2_ctx_get_property(ctx, env, SANDESHA2_WITHIN_TRANSACTION, 
+            AXIS2_FALSE);
+        if(property)
+            within_transaction_str = (axis2_char_t *) AXIS2_PROPERTY_GET_VALUE(
+                property, env);
+        if(within_transaction_str && 0 == axis2_strcmp(within_transaction_str, 
+            SANDESHA2_VALUE_TRUE))
+        {
+            within_transaction = AXIS2_TRUE;
+        }
+        if(!within_transaction)
+        {
+            report_transaction = sandesha2_storage_mgr_get_transaction(storage_mgr, 
+                env);
+        }
+        client_report_transaction = report_transaction;
     }
     SANDESHA2_SEQ_REPORT_SET_INTERNAL_SEQ_ID(seq_report, env, internal_seq_id);
     create_seq_find_bean = sandesha2_create_seq_bean_create(env);
@@ -271,7 +282,7 @@
         env, internal_seq_id);
     create_seq_bean = sandesha2_create_seq_mgr_find_unique(create_seq_mgr, env, 
         create_seq_find_bean);
-	/* if data not is available seq has to be terminated or timedOut.*/
+	/* if data is not available seq has to be terminated or timedOut.*/
     if(!create_seq_bean)
     {
 	    /* check weather this is an terminated seq.*/
@@ -319,8 +330,11 @@
         SANDESHA2_SEQ_STATUS_ESTABLISHED);
     sandesha2_client_fill_outgoing_seq_info(env, seq_report, out_seq_id, 
         seq_prop_mgr);
-    if(report_transaction)
+    if(report_transaction && commit)
+    {
          sandesha2_transaction_commit(report_transaction, env);
+         client_report_transaction = NULL;
+    }
     return seq_report;
 }
 
@@ -357,17 +371,17 @@
         axis2_char_t *seq_id = NULL;
         sandesha2_seq_report_t *incoming_seq_report = NULL;
         
-        seq_id = (axis2_char_t *) AXIS2_ARRAY_LIST_GET(incoming_seq_ids, env, i);
+        seq_id = (axis2_char_t *) axis2_array_list_get(incoming_seq_ids, env, i);
         incoming_seq_report = sandesha2_client_get_incoming_seq_report(env, 
-                seq_id, conf_ctx);
+            seq_id, conf_ctx);
         if(!incoming_seq_report)
         {
             AXIS2_ERROR_SET(env->error, 
-                    SANDESHA2_ERROR_INCOMING_SEQ_REPORT_NOT_PRESENT_FOR_GIVEN_SEQ_ID, 
-                    AXIS2_FAILURE);
+                SANDESHA2_ERROR_INCOMING_SEQ_REPORT_NOT_PRESENT_FOR_GIVEN_SEQ_ID, 
+                AXIS2_FAILURE);
             return NULL;
         }
-        AXIS2_ARRAY_LIST_ADD(incoming_seq_reports, env, incoming_seq_report);
+        axis2_array_list_add(incoming_seq_reports, env, incoming_seq_report);
     }
     return incoming_seq_reports;
 }
@@ -382,8 +396,8 @@
  */
 sandesha2_report_t *AXIS2_CALL
 sandesha2_client_get_report(
-        const axis2_env_t *env,
-        axis2_conf_ctx_t *conf_ctx)
+    const axis2_env_t *env,
+    axis2_conf_ctx_t *conf_ctx)
 {
     sandesha2_storage_mgr_t *storage_mgr = NULL;
     axis2_conf_t *conf = NULL;
@@ -400,6 +414,7 @@
     sandesha2_seq_property_bean_t *svr_completed_msgs_find_bean = NULL;
     axis2_ctx_t *ctx = NULL;
     axis2_property_t *property = NULL;
+    axis2_bool_t commit = AXIS2_TRUE;
 
     conf = AXIS2_CONF_CTX_GET_CONF(conf_ctx, env);
     storage_mgr = sandesha2_utils_get_storage_mgr(env, conf_ctx, conf);
@@ -407,38 +422,35 @@
     sandesha2_report = sandesha2_report_create(env);
     internal_seq_find_bean = sandesha2_seq_property_bean_create(env);
     ctx = AXIS2_CONF_CTX_GET_BASE(conf_ctx, env);
-    property = (axis2_property_t *) axis2_ctx_get_property(ctx, env, 
-            SANDESHA2_WITHIN_TRANSACTION, AXIS2_FALSE);
-    if(property)
-        within_transaction_str = (axis2_char_t *) AXIS2_PROPERTY_GET_VALUE(
-            property, env);
-    if(within_transaction_str && 0 == axis2_strcmp(within_transaction_str, 
-                SANDESHA2_VALUE_TRUE))
+    if(client_report_transaction)
     {
-        within_transaction = AXIS2_TRUE;
+        report_transaction = client_report_transaction;
+        commit = AXIS2_FALSE;
     }
-    if(AXIS2_TRUE != within_transaction)
-    {
-        report_transaction = sandesha2_storage_mgr_get_transaction(storage_mgr, env);
-    }
-    if(internal_seq_find_bean) 
-        sandesha2_seq_property_bean_set_name(internal_seq_find_bean, env, 
-                SANDESHA2_SEQ_PROP_INTERNAL_SEQ_ID);
-    collection = sandesha2_seq_property_mgr_find(seq_prop_mgr, env, internal_seq_find_bean);
-    if(AXIS2_SUCCESS != AXIS2_ERROR_GET_STATUS_CODE(env->error))
+    else
     {
-        if(AXIS2_TRUE != within_transaction && report_transaction != NULL)
+        property = (axis2_property_t *) axis2_ctx_get_property(ctx, env, 
+            SANDESHA2_WITHIN_TRANSACTION, AXIS2_FALSE);
+        if(property)
+            within_transaction_str = (axis2_char_t *) AXIS2_PROPERTY_GET_VALUE(
+                property, env);
+        if(within_transaction_str && 0 == axis2_strcmp(within_transaction_str, 
+            SANDESHA2_VALUE_TRUE))
         {
-            sandesha2_transaction_rollback(report_transaction, env);
-            rolled_back = AXIS2_TRUE;
+            within_transaction = AXIS2_TRUE;
         }
-        if (AXIS2_TRUE != within_transaction && AXIS2_TRUE != rolled_back && 
-                report_transaction != NULL) 
+        if(AXIS2_TRUE != within_transaction)
         {
-            sandesha2_transaction_commit(report_transaction, env);
+            report_transaction = sandesha2_storage_mgr_get_transaction(storage_mgr, 
+                env);
         }
-        return sandesha2_report;
+        client_report_transaction = report_transaction;
     }
+    if(internal_seq_find_bean) 
+        sandesha2_seq_property_bean_set_name(internal_seq_find_bean, env, 
+            SANDESHA2_SEQ_PROP_INTERNAL_SEQ_ID);
+    collection = sandesha2_seq_property_mgr_find(seq_prop_mgr, env, 
+        internal_seq_find_bean);
     if(collection)
         size = axis2_array_list_size(collection, env);
     for(i = 0; i < size; i++)
@@ -451,23 +463,24 @@
         long no_of_msgs = 0;
         axis2_char_t status = -1;
 
-        bean = (sandesha2_seq_property_bean_t *) AXIS2_ARRAY_LIST_GET(
-                collection, env, i);
+        bean = (sandesha2_seq_property_bean_t *) axis2_array_list_get(
+            collection, env, i);
         seq_id = sandesha2_seq_property_bean_get_seq_id(bean, env);
         SANDESHA2_REPORT_ADD_TO_OUTGOING_SEQ_LIST(sandesha2_report, env, seq_id);
         value = sandesha2_seq_property_bean_get_value(bean, env);
         SANDESHA2_REPORT_ADD_TO_OUTGOING_INTERNAL_SEQ_MAP(sandesha2_report, env,  
-                seq_id, value);
+            seq_id, value);
         report = sandesha2_client_get_outgoing_seq_report_with_internal_seq_id(
-                env, value, conf_ctx);
+            env, value, conf_ctx);
         completed_msgs = SANDESHA2_SEQ_REPORT_GET_COMPLETED_MSGS(report, env);
         if(completed_msgs)
             no_of_msgs = axis2_array_list_size(completed_msgs, env);
         SANDESHA2_REPORT_ADD_TO_NO_OF_COMPLETED_MSGS_MAP(sandesha2_report, env, 
-                seq_id, no_of_msgs);
+            seq_id, no_of_msgs);
         status = SANDESHA2_SEQ_REPORT_GET_SEQ_STATUS(report, env);
         SANDESHA2_REPORT_ADD_TO_SEQ_STATUS_MAP(sandesha2_report, env, seq_id, status);
     }
+    size = 0;
 	/* incoming sequences */
     svr_completed_msgs_find_bean = sandesha2_seq_property_bean_create(env);
     if(svr_completed_msgs_find_bean)
@@ -475,20 +488,6 @@
             SANDESHA2_SEQ_PROP_SERVER_COMPLETED_MESSAGES);
     svr_completed_msgs_beans = sandesha2_seq_property_mgr_find(seq_prop_mgr, 
         env, svr_completed_msgs_find_bean);
-    if(AXIS2_SUCCESS != AXIS2_ERROR_GET_STATUS_CODE(env->error))
-    {
-        if(AXIS2_TRUE != within_transaction && report_transaction != NULL)
-        {
-            sandesha2_transaction_rollback(report_transaction, env);
-            rolled_back = AXIS2_TRUE;
-        }
-        if (AXIS2_TRUE != within_transaction && AXIS2_TRUE != rolled_back && 
-                report_transaction != NULL) 
-        {
-            sandesha2_transaction_commit(report_transaction, env);
-        }
-        return sandesha2_report;
-    }
     if(svr_completed_msgs_beans)
         size = axis2_array_list_size(svr_completed_msgs_beans, env);
     for(i = 0; i < size; i++)
@@ -498,11 +497,11 @@
         sandesha2_seq_report_t *seq_report = NULL;
         axis2_char_t *value = NULL;
         axis2_array_list_t *completed_msgs = NULL;
-        long no_of_msgs = 0;
+        long no_of_msgs = -1;
         axis2_char_t status = -1;
 
         svr_completed_msgs_bean = (sandesha2_seq_property_bean_t *) 
-            AXIS2_ARRAY_LIST_GET(svr_completed_msgs_beans, env, i);
+            axis2_array_list_get(svr_completed_msgs_beans, env, i);
         seq_id = sandesha2_seq_property_bean_get_seq_id(svr_completed_msgs_bean, 
             env);
         SANDESHA2_REPORT_ADD_TO_INCOMING_SEQ_LIST(sandesha2_report, env, seq_id);
@@ -510,7 +509,9 @@
             env);
         seq_report = sandesha2_client_get_incoming_seq_report(env, value, 
             conf_ctx);
-        completed_msgs = SANDESHA2_SEQ_REPORT_GET_COMPLETED_MSGS(seq_report, env);
+        if(seq_report)
+            completed_msgs = SANDESHA2_SEQ_REPORT_GET_COMPLETED_MSGS(seq_report, 
+                env);
         if(completed_msgs)
             no_of_msgs = axis2_array_list_size(completed_msgs, env);
         SANDESHA2_REPORT_ADD_TO_NO_OF_COMPLETED_MSGS_MAP(sandesha2_report, env, 
@@ -519,18 +520,19 @@
         SANDESHA2_REPORT_ADD_TO_SEQ_STATUS_MAP(sandesha2_report, env, seq_id, status);
     }
     if (AXIS2_TRUE != within_transaction && AXIS2_TRUE != rolled_back && 
-        report_transaction != NULL) 
+        report_transaction != NULL && commit) 
     {
         sandesha2_transaction_commit(report_transaction, env);
+        client_report_transaction = NULL;
     }
 	return sandesha2_report;
 }
 
 axis2_status_t AXIS2_CALL
 sandesha2_client_create_seq_with_svc_client(
-        const axis2_env_t *env,
-        axis2_svc_client_t *svc_client,
-        axis2_bool_t offer)
+    const axis2_env_t *env,
+    axis2_svc_client_t *svc_client,
+    axis2_bool_t offer)
 {
     axis2_options_t *options = NULL;
     axis2_endpoint_ref_t *to_epr = NULL;
@@ -1503,7 +1505,7 @@
     {
         axis2_char_t *value = NULL;
         long *lng = AXIS2_MALLOC(env->allocator, sizeof(long));
-        value =  AXIS2_ARRAY_LIST_GET(completed_msg_list, env, i);
+        value =  axis2_array_list_get(completed_msg_list, env, i);
         *lng = atol(value);
         SANDESHA2_SEQ_REPORT_ADD_COMPLETED_MSG(report, env, lng);
     }
@@ -1524,14 +1526,14 @@
     
     seq_prop_mgr = sandesha2_storage_mgr_get_seq_property_mgr(storage_mgr, env);
     terminated_bean = sandesha2_seq_property_mgr_retrieve(seq_prop_mgr, env, 
-            seq_id, SANDESHA2_SEQ_PROP_SEQ_TERMINATED);
+        seq_id, SANDESHA2_SEQ_PROP_SEQ_TERMINATED);
     if(terminated_bean != NULL)
     {
         return SANDESHA2_SEQ_STATUS_TERMINATED;
     }
     timedout_bean = sandesha2_seq_property_mgr_retrieve(seq_prop_mgr, env, 
-            seq_id, SANDESHA2_SEQ_PROP_SEQ_TIMED_OUT);
-    if(timedout_bean != NULL)
+        seq_id, SANDESHA2_SEQ_PROP_SEQ_TIMED_OUT);
+    if(timedout_bean)
     {
         return SANDESHA2_SEQ_STATUS_TIMED_OUT;
     }
@@ -1571,6 +1573,7 @@
     axis2_array_list_t *completed_msg_list = NULL;
     axis2_char_t *within_transaction_str = NULL;
     axis2_char_t status = -1;
+    axis2_bool_t commit = AXIS2_TRUE;
     int i = 0, size = 0;
     
     AXIS2_ENV_CHECK(env, NULL);
@@ -1581,30 +1584,38 @@
     storage_mgr = sandesha2_utils_get_storage_mgr(env, conf_ctx, conf); 
     seq_prop_mgr = sandesha2_storage_mgr_get_seq_property_mgr(storage_mgr, env); 
     ctx = AXIS2_CONF_CTX_GET_BASE(conf_ctx, env);
-    property = axis2_ctx_get_property(ctx, env, SANDESHA2_WITHIN_TRANSACTION, 
-        AXIS2_FALSE);
-    if(property)
-        within_transaction_str = (axis2_char_t *) AXIS2_PROPERTY_GET_VALUE(
-            property, env);
-    if(within_transaction_str && 0 == axis2_strcmp(within_transaction_str, 
-                SANDESHA2_VALUE_TRUE))
+    if(client_report_transaction)
     {
-        within_transaction = AXIS2_TRUE;
+        report_transaction = client_report_transaction;
+        commit = AXIS2_FALSE;
     }
-    if(!within_transaction)
+    else
     {
-        report_transaction = sandesha2_storage_mgr_get_transaction(storage_mgr, 
-            env);
+        property = axis2_ctx_get_property(ctx, env, SANDESHA2_WITHIN_TRANSACTION, 
+            AXIS2_FALSE);
+        if(property)
+            within_transaction_str = (axis2_char_t *) AXIS2_PROPERTY_GET_VALUE(
+                property, env);
+        if(within_transaction_str && 0 == axis2_strcmp(within_transaction_str, 
+            SANDESHA2_VALUE_TRUE))
+        {
+            within_transaction = AXIS2_TRUE;
+        }
+        if(!within_transaction)
+        {
+            report_transaction = sandesha2_storage_mgr_get_transaction(storage_mgr, 
+                env);
+        }
     }
     seq_report = sandesha2_seq_report_create(env);
     completed_msg_list = sandesha2_ack_mgr_get_svr_completed_msgs_list(env, 
-            seq_id, seq_prop_mgr);
+        seq_id, seq_prop_mgr);
     if(completed_msg_list)
         size = axis2_array_list_size(completed_msg_list, env);
     for(i = 0; i < size; i++)
     {
         long *lng = NULL;
-        axis2_char_t *value = AXIS2_ARRAY_LIST_GET(completed_msg_list, env, i);
+        axis2_char_t *value = axis2_array_list_get(completed_msg_list, env, i);
         
         *lng = atol(value);
         SANDESHA2_SEQ_REPORT_ADD_COMPLETED_MSG(seq_report, env, lng);
@@ -1613,10 +1624,12 @@
     SANDESHA2_SEQ_REPORT_SET_INTERNAL_SEQ_ID(seq_report, env, seq_id); /* For
         incoming side internal_seq_id = seq_id*/
     SANDESHA2_SEQ_REPORT_SET_SEQ_DIRECTION(seq_report, env, 
-            SANDESHA2_SEQ_DIRECTION_IN);
+        SANDESHA2_SEQ_DIRECTION_IN);
     status = sandesha2_client_get_svr_seq_status(env, seq_id, storage_mgr);
     SANDESHA2_SEQ_REPORT_SET_SEQ_STATUS(seq_report, env, 
-            status);
+        status);
+    if(commit)
+        sandesha2_transaction_commit(report_transaction, env);
    
     return seq_report;
 }
@@ -1700,7 +1713,10 @@
             seq_id_bean = sandesha2_seq_property_mgr_retrieve(seq_prop_mgr, env, 
                 internal_seq_id, SANDESHA2_SEQ_PROP_OUT_SEQ_ID);
         if(transaction)
+        {
             sandesha2_transaction_commit(transaction, env);
+            client_report_transaction = NULL;
+        }
         if(!seq_id_bean)
         {
             AXIS2_ERROR_SET(env->error, SANDESHA2_ERROR_SEQ_ID_BEAN_NOT_SET, 
@@ -1984,6 +2000,7 @@
     sandesha2_storage_mgr_remove_response(storage_mgr, env, client_seq_key, 
         msg_no);
     sandesha2_transaction_commit(transaction, env);
+    client_report_transaction = NULL;
     return result;
 }
 

Modified: webservices/sandesha/trunk/c/src/client/report.c
URL: http://svn.apache.org/viewvc/webservices/sandesha/trunk/c/src/client/report.c?view=diff&rev=514561&r1=514560&r2=514561
==============================================================================
--- webservices/sandesha/trunk/c/src/client/report.c (original)
+++ webservices/sandesha/trunk/c/src/client/report.c Sun Mar  4 22:06:56 2007
@@ -78,10 +78,10 @@
 
 axis2_status_t AXIS2_CALL
 sandesha2_report_add_to_no_of_completed_msgs_map(
-        sandesha2_report_t *report,
-        const axis2_env_t *env,
-        axis2_char_t *id,
-        long no_of_msgs);
+    sandesha2_report_t *report,
+    const axis2_env_t *env,
+    axis2_char_t *id,
+    long no_of_msgs);
 	
 axis2_status_t AXIS2_CALL
 sandesha2_report_add_to_seq_status_map(
@@ -222,9 +222,9 @@
 
 long AXIS2_CALL
 sandesha2_report_get_completed_msgs_count(
-        sandesha2_report_t *report,
-        const axis2_env_t *env,
-        axis2_char_t *seq_id)
+    sandesha2_report_t *report,
+    const axis2_env_t *env,
+    axis2_char_t *seq_id)
 {
     sandesha2_report_impl_t *report_impl = NULL;
     long *lng = NULL;
@@ -233,7 +233,7 @@
     report_impl = SANDESHA2_INTF_TO_IMPL(report);
 
     lng = (long *)axis2_hash_get(report_impl->no_of_completed_msgs_map, seq_id, 
-            AXIS2_HASH_KEY_STRING);
+        AXIS2_HASH_KEY_STRING);
     if(!lng)
     {
         return -1;
@@ -317,18 +317,20 @@
 
 axis2_status_t AXIS2_CALL
 sandesha2_report_add_to_no_of_completed_msgs_map(
-        sandesha2_report_t *report,
-        const axis2_env_t *env,
-        axis2_char_t *id,
-        long no_of_msgs)
+    sandesha2_report_t *report,
+    const axis2_env_t *env,
+    axis2_char_t *id,
+    long no_of_msgs)
 {
     sandesha2_report_impl_t *report_impl = NULL;
+    long *no_of_msgs_l = AXIS2_MALLOC(env->allocator, sizeof(long));
 
     AXIS2_ENV_CHECK(env, AXIS2_FAILURE);
     report_impl = SANDESHA2_INTF_TO_IMPL(report);
 
+    *no_of_msgs_l = no_of_msgs;
     axis2_hash_set(report_impl->no_of_completed_msgs_map, id, 
-            AXIS2_HASH_KEY_STRING, &no_of_msgs);
+        AXIS2_HASH_KEY_STRING, no_of_msgs_l);
     return AXIS2_SUCCESS;
 }
 	

Modified: webservices/sandesha/trunk/c/src/client/sequence_report.c
URL: http://svn.apache.org/viewvc/webservices/sandesha/trunk/c/src/client/sequence_report.c?view=diff&rev=514561&r1=514560&r2=514561
==============================================================================
--- webservices/sandesha/trunk/c/src/client/sequence_report.c (original)
+++ webservices/sandesha/trunk/c/src/client/sequence_report.c Sun Mar  4 22:06:56 2007
@@ -295,8 +295,8 @@
 
 axis2_array_list_t *AXIS2_CALL
 sandesha2_seq_report_get_completed_msgs(
-        sandesha2_seq_report_t *report,
-        const axis2_env_t *env)
+    sandesha2_seq_report_t *report,
+    const axis2_env_t *env)
 {
     sandesha2_seq_report_impl_t *report_impl = NULL;
 
@@ -308,9 +308,9 @@
 
 axis2_status_t AXIS2_CALL
 sandesha2_seq_report_add_completed_msg(
-        sandesha2_seq_report_t *report,
-        const axis2_env_t *env,
-        long *msg_no)
+    sandesha2_seq_report_t *report,
+    const axis2_env_t *env,
+    long *msg_no)
 {
     sandesha2_seq_report_impl_t *report_impl = NULL;
 

Modified: webservices/sandesha/trunk/c/src/handlers/sandesha2_out_handler.c
URL: http://svn.apache.org/viewvc/webservices/sandesha/trunk/c/src/handlers/sandesha2_out_handler.c?view=diff&rev=514561&r1=514560&r2=514561
==============================================================================
--- webservices/sandesha/trunk/c/src/handlers/sandesha2_out_handler.c (original)
+++ webservices/sandesha/trunk/c/src/handlers/sandesha2_out_handler.c Sun Mar  4 22:06:56 2007
@@ -87,12 +87,13 @@
     axis2_bool_t rolled_back = AXIS2_FALSE;
     axis2_bool_t dummy_msg = AXIS2_FALSE;
     axis2_svc_t *svc = NULL;
+    axis2_qname_t *module_qname = NULL;
     sandesha2_storage_mgr_t *storage_mgr = NULL;
     sandesha2_transaction_t *transaction = NULL;
     sandesha2_msg_ctx_t *rm_msg_ctx = NULL;
     sandesha2_msg_processor_t *msg_processor = NULL;
     int msg_type = -1;
-    
+
     AXIS2_ENV_CHECK( env, AXIS2_FAILURE);
     AXIS2_PARAM_CHECK(env->error, msg_ctx, AXIS2_FAILURE);
     
@@ -104,6 +105,19 @@
         AXIS2_ERROR_SET(env->error, SANDESHA2_ERROR_CONF_CTX_NULL, AXIS2_FAILURE);
         return AXIS2_FAILURE;
     }
+    svc = AXIS2_MSG_CTX_GET_SVC(msg_ctx, env);
+    if(!svc)
+    {
+        AXIS2_LOG_DEBUG(env->log, AXIS2_LOG_SI, "[sandesha2] Axis2 Service is NULL");
+        AXIS2_ERROR_SET(env->error, SANDESHA2_ERROR_SVC_NULL, AXIS2_FAILURE);
+        return AXIS2_FAILURE;
+    }
+    module_qname = axis2_qname_create(env, "sandesha2", NULL, NULL);
+    if(!AXIS2_SVC_IS_MODULE_ENGAGED(svc, env, module_qname))
+    {
+        return AXIS2_SUCCESS;
+    }
+    axis2_qname_free(module_qname, env);
     if(!axis2_msg_ctx_get_server_side(msg_ctx, env))
     {
         axis2_ctx_t *conf_ctx_base = axis2_conf_ctx_get_base(conf_ctx, env);
@@ -111,13 +125,6 @@
             0, NULL);
         AXIS2_CTX_SET_PROPERTY(conf_ctx_base, env, SANDESHA2_IS_SVR_SIDE, 
             property, AXIS2_FALSE);
-    }
-    svc = AXIS2_MSG_CTX_GET_SVC(msg_ctx, env);
-    if(!svc)
-    {
-        AXIS2_LOG_DEBUG(env->log, AXIS2_LOG_SI, "[sandesha2] Axis2 Service is NULL");
-        AXIS2_ERROR_SET(env->error, SANDESHA2_ERROR_SVC_NULL, AXIS2_FAILURE);
-        return AXIS2_FAILURE;
     }
     else
     {

Modified: webservices/sandesha/trunk/c/src/msgprocessors/ack_req_msg_processor.c
URL: http://svn.apache.org/viewvc/webservices/sandesha/trunk/c/src/msgprocessors/ack_req_msg_processor.c?view=diff&rev=514561&r1=514560&r2=514561
==============================================================================
--- webservices/sandesha/trunk/c/src/msgprocessors/ack_req_msg_processor.c (original)
+++ webservices/sandesha/trunk/c/src/msgprocessors/ack_req_msg_processor.c Sun Mar  4 22:06:56 2007
@@ -358,7 +358,7 @@
         
         transport_out = AXIS2_MSG_CTX_GET_TRANSPORT_OUT_DESC(ack_msg_ctx, env);
         property = axis2_property_create_with_args(env, 0, 0,
-            transport_out->ops->free_void_arg, transport_out);
+            axis2_transport_out_desc_free_void_arg, transport_out);
         AXIS2_MSG_CTX_SET_PROPERTY(ack_msg_ctx, env, 
             SANDESHA2_ORIGINAL_TRANSPORT_OUT_DESC, property, 
             AXIS2_FALSE);

Modified: webservices/sandesha/trunk/c/src/msgprocessors/app_msg_processor.c
URL: http://svn.apache.org/viewvc/webservices/sandesha/trunk/c/src/msgprocessors/app_msg_processor.c?view=diff&rev=514561&r1=514560&r2=514561
==============================================================================
--- webservices/sandesha/trunk/c/src/msgprocessors/app_msg_processor.c (original)
+++ webservices/sandesha/trunk/c/src/msgprocessors/app_msg_processor.c Sun Mar  4 22:06:56 2007
@@ -218,7 +218,7 @@
     axis2_bool_t back_channel_free = AXIS2_FALSE;
     axis2_op_t *op = NULL;
     int mep = -1;
-    
+   
     AXIS2_ENV_CHECK(env, AXIS2_FAILURE);
     AXIS2_PARAM_CHECK(env->error, rm_msg_ctx, AXIS2_FAILURE);
     AXIS2_LOG_INFO(env->log, 
@@ -570,13 +570,13 @@
     AXIS2_LOG_INFO(env->log, 
         "[sandesha2] Exit: sandesha2_app_msg_processor_process_in_msg");
 
-    {
+    /*{
         axis2_svc_ctx_t *svc_ctx = AXIS2_OP_CTX_GET_PARENT(op_ctx, env);
         axis2_ctx_t *ctx = AXIS2_SVC_CTX_GET_BASE((const axis2_svc_ctx_t *)svc_ctx, env);
         AXIS2_CTX_SET_PROPERTY(ctx, env, AXIS2_RESPONSE_SOAP_ENVELOPE, 
             axis2_property_create_with_args(env, 0, 0, 0, 
             (void*)axis2_msg_ctx_get_soap_envelope(msg_ctx, env)), AXIS2_FALSE);
-    }
+    }*/
     return AXIS2_SUCCESS;
     
 }
@@ -777,8 +777,7 @@
         SANDESHA2_CLIENT_DUMMY_MESSAGE, AXIS2_FALSE);
     if(property)
         dummy_msg_str = axis2_property_get_value(property, env);
-    if(dummy_msg_str && 0 == axis2_strcmp(dummy_msg_str, 
-                        SANDESHA2_VALUE_TRUE))
+    if(dummy_msg_str && 0 == axis2_strcmp(dummy_msg_str, SANDESHA2_VALUE_TRUE))
         dummy_msg = AXIS2_TRUE;
     if(!dummy_msg)
         sandesha2_app_msg_processor_set_next_msg_no(env, internal_seq_id, 
@@ -1214,7 +1213,7 @@
         property, AXIS2_FALSE);
     orig_trans_out = AXIS2_MSG_CTX_GET_TRANSPORT_OUT_DESC(create_seq_msg, env);
     property = axis2_property_create_with_args(env, 0, 0, 
-        orig_trans_out->ops->free_void_arg, orig_trans_out);
+        axis2_transport_out_desc_free_void_arg, orig_trans_out);
     axis2_msg_ctx_set_property(create_seq_msg, env, 
         SANDESHA2_ORIGINAL_TRANSPORT_OUT_DESC, property, AXIS2_FALSE);
     trans_out = sandesha2_utils_get_transport_out(env);
@@ -1491,7 +1490,7 @@
                         
         trans_out = AXIS2_MSG_CTX_GET_TRANSPORT_OUT_DESC(app_msg_ctx, env);
         property = axis2_property_create_with_args(env, 0, 0, 
-            trans_out->ops->free_void_arg, trans_out);
+            axis2_transport_out_desc_free_void_arg, trans_out);
         axis2_msg_ctx_set_property(app_msg_ctx, env, 
             SANDESHA2_ORIGINAL_TRANSPORT_OUT_DESC, property, AXIS2_FALSE);
         AXIS2_MSG_CTX_SET_TRANSPORT_OUT_DESC(app_msg_ctx, env, 

Modified: webservices/sandesha/trunk/c/src/storage/inmemory/inmemory_sender_mgr.c
URL: http://svn.apache.org/viewvc/webservices/sandesha/trunk/c/src/storage/inmemory/inmemory_sender_mgr.c?view=diff&rev=514561&r1=514560&r2=514561
==============================================================================
--- webservices/sandesha/trunk/c/src/storage/inmemory/inmemory_sender_mgr.c (original)
+++ webservices/sandesha/trunk/c/src/storage/inmemory/inmemory_sender_mgr.c Sun Mar  4 22:06:56 2007
@@ -97,7 +97,8 @@
 sandesha2_sender_bean_t *AXIS2_CALL
 sandesha2_inmemory_sender_mgr_get_next_msg_to_send(
     sandesha2_sender_mgr_t *sender_mgr,
-    const axis2_env_t *env);
+    const axis2_env_t *env,
+    const axis2_char_t *seq_id);
 
 static const sandesha2_sender_mgr_ops_t sender_mgr_ops = 
 {
@@ -397,7 +398,8 @@
 sandesha2_sender_bean_t *AXIS2_CALL
 sandesha2_inmemory_sender_mgr_get_next_msg_to_send(
     sandesha2_sender_mgr_t *sender_mgr,
-    const axis2_env_t *env)
+    const axis2_env_t *env,
+    const axis2_char_t *seq_id)
 {
     sandesha2_sender_bean_t *matcher = sandesha2_sender_bean_create(env);
     sandesha2_sender_bean_t *result = NULL;

Modified: webservices/sandesha/trunk/c/src/storage/permanent/permanent_sender_mgr.c
URL: http://svn.apache.org/viewvc/webservices/sandesha/trunk/c/src/storage/permanent/permanent_sender_mgr.c?view=diff&rev=514561&r1=514560&r2=514561
==============================================================================
--- webservices/sandesha/trunk/c/src/storage/permanent/permanent_sender_mgr.c (original)
+++ webservices/sandesha/trunk/c/src/storage/permanent/permanent_sender_mgr.c Sun Mar  4 22:06:56 2007
@@ -226,7 +226,8 @@
 sandesha2_sender_bean_t *AXIS2_CALL
 sandesha2_permanent_sender_mgr_get_next_msg_to_send(
     sandesha2_sender_mgr_t *sender_mgr,
-    const axis2_env_t *env);
+    const axis2_env_t *env,
+    const axis2_char_t *seq_id);
 
 static const sandesha2_sender_mgr_ops_t sender_mgr_ops = 
 {
@@ -628,7 +629,8 @@
 sandesha2_sender_bean_t *AXIS2_CALL
 sandesha2_permanent_sender_mgr_get_next_msg_to_send(
     sandesha2_sender_mgr_t *sender_mgr,
-    const axis2_env_t *env)
+    const axis2_env_t *env,
+    const axis2_char_t *seq_id)
 {
     axis2_char_t *sql_find = NULL;
     axis2_char_t *sql_count = NULL;
@@ -644,6 +646,8 @@
     sandesha2_sender_bean_set_send(matcher, env, AXIS2_TRUE);
     time_now = sandesha2_utils_get_current_time_in_millis(env);
     sandesha2_sender_bean_set_time_to_send(matcher, env, time_now);
+    sandesha2_sender_bean_set_internal_seq_id(matcher, env, 
+        (axis2_char_t *) seq_id);
     sql_find = "select msg_id, msg_ctx_ref_key, "\
         "internal_seq_id, sent_count, msg_no, send, resend, "\
         "time_to_send, msg_type, seq_id, wsrm_anon_uri, "\

Modified: webservices/sandesha/trunk/c/src/storage/permanent/permanent_transaction.c
URL: http://svn.apache.org/viewvc/webservices/sandesha/trunk/c/src/storage/permanent/permanent_transaction.c?view=diff&rev=514561&r1=514560&r2=514561
==============================================================================
--- webservices/sandesha/trunk/c/src/storage/permanent/permanent_transaction.c (original)
+++ webservices/sandesha/trunk/c/src/storage/permanent/permanent_transaction.c Sun Mar  4 22:06:56 2007
@@ -154,7 +154,7 @@
         db_name = axis2_strcat(env, path, AXIS2_PATH_SEP_STR, 
             "sandesha2_client_db", NULL);
     }
-    AXIS2_LOG_INFO(env->log, "db_name %s", db_name);
+    /*AXIS2_LOG_INFO(env->log, "db_name %s", db_name);*/
     rc = sqlite3_open(db_name, &(trans_impl->dbconn));
     if(rc != SQLITE_OK)
     {

Modified: webservices/sandesha/trunk/c/src/storage/sender_mgr.c
URL: http://svn.apache.org/viewvc/webservices/sandesha/trunk/c/src/storage/sender_mgr.c?view=diff&rev=514561&r1=514560&r2=514561
==============================================================================
--- webservices/sandesha/trunk/c/src/storage/sender_mgr.c (original)
+++ webservices/sandesha/trunk/c/src/storage/sender_mgr.c Sun Mar  4 22:06:56 2007
@@ -98,8 +98,9 @@
 sandesha2_sender_bean_t *AXIS2_CALL
 sandesha2_sender_mgr_get_next_msg_to_send(
     sandesha2_sender_mgr_t *sender,
-    const axis2_env_t *env)
+    const axis2_env_t *env,
+    const axis2_char_t *seq_id)
 {
-    return sender->ops.get_next_msg_to_send(sender, env);
+    return sender->ops.get_next_msg_to_send(sender, env, seq_id);
 }
 

Modified: webservices/sandesha/trunk/c/src/util/ack_mgr.c
URL: http://svn.apache.org/viewvc/webservices/sandesha/trunk/c/src/util/ack_mgr.c?view=diff&rev=514561&r1=514560&r2=514561
==============================================================================
--- webservices/sandesha/trunk/c/src/util/ack_mgr.c (original)
+++ webservices/sandesha/trunk/c/src/util/ack_mgr.c Sun Mar  4 22:06:56 2007
@@ -234,7 +234,7 @@
         orig_trans_out = AXIS2_MSG_CTX_GET_TRANSPORT_OUT_DESC(ack_msg_ctx, 
             env);
         property = axis2_property_create_with_args(env, AXIS2_SCOPE_APPLICATION, 
-            AXIS2_FALSE, orig_trans_out->ops->free_void_arg, orig_trans_out);
+            AXIS2_FALSE, axis2_transport_out_desc_free_void_arg, orig_trans_out);
         axis2_msg_ctx_set_property(ack_msg_ctx, env,
             SANDESHA2_ORIGINAL_TRANSPORT_OUT_DESC, property,
                 AXIS2_FALSE);
@@ -301,7 +301,7 @@
     if(completed_msgs_bean != NULL)
     {
         axis2_char_t *value = sandesha2_seq_property_bean_get_value(
-                completed_msgs_bean, env);
+            completed_msgs_bean, env);
         completed_msg_list = sandesha2_utils_get_array_list_from_string(env, value);
     }
     else
@@ -323,18 +323,18 @@
     axis2_array_list_t *completed_msg_list = NULL;
     
     completed_msgs_bean = sandesha2_seq_property_mgr_retrieve(seq_prop_mgr, 
-            env, seq_id, 
-            SANDESHA2_SEQ_PROP_SERVER_COMPLETED_MESSAGES);
+        env, seq_id, 
+        SANDESHA2_SEQ_PROP_SERVER_COMPLETED_MESSAGES);
     if(completed_msgs_bean)
     {
         axis2_char_t *value = sandesha2_seq_property_bean_get_value(
-                completed_msgs_bean, env);
+            completed_msgs_bean, env);
         completed_msg_list = sandesha2_utils_get_array_list_from_string(env, value);
     }
     else
     {
         AXIS2_ERROR_SET(env->error, SANDESHA2_ERROR_COMPLETED_MSGS_BEAN_IS_NULL, 
-                AXIS2_FAILURE);
+            AXIS2_FAILURE);
         return NULL;
     }
     return completed_msg_list;

Modified: webservices/sandesha/trunk/c/src/util/msg_retrans_adjuster.c
URL: http://svn.apache.org/viewvc/webservices/sandesha/trunk/c/src/util/msg_retrans_adjuster.c?view=diff&rev=514561&r1=514560&r2=514561
==============================================================================
--- webservices/sandesha/trunk/c/src/util/msg_retrans_adjuster.c (original)
+++ webservices/sandesha/trunk/c/src/util/msg_retrans_adjuster.c Sun Mar  4 22:06:56 2007
@@ -61,6 +61,7 @@
     axis2_char_t *seq_id = NULL;
     sandesha2_property_bean_t *property_bean = NULL;
     int max_attempts = -1;
+    int sent_count = -1;
     axis2_bool_t timeout_seq = AXIS2_FALSE;
     axis2_bool_t seq_timed_out = AXIS2_FALSE;
     axis2_bool_t continue_sending = AXIS2_TRUE;
@@ -89,16 +90,13 @@
         AXIS2_MSG_CTX_GET_OP(msg_ctx, env));*/
     property_bean = sandesha2_utils_get_property_bean(env, 
         axis2_conf_ctx_get_conf(conf_ctx, env));
-    sandesha2_sender_bean_set_sent_count(retrans_bean, env, 
-        sandesha2_sender_bean_get_sent_count(retrans_bean, 
-            env) + 1);
+    sent_count = sandesha2_sender_bean_get_sent_count(retrans_bean, env) + 1;
+    sandesha2_sender_bean_set_sent_count(retrans_bean, env, sent_count);
     sandesha2_msg_retrans_adjuster_adjust_next_retrans_time(env, retrans_bean,
         property_bean);
     max_attempts = sandesha2_property_bean_get_max_retrans_count(property_bean, 
         env);
-    
-    if(max_attempts > 0 && sandesha2_sender_bean_get_sent_count(retrans_bean, 
-        env) > max_attempts)
+    if(max_attempts > 0 &&  sent_count > max_attempts)
         timeout_seq = AXIS2_TRUE;
     if(rm_msg_ctx)
         seq_timed_out = sandesha2_seq_mgr_has_seq_timedout(env, int_seq_id, 

Modified: webservices/sandesha/trunk/c/src/util/sandesha2_utils.c
URL: http://svn.apache.org/viewvc/webservices/sandesha/trunk/c/src/util/sandesha2_utils.c?view=diff&rev=514561&r1=514560&r2=514561
==============================================================================
--- webservices/sandesha/trunk/c/src/util/sandesha2_utils.c (original)
+++ webservices/sandesha/trunk/c/src/util/sandesha2_utils.c Sun Mar  4 22:06:56 2007
@@ -278,8 +278,11 @@
     temp_str = strtok(dup_str, ",");
     while(temp_str)
     {
-        axis2_char_t *temp_element = AXIS2_STRDUP(temp_str, env);
-        AXIS2_ARRAY_LIST_ADD(ret, env, temp_element);
+        if(!sandesha2_utils_array_list_contains(env, ret, temp_str))
+        {
+            axis2_char_t *temp_element = AXIS2_STRDUP(temp_str, env);
+            AXIS2_ARRAY_LIST_ADD(ret, env, temp_element);
+        }
         temp_str = strtok(NULL, ",");
     }
     AXIS2_FREE(env->allocator, dup_str);
@@ -287,9 +290,10 @@
 }
 
 AXIS2_EXTERN axis2_bool_t AXIS2_CALL
-sandesha2_utils_array_list_contains(const axis2_env_t *env,
-                        axis2_array_list_t *list,
-                        axis2_char_t *str)
+sandesha2_utils_array_list_contains(
+    const axis2_env_t *env,
+    axis2_array_list_t *list,
+    axis2_char_t *str)
 {
     int i = 0;
     AXIS2_ENV_CHECK(env, AXIS2_FALSE);
@@ -1232,8 +1236,8 @@
         property, AXIS2_FALSE);
     
     transport_out = AXIS2_MSG_CTX_GET_TRANSPORT_OUT_DESC(msg_ctx, env);
-    property = axis2_property_create_with_args(env, AXIS2_SCOPE_APPLICATION, 
-        AXIS2_FALSE, transport_out->ops->free_void_arg, transport_out);
+    property = axis2_property_create_with_args(env, 3, 0, 
+        axis2_transport_out_desc_free_void_arg, transport_out);
     AXIS2_MSG_CTX_SET_PROPERTY(msg_ctx, env, 
         SANDESHA2_ORIGINAL_TRANSPORT_OUT_DESC, property, AXIS2_FALSE);
     

Modified: webservices/sandesha/trunk/c/src/util/terminate_mgr.c
URL: http://svn.apache.org/viewvc/webservices/sandesha/trunk/c/src/util/terminate_mgr.c?view=diff&rev=514561&r1=514560&r2=514561
==============================================================================
--- webservices/sandesha/trunk/c/src/util/terminate_mgr.c (original)
+++ webservices/sandesha/trunk/c/src/util/terminate_mgr.c Sun Mar  4 22:06:56 2007
@@ -63,10 +63,10 @@
     axis2_char_t *seq_id,
     sandesha2_storage_mgr_t *storage_mgr);
 
-/*static axis2_bool_t
+static axis2_bool_t
 sandesha2_terminate_mgr_is_property_deletable(
     const axis2_env_t *env,
-    axis2_char_t *name);*/
+    axis2_char_t *name);
 
 AXIS2_EXTERN axis2_status_t AXIS2_CALL
 sandesha2_terminate_mgr_clean_recv_side_after_terminate_msg(
@@ -93,7 +93,7 @@
     }
     
     prop_bean = sandesha2_utils_get_property_bean(env, AXIS2_CONF_CTX_GET_CONF(
-                    conf_ctx, env));
+        conf_ctx, env));
     in_order_invoke = sandesha2_property_bean_is_in_order(prop_bean, env);
     if(!in_order_invoke)
     {
@@ -103,7 +103,7 @@
                 SANDESHA2_CLEANED_ON_TERMINATE_MSG, env));
         axis2_allocator_switch_to_local_pool(env->allocator);
         sandesha2_terminate_mgr_clean_recv_side_after_invocation(env, conf_ctx,
-                    seq_id, storage_mgr);
+            seq_id, storage_mgr);
     }
     else
     {	axis2_char_t *clean_status = NULL;
@@ -113,17 +113,17 @@
             AXIS2_HASH_KEY_STRING);
         axis2_allocator_switch_to_local_pool(env->allocator);
         if(clean_status && 0 == axis2_strcmp(clean_status, 
-                    SANDESHA2_CLEANED_AFTER_INVOCATION))
+            SANDESHA2_CLEANED_AFTER_INVOCATION))
         {
             sandesha2_terminate_mgr_complete_termination_of_recv_side(env, conf_ctx, seq_id,
-                    storage_mgr);
+                storage_mgr);
         }
         else
         {
             axis2_allocator_switch_to_global_pool(env->allocator);
             axis2_hash_set(sandesha2_terminate_mgr_rcv_side_clean_map, seq_id,
-                    AXIS2_HASH_KEY_STRING, AXIS2_STRDUP(
-                    SANDESHA2_CLEANED_ON_TERMINATE_MSG, env));
+                AXIS2_HASH_KEY_STRING, AXIS2_STRDUP(
+                SANDESHA2_CLEANED_ON_TERMINATE_MSG, env));
             axis2_allocator_switch_to_local_pool(env->allocator);
         }
     }
@@ -309,7 +309,7 @@
             sandesha2_seq_property_bean_set_value(all_seq_bean, env, all_seq_str);
             sandesha2_seq_property_mgr_update(seq_prop_mgr, env, all_seq_bean);
         }
-    } 
+    }
     AXIS2_LOG_INFO(env->log, 
         "[sandesha2]Exit:sandesha2_terminate_mgr_remove_recv_side_properties");
     return AXIS2_SUCCESS;
@@ -388,35 +388,29 @@
     return AXIS2_SUCCESS;
 }
 
-/*
+
 static axis2_bool_t
 sandesha2_terminate_mgr_is_property_deletable(
     const axis2_env_t *env,
     axis2_char_t *name)
 {
     axis2_bool_t deletable = AXIS2_TRUE;
-    axis2_char_t *name_l = NULL;
-    
-    AXIS2_ENV_CHECK(env, AXIS2_FALSE);
-    AXIS2_PARAM_CHECK(env->error, name, AXIS2_FALSE);
-    name_l = axis2_strtrim(env, name, NULL);
         
-    if(0 == axis2_strcasecmp(name_l, SANDESHA2_SEQ_PROP_TERMINATE_ADDED))
+    if(0 == axis2_strcasecmp(name, SANDESHA2_SEQ_PROP_TERMINATE_ADDED))
         deletable = AXIS2_FALSE;
-    if(0 == axis2_strcasecmp(name_l, SANDESHA2_SEQ_PROP_NO_OF_OUTGOING_MSGS_ACKED))
+    if(0 == axis2_strcasecmp(name, SANDESHA2_SEQ_PROP_NO_OF_OUTGOING_MSGS_ACKED))
         deletable = AXIS2_FALSE;
-    if(0 == axis2_strcasecmp(name_l, SANDESHA2_SEQ_PROP_INTERNAL_SEQ_ID))
+    if(0 == axis2_strcasecmp(name, SANDESHA2_SEQ_PROP_INTERNAL_SEQ_ID))
         deletable = AXIS2_FALSE;
-    if(0 == axis2_strcasecmp(name_l, SANDESHA2_SEQ_PROP_SEQ_TERMINATED))
+    if(0 == axis2_strcasecmp(name, SANDESHA2_SEQ_PROP_SEQ_TERMINATED))
         deletable = AXIS2_FALSE;
-    if(0 == axis2_strcasecmp(name_l, SANDESHA2_SEQ_PROP_SEQ_CLOSED))
+    if(0 == axis2_strcasecmp(name, SANDESHA2_SEQ_PROP_SEQ_CLOSED))
         deletable = AXIS2_FALSE;
-    if(0 == axis2_strcasecmp(name_l, SANDESHA2_SEQ_PROP_SEQ_TIMED_OUT))
+    if(0 == axis2_strcasecmp(name, SANDESHA2_SEQ_PROP_SEQ_TIMED_OUT))
         deletable = AXIS2_FALSE;
-    AXIS2_FREE(env->allocator, name_l); 
     return deletable;
 }
-*/
+
 AXIS2_EXTERN axis2_status_t AXIS2_CALL
 sandesha2_terminate_mgr_time_out_sending_side_seq(
     const axis2_env_t *env,
@@ -558,8 +552,8 @@
             sandesha2_terminate_mgr_do_updates_if_needed(env, out_seq_id,
                 seq_prop_bean, seq_prop_mgr);
             /* test comment */
-            /*if(sandesha2_terminate_mgr_is_property_deletable(env,
-                sandesha2_seq_property_bean_get_name(seq_prop_bean, env)))*/
+            if(sandesha2_terminate_mgr_is_property_deletable(env,
+                sandesha2_seq_property_bean_get_name(seq_prop_bean, env)))
             {
                 axis2_char_t *highest_in_msg_key_str = NULL;
                 axis2_char_t *seq_id = sandesha2_seq_property_bean_get_seq_id(
@@ -741,7 +735,7 @@
     transport_out = axis2_msg_ctx_get_transport_out_desc(msg_ctx1, env);
     
     property = axis2_property_create_with_args(env, 0, 0,
-        transport_out->ops->free_void_arg, transport_out);
+        axis2_transport_out_desc_free_void_arg, transport_out);
     axis2_msg_ctx_set_property(msg_ctx1, env, 
         SANDESHA2_ORIGINAL_TRANSPORT_OUT_DESC, property, AXIS2_FALSE);
     

Modified: webservices/sandesha/trunk/c/src/workers/sender.c
URL: http://svn.apache.org/viewvc/webservices/sandesha/trunk/c/src/workers/sender.c?view=diff&rev=514561&r1=514560&r2=514561
==============================================================================
--- webservices/sandesha/trunk/c/src/workers/sender.c (original)
+++ webservices/sandesha/trunk/c/src/workers/sender.c Sun Mar  4 22:06:56 2007
@@ -52,6 +52,7 @@
     axis2_bool_t run_sender;
     axis2_array_list_t *working_seqs;
     axis2_thread_mutex_t *mutex;
+    int seq_index;
     int counter;
 };
 
@@ -88,6 +89,7 @@
     sender->working_seqs = NULL;
     sender->mutex = NULL;
     sender->counter = 0;
+    sender->seq_index = -1;
     
     sender->working_seqs = axis2_array_list_create(env, 
                         AXIS2_ARRAY_LIST_DEFAULT_CAPACITY);
@@ -135,7 +137,8 @@
 axis2_status_t AXIS2_CALL 
 sandesha2_sender_stop_sender_for_seq(
     sandesha2_sender_t *sender, 
-    const axis2_env_t *env, axis2_char_t *seq_id)
+    const axis2_env_t *env, 
+    axis2_char_t *seq_id)
 {
     int i = 0;
     AXIS2_ENV_CHECK(env, AXIS2_FAILURE);
@@ -189,7 +192,7 @@
     AXIS2_PARAM_CHECK(env->error, conf_ctx, AXIS2_FAILURE);
    
     if(seq_id && !sandesha2_utils_array_list_contains(env, 
-                        sender->working_seqs, seq_id))
+        sender->working_seqs, seq_id))
         AXIS2_ARRAY_LIST_ADD(sender->working_seqs, env, seq_id);
     if(!sender->run_sender)
     {
@@ -218,11 +221,11 @@
     args->env = (axis2_env_t*)env;
 
     worker_thread = AXIS2_THREAD_POOL_GET_THREAD(env->thread_pool,
-                        sandesha2_sender_worker_func, (void*)args);
+        sandesha2_sender_worker_func, (void*)args);
     if(NULL == worker_thread)
     {
         AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI, "[sandesha2]Thread creation "
-                        "failed sandesha2_sender_run");
+            "failed sandesha2_sender_run");
         return AXIS2_FAILURE;
     }
     AXIS2_THREAD_POOL_THREAD_DETACH(env->thread_pool, worker_thread);     
@@ -243,7 +246,7 @@
     axis2_env_t *env = NULL;
     sandesha2_storage_mgr_t *storage_mgr = NULL;
     sandesha2_seq_property_mgr_t *seq_prop_mgr = NULL;
-    int count = 0;
+    axis2_bool_t do_sleep = AXIS2_FALSE;
     
     args = (sandesha2_sender_args_t*)data;
     env = axis2_init_thread_env(args->env);
@@ -263,19 +266,29 @@
         sandesha2_sender_bean_t *sender_bean = NULL;
         sandesha2_sender_worker_t *sender_worker = NULL;
         axis2_char_t *msg_id = NULL;
-        AXIS2_SLEEP(SANDESHA2_SENDER_SLEEP_TIME * 1); 
+        axis2_char_t *seq_id = NULL;
+        int no_of_seqs = 0;
+        no_of_seqs = axis2_array_list_size(sender->working_seqs, env);
+        if(sender->seq_index >= no_of_seqs)
+        {
+            sender->seq_index = 0;
+            if(no_of_seqs == 0)
+            {
+                do_sleep = AXIS2_TRUE;
+                continue;
+            }
+        }
+        seq_id = axis2_array_list_get(sender->working_seqs, env, 
+            sender->seq_index++);
         transaction = sandesha2_storage_mgr_get_transaction(storage_mgr,
             env);
         mgr = sandesha2_storage_mgr_get_retrans_mgr(storage_mgr, env);
         seq_prop_mgr = sandesha2_storage_mgr_get_seq_property_mgr(
             storage_mgr, env);
-        sender_bean = sandesha2_sender_mgr_get_next_msg_to_send(mgr, env);
+        sender_bean = sandesha2_sender_mgr_get_next_msg_to_send(mgr, env, seq_id);
         if(!sender_bean)
         {
             sandesha2_transaction_commit(transaction, env);
-            count++;
-            if (count > 5)
-                break;
             continue;
         }
         msg_id = sandesha2_sender_bean_get_msg_id((sandesha2_rm_bean_t *) 
@@ -283,10 +296,18 @@
         sandesha2_transaction_commit(transaction, env);
         if(msg_id)
         {
+            axis2_bool_t status = AXIS2_TRUE;
             /* Start a sender worker which will work on this message */
             sender_worker = sandesha2_sender_worker_create(env, sender->conf_ctx, 
                 msg_id);
             sandesha2_sender_worker_run(sender_worker, env);
+            AXIS2_SLEEP(SANDESHA2_SENDER_SLEEP_TIME * 2); 
+            status = sandesha2_sender_worker_get_status(
+                sender_worker, env);
+            if(!status)
+            {
+                sandesha2_sender_stop_sender_for_seq(sender, env, seq_id);
+            }
         }
     }
     #ifdef AXIS2_SVR_MULTI_THREADED

Modified: webservices/sandesha/trunk/c/src/workers/sender_worker.c
URL: http://svn.apache.org/viewvc/webservices/sandesha/trunk/c/src/workers/sender_worker.c?view=diff&rev=514561&r1=514560&r2=514561
==============================================================================
--- webservices/sandesha/trunk/c/src/workers/sender_worker.c (original)
+++ webservices/sandesha/trunk/c/src/workers/sender_worker.c Sun Mar  4 22:06:56 2007
@@ -53,6 +53,7 @@
     axis2_char_t *msg_id;
     axis2_msg_ctx_t *msg_ctx;
     axis2_transport_out_desc_t *transport_out;
+    axis2_status_t status;
 };
 
 struct sandesha2_sender_worker_args
@@ -62,6 +63,11 @@
 };
 
 axis2_status_t AXIS2_CALL 
+sandesha2_sender_worker_get_status (
+    sandesha2_sender_worker_t *sender_worker,
+    const axis2_env_t *env);
+
+axis2_status_t AXIS2_CALL 
 sandesha2_sender_worker_run (
     sandesha2_sender_worker_t *sender_worker,
     const axis2_env_t *env);
@@ -83,10 +89,10 @@
     const axis2_env_t *env, 
     sandesha2_msg_ctx_t *rm_msg_ctx);
 
-/*axis2_status_t AXIS2_CALL
+static axis2_status_t AXIS2_CALL
 sandesha2_sender_worker_check_for_sync_res(
     const axis2_env_t *env, 
-    axis2_msg_ctx_t *msg_ctx);*/
+    axis2_msg_ctx_t *msg_ctx);
 
 static axis2_bool_t AXIS2_CALL
 sandesha2_sender_worker_is_fault_envelope(
@@ -123,6 +129,7 @@
     sender_worker->msg_id = AXIS2_STRDUP(msg_id, env);
     sender_worker->msg_ctx = NULL;
     sender_worker->transport_out = NULL;
+    sender_worker->status = AXIS2_FAILURE;
     
     sender_worker->mutex = axis2_thread_mutex_create(env->allocator,
                         AXIS2_THREAD_MUTEX_DEFAULT);
@@ -154,6 +161,7 @@
     sender_worker->msg_id = axis2_strdup(msg_id, env);
     sender_worker->msg_ctx = msg_ctx;
     sender_worker->transport_out = NULL;
+    sender_worker->status = AXIS2_FAILURE;
     
     sender_worker->mutex = axis2_thread_mutex_create(env->allocator,
                         AXIS2_THREAD_MUTEX_DEFAULT);
@@ -207,12 +215,13 @@
     AXIS2_LOG_INFO(env->log, "Start:sandesha2_sender_worker_run");
     AXIS2_ENV_CHECK(env, AXIS2_FAILURE);
     
+    sender_worker->status = AXIS2_TRUE;
     args = AXIS2_MALLOC(env->allocator, sizeof(sandesha2_sender_worker_args_t)); 
     args->impl = sender_worker;
     args->env = (axis2_env_t*)env;
 
     worker_thread = AXIS2_THREAD_POOL_GET_THREAD(env->thread_pool,
-                        sandesha2_sender_worker_worker_func, (void*)args);
+        sandesha2_sender_worker_worker_func, (void*)args);
     if(!worker_thread)
     {
         AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI, "[sandesha2]Thread creation "
@@ -273,6 +282,9 @@
     {
         printf("sender_worker_bean is NULL\n");
         sandesha2_transaction_rollback(transaction, env);
+        #ifdef AXIS2_SVR_MULTI_THREADED
+            AXIS2_THREAD_POOL_EXIT_THREAD(env->thread_pool, thd);
+        #endif
         return NULL;
     }
 
@@ -290,6 +302,9 @@
         sandesha2_transaction_rollback(transaction, env);
         AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI, "[sandesha2] msg_ctx is "
                     "not present in the store");
+        #ifdef AXIS2_SVR_MULTI_THREADED
+            AXIS2_THREAD_POOL_EXIT_THREAD(env->thread_pool, thd);
+        #endif
         return NULL;
     }
     property = axis2_msg_ctx_get_property(msg_ctx, env, 
@@ -305,12 +320,19 @@
     }
     continue_sending = sandesha2_msg_retrans_adjuster_adjust_retrans(env,
         sender_worker_bean, sender_worker->conf_ctx, storage_mgr);
+    sandesha2_sender_mgr_update(sender_mgr, env, sender_worker_bean);
     if(!continue_sending)
     {
         printf("do not continue\n");
-        sandesha2_transaction_rollback(transaction, env);
+        sender_worker->status = AXIS2_FAILURE;
+        /* We commit here since we have cleaned the
+         * sending side data and that need to commited */
+        sandesha2_transaction_commit(transaction, env);
         AXIS2_LOG_DEBUG(env->log, AXIS2_LOG_SI, 
             "[sandesha2] Do not continue sending the message");
+        #ifdef AXIS2_SVR_MULTI_THREADED
+            AXIS2_THREAD_POOL_EXIT_THREAD(env->thread_pool, thd);
+        #endif
         return NULL;
     }
     
@@ -325,6 +347,9 @@
         sandesha2_transaction_rollback(transaction, env);
         AXIS2_LOG_DEBUG(env->log, AXIS2_LOG_SI, 
             "[sandesha2] Message is not qualified for sending");
+        #ifdef AXIS2_SVR_MULTI_THREADED
+            AXIS2_THREAD_POOL_EXIT_THREAD(env->thread_pool, thd);
+        #endif
         return NULL;
     }
     rm_msg_ctx = sandesha2_msg_init_init_msg(env, msg_ctx);
@@ -360,6 +385,9 @@
             sandesha2_transaction_rollback(transaction, env);
             AXIS2_LOG_DEBUG(env->log, AXIS2_LOG_SI, "[sandesha2] Continue "\
                 "Sending is true. So returning from Sender Worker");
+            #ifdef AXIS2_SVR_MULTI_THREADED
+                AXIS2_THREAD_POOL_EXIT_THREAD(env->thread_pool, thd);
+            #endif
             return NULL;
         }
     }
@@ -438,9 +466,9 @@
         if(resend)
         {
             sandesha2_sender_bean_set_sent_count(bean1, env, 
-                    sandesha2_sender_bean_get_sent_count(sender_worker_bean, env));
+                sandesha2_sender_bean_get_sent_count(sender_worker_bean, env));
             sandesha2_sender_bean_set_time_to_send(bean1, env, 
-                    sandesha2_sender_bean_get_time_to_send(sender_worker_bean, env));
+                sandesha2_sender_bean_get_time_to_send(sender_worker_bean, env));
             sandesha2_sender_mgr_update(sender_mgr, env, bean1);
         }
         else
@@ -536,7 +564,7 @@
     return AXIS2_FALSE;
 }
 
-axis2_status_t AXIS2_CALL
+static axis2_status_t AXIS2_CALL
 sandesha2_sender_worker_check_for_sync_res(
     const axis2_env_t *env, 
     axis2_msg_ctx_t *msg_ctx)
@@ -563,9 +591,14 @@
      * Message Receiver (may be callback MR).
      */
     AXIS2_MSG_CTX_SET_SERVER_SIDE(res_msg_ctx, env, AXIS2_TRUE);
-    axis2_msg_ctx_set_property(res_msg_ctx, env, AXIS2_TRANSPORT_IN,
-        axis2_msg_ctx_get_property(msg_ctx, env, AXIS2_TRANSPORT_IN,
-        AXIS2_FALSE), AXIS2_FALSE);
+    property = axis2_msg_ctx_get_property(msg_ctx, env, AXIS2_TRANSPORT_IN, 
+        AXIS2_FALSE);
+    if(property)
+    {
+        axis2_property_t *temp_prop = axis2_property_clone(property, env);
+        axis2_msg_ctx_set_property(res_msg_ctx, env, AXIS2_TRANSPORT_IN, 
+            temp_prop, AXIS2_FALSE);
+    }
     AXIS2_MSG_CTX_SET_SVC_CTX(res_msg_ctx, env, AXIS2_MSG_CTX_GET_SVC_CTX(
         msg_ctx, env));
     AXIS2_MSG_CTX_SET_SVC_GRP_CTX(res_msg_ctx, env, 
@@ -598,10 +631,10 @@
          AXIOM_SOAP12_SOAP_ENVELOPE_NAMESPACE_URI;
 
     res_envelope = axis2_msg_ctx_get_response_soap_envelope(msg_ctx, env);
-    /*if(!res_envelope)
+    if(!res_envelope)
         res_envelope = axis2_http_transport_utils_create_soap_msg(env, msg_ctx,
             soap_ns_uri);
-    */
+    
     property = axis2_msg_ctx_get_property(msg_ctx, env, 
         SANDESHA2_WITHIN_TRANSACTION, AXIS2_FALSE);
     if(property)
@@ -613,7 +646,7 @@
     {
         axis2_engine_t *engine = NULL;
         AXIS2_MSG_CTX_SET_SOAP_ENVELOPE(res_msg_ctx, env, res_envelope);
-        
+       
         engine = axis2_engine_create(env, AXIS2_MSG_CTX_GET_CONF_CTX(msg_ctx, 
             env));
         if(AXIS2_TRUE == sandesha2_sender_worker_is_fault_envelope(env, 
@@ -650,6 +683,13 @@
     sender_worker->transport_out = transport_out;
 }
 
+axis2_status_t AXIS2_CALL 
+sandesha2_sender_worker_get_status (
+    sandesha2_sender_worker_t *sender_worker,
+    const axis2_env_t *env)
+{
+    return sender_worker->status;
+}
 
 
 



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