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

svn commit: r519880 - in /webservices/sandesha/trunk/c: config/ include/ samples/rm_echo_1_0/ samples/rm_echo_1_1/ samples/rm_echo_single_1_0/ samples/rm_echo_single_1_1/ samples/rm_mtom_1_0/ samples/rm_report/ src/handlers/ src/msgprocessors/ src/stor...

Author: damitha
Date: Mon Mar 19 01:50:56 2007
New Revision: 519880

URL: http://svn.apache.org/viewvc?view=rev&rev=519880
Log:
there was a conflict in accessing the dbconnection resource
from two mutexes, Namely from permanent_transaction.c and permanent_bean_mgr.c.
Fix this.

Modified:
    webservices/sandesha/trunk/c/config/axis2.xml
    webservices/sandesha/trunk/c/include/sandesha2_constants.h
    webservices/sandesha/trunk/c/include/sandesha2_permanent_storage_mgr.h
    webservices/sandesha/trunk/c/samples/rm_echo_1_0/rm_echo.c
    webservices/sandesha/trunk/c/samples/rm_echo_1_1/rm_echo_1_1.c
    webservices/sandesha/trunk/c/samples/rm_echo_single_1_0/rm_echo_single.c
    webservices/sandesha/trunk/c/samples/rm_echo_single_1_1/rm_echo_single_1_1.c
    webservices/sandesha/trunk/c/samples/rm_mtom_1_0/rm_mtom_1_0.c
    webservices/sandesha/trunk/c/samples/rm_report/report.c
    webservices/sandesha/trunk/c/src/handlers/sandesha2_global_in_handler.c
    webservices/sandesha/trunk/c/src/msgprocessors/app_msg_processor.c
    webservices/sandesha/trunk/c/src/storage/permanent/permanent_bean_mgr.c
    webservices/sandesha/trunk/c/src/storage/permanent/permanent_storage_mgr.c
    webservices/sandesha/trunk/c/src/storage/permanent/permanent_transaction.c

Modified: webservices/sandesha/trunk/c/config/axis2.xml
URL: http://svn.apache.org/viewvc/webservices/sandesha/trunk/c/config/axis2.xml?view=diff&rev=519880&r1=519879&r2=519880
==============================================================================
--- webservices/sandesha/trunk/c/config/axis2.xml (original)
+++ webservices/sandesha/trunk/c/config/axis2.xml Mon Mar 19 01:50:56 2007
@@ -30,7 +30,7 @@
     <!-- Transport Ins -->
     <!-- ================================================= -->
     <transportReceiver name="http" class="axis2_http_receiver">
-        <parameter name="port" locked="false">6666</parameter>
+        <parameter name="port" locked="false">9999</parameter>
     </transportReceiver>
 
     <!-- Uncomment this one with the appropriate papameters to enable the SMTP transport Receiver
@@ -44,7 +44,7 @@
     
     <!--
     <transportReceiver name="tcp" class="org.apache.axis2.transport.tcp.TCPServer">
-        <parameter name="port" locked="false">6666</parameter>
+        <parameter name="port" locked="false">9999</parameter>
     </transportReceiver>
     -->
     <!-- ================================================= -->

Modified: webservices/sandesha/trunk/c/include/sandesha2_constants.h
URL: http://svn.apache.org/viewvc/webservices/sandesha/trunk/c/include/sandesha2_constants.h?view=diff&rev=519880&r1=519879&r2=519880
==============================================================================
--- webservices/sandesha/trunk/c/include/sandesha2_constants.h (original)
+++ webservices/sandesha/trunk/c/include/sandesha2_constants.h Mon Mar 19 01:50:56 2007
@@ -46,6 +46,8 @@
 
 	#define SANDESHA2_SPEC_2005_02_ACTION_TERMINATE_SEQ  "http://schemas.xmlsoap.org/ws/2005/02/rm/TerminateSequence"
 
+	#define SANDESHA2_SPEC_2005_02_ACTION_LAST_MESSAGE  "http://schemas.xmlsoap.org/ws/2005/02/rm/LastMessage"
+
 	#define SANDESHA2_SPEC_2005_02_SOAP_ACTION_CREATE_SEQ  "http://schemas.xmlsoap.org/ws/2005/02/rm/CreateSequence"
 
 	#define SANDESHA2_SPEC_2005_02_SOAP_ACTION_CREATE_SEQ_RESPONSE  "http://schemas.xmlsoap.org/ws/2005/02/rm/CreateSequenceResponse"
@@ -53,6 +55,8 @@
 	#define SANDESHA2_SPEC_2005_02_SOAP_ACTION_SEQ_ACKNOWLEDGEMENT  "http://schemas.xmlsoap.org/ws/2005/02/rm/SequenceAcknowledgement"
 
 	#define SANDESHA2_SPEC_2005_02_SOAP_ACTION_TERMINATE_SEQ  "http://schemas.xmlsoap.org/ws/2005/02/rm/TerminateSequence"
+
+	#define SANDESHA2_SPEC_2005_02_SOAP_ACTION_LAST_MESSAGE  "http://schemas.xmlsoap.org/ws/2005/02/rm/LastMessage"
 	
 	/**
 	 * Spec 2005-10

Modified: webservices/sandesha/trunk/c/include/sandesha2_permanent_storage_mgr.h
URL: http://svn.apache.org/viewvc/webservices/sandesha/trunk/c/include/sandesha2_permanent_storage_mgr.h?view=diff&rev=519880&r1=519879&r2=519880
==============================================================================
--- webservices/sandesha/trunk/c/include/sandesha2_permanent_storage_mgr.h (original)
+++ webservices/sandesha/trunk/c/include/sandesha2_permanent_storage_mgr.h Mon Mar 19 01:50:56 2007
@@ -44,6 +44,11 @@
  * @{
  */
 
+axis2_thread_mutex_t *
+sandesha2_permanent_storage_mgr_get_mutex(
+    sandesha2_storage_mgr_t *storage_mgr, 
+    const axis2_env_t *env);
+
 AXIS2_EXTERN sandesha2_storage_mgr_t* AXIS2_CALL
 sandesha2_permanent_storage_mgr_create(
     const axis2_env_t *env, 

Modified: webservices/sandesha/trunk/c/samples/rm_echo_1_0/rm_echo.c
URL: http://svn.apache.org/viewvc/webservices/sandesha/trunk/c/samples/rm_echo_1_0/rm_echo.c?view=diff&rev=519880&r1=519879&r2=519880
==============================================================================
--- webservices/sandesha/trunk/c/samples/rm_echo_1_0/rm_echo.c (original)
+++ webservices/sandesha/trunk/c/samples/rm_echo_1_0/rm_echo.c Mon Mar 19 01:50:56 2007
@@ -70,6 +70,7 @@
     axis2_callback_t *callback3 = NULL;
     axis2_property_t *property = NULL;
     axis2_listener_manager_t *listener_manager = NULL;
+    axis2_string_t *soap_action = NULL;
     int c;
    
     /* Set up the environment */
@@ -79,7 +80,7 @@
             AXIS2_LOG_LEVEL_CRITICAL);
 
     /* Set end point reference of echo service */
-    to = "http://127.0.0.1:5555/axis2/services/RMSampleService";
+    to = "http://127.0.0.1:8888/axis2/services/RMSampleService";
     while ((c = AXIS2_GETOPT(argc, argv, ":a:")) != -1)
     {
 
@@ -127,7 +128,9 @@
     /* Separate listner needs addressing, hence addressing stuff in options */
     /*AXIS2_OPTIONS_SET_ACTION(options, env,
         "http://127.0.0.1:5555/axis2/services/RMSampleService/anonOutInOp");*/
-    /*AXIS2_OPTIONS_SET_ACTION(options, env, "urn:wsrm:EchoString");*/
+    soap_action = axis2_string_create(env, "urn:wsrm:EchoString");
+    AXIS2_OPTIONS_SET_SOAP_ACTION(options, env, soap_action);
+    AXIS2_OPTIONS_SET_ACTION(options, env, "urn:wsrm:EchoString");
     reply_to = axis2_endpoint_ref_create(env, 
         "http://localhost:7777/axis2/services/__ANONYMOUS_SERVICE__/"\
             "__OPERATION_OUT_IN__");

Modified: webservices/sandesha/trunk/c/samples/rm_echo_1_1/rm_echo_1_1.c
URL: http://svn.apache.org/viewvc/webservices/sandesha/trunk/c/samples/rm_echo_1_1/rm_echo_1_1.c?view=diff&rev=519880&r1=519879&r2=519880
==============================================================================
--- webservices/sandesha/trunk/c/samples/rm_echo_1_1/rm_echo_1_1.c (original)
+++ webservices/sandesha/trunk/c/samples/rm_echo_1_1/rm_echo_1_1.c Mon Mar 19 01:50:56 2007
@@ -81,7 +81,7 @@
             AXIS2_LOG_LEVEL_CRITICAL);
 
     /* Set end point reference of echo service */
-    address = "http://127.0.0.1:5555/axis2/services/RMSampleService";
+    address = "http://127.0.0.1:8888/axis2/services/RMSampleService";
     while ((c = AXIS2_GETOPT(argc, argv, ":a:o:")) != -1)
     {
 
@@ -318,7 +318,7 @@
     fprintf(stdout, "\t-o OFFER \t seq offer value.. Type 1 for sequence offer" \
         "feature. The default behaviour is no offer(0). \n");
     fprintf(stdout, "\t-a ADDRESS \t endpoint address.. The" \
-        " default is http://127.0.0.1:5555/axis2/services/RMSampleService \n");
+        " default is http://127.0.0.1:8888/axis2/services/RMSampleService \n");
     fprintf(stdout, " Help :\n\t-h \t display this help screen.\n\n");
 }
 

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=519880&r1=519879&r2=519880
==============================================================================
--- 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 Mon Mar 19 01:50:56 2007
@@ -70,6 +70,7 @@
     axis2_listener_manager_t *listener_manager = NULL;
     axis2_char_t *offered_seq_id = NULL;
     axiom_soap_envelope_t *result = NULL;
+    axis2_string_t *soap_action = NULL;
     int c;
     int i = 0, size = 0;
    
@@ -82,8 +83,7 @@
             AXIS2_LOG_LEVEL_DEBUG);
 
     /* Set end point reference of echo service */
-    /*address = "http://127.0.0.1:8888/axis2/services/RMSampleService";*/
-    address = "http://127.0.0.1:5555/axis2/services/RMSampleService";
+    address = "http://127.0.0.1:8888/axis2/services/RMSampleService";
     while ((c = AXIS2_GETOPT(argc, argv, ":a:")) != -1)
     {
 
@@ -119,8 +119,11 @@
     AXIS2_OPTIONS_SET_TO(options, env, endpoint_ref);
     
     /* 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_ACTION(options, env,
+        "http://127.0.0.1:8080/axis2/services/RMSampleService/anonOutInOp");*/
+    soap_action = axis2_string_create(env, "urn:wsrm:EchoString");
+    AXIS2_OPTIONS_SET_SOAP_ACTION(options, env, soap_action);
+    AXIS2_OPTIONS_SET_ACTION(options, env, "urn:wsrm:EchoString");
     reply_to = axis2_endpoint_ref_create(env, AXIS2_WSA_ANONYMOUS_URL);
     /*AXIS2_OPTIONS_SET_REPLY_TO(options, env, reply_to);*/
 
@@ -358,7 +361,7 @@
     fprintf(stdout, " [-a ADDRESS]");
     fprintf(stdout, " Options :\n");
     fprintf(stdout, "\t-a ADDRESS \t endpoint address.. The" \
-        " default is http://127.0.0.1:5555/axis2/services/RMSampleService \n");
+        " default is http://127.0.0.1:8888/axis2/services/RMSampleService \n");
     fprintf(stdout, " Help :\n\t-h \t display this help screen.\n\n");
 }
 

Modified: webservices/sandesha/trunk/c/samples/rm_echo_single_1_1/rm_echo_single_1_1.c
URL: http://svn.apache.org/viewvc/webservices/sandesha/trunk/c/samples/rm_echo_single_1_1/rm_echo_single_1_1.c?view=diff&rev=519880&r1=519879&r2=519880
==============================================================================
--- webservices/sandesha/trunk/c/samples/rm_echo_single_1_1/rm_echo_single_1_1.c (original)
+++ webservices/sandesha/trunk/c/samples/rm_echo_single_1_1/rm_echo_single_1_1.c Mon Mar 19 01:50:56 2007
@@ -76,7 +76,7 @@
 
     /* Set end point reference of echo service */
     /*address = "http://127.0.0.1:8888/axis2/services/RMSampleService";*/
-    address = "http://127.0.0.1:5555/axis2/services/RMSampleService";
+    address = "http://127.0.0.1:8888/axis2/services/RMSampleService";
     while ((c = AXIS2_GETOPT(argc, argv, ":a:")) != -1)
     {
 
@@ -298,7 +298,7 @@
     fprintf(stdout, " [-a ADDRESS]");
     fprintf(stdout, " Options :\n");
     fprintf(stdout, "\t-a ADDRESS \t endpoint address.. The" \
-        " default is http://127.0.0.1:5555/axis2/services/RMSampleService \n");
+        " default is http://127.0.0.1:8888/axis2/services/RMSampleService \n");
     fprintf(stdout, " Help :\n\t-h \t display this help screen.\n\n");
 }
 

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=519880&r1=519879&r2=519880
==============================================================================
--- 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 Mon Mar 19 01:50:56 2007
@@ -58,7 +58,7 @@
 
     /* Set end point reference of echo service */
     /*address = "http://127.0.0.1:8888/axis2/services/RMSampleService";*/
-    address = "http://127.0.0.1:5555/axis2/services/RMSampleService";
+    address = "http://127.0.0.1:8888/axis2/services/RMSampleService";
     while ((c = AXIS2_GETOPT(argc, argv, ":a:")) != -1)
     {
 
@@ -235,7 +235,7 @@
     fprintf(stdout, " [-o ADDRESS]");
     fprintf(stdout, " Options :\n");
     fprintf(stdout, "\t-o ADDRESS \t endpoint address.. The"
-        " default is http://127.0.0.1:5555/axis2/services/RMSampleService ../\n");
+        " default is http://127.0.0.1:8888/axis2/services/RMSampleService ../\n");
     fprintf(stdout, " Help :\n\t-h \t display this help screen.\n\n");
 }
 

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=519880&r1=519879&r2=519880
==============================================================================
--- webservices/sandesha/trunk/c/samples/rm_report/report.c (original)
+++ webservices/sandesha/trunk/c/samples/rm_report/report.c Mon Mar 19 01:50:56 2007
@@ -85,7 +85,7 @@
 
     /* Set end point reference of report service */
     /*address = "http://127.0.0.1:8888/axis2/services/RMSampleService";*/
-    address = "http://127.0.0.1:5555/axis2/services/RMSampleService";
+    address = "http://127.0.0.1:8888/axis2/services/RMSampleService";
     while ((c = AXIS2_GETOPT(argc, argv, ":a:")) != -1)
     {
 
@@ -362,7 +362,7 @@
     fprintf(stdout, " [-a ADDRESS]");
     fprintf(stdout, " Options :\n");
     fprintf(stdout, "\t-a ADDRESS \t endpoint address.. The" \
-        " default is http://127.0.0.1:5555/axis2/services/RMSampleService \n");
+        " default is http://127.0.0.1:8888/axis2/services/RMSampleService \n");
     fprintf(stdout, " Help :\n\t-h \t display this help screen.\n\n");
 }
 

Modified: webservices/sandesha/trunk/c/src/handlers/sandesha2_global_in_handler.c
URL: http://svn.apache.org/viewvc/webservices/sandesha/trunk/c/src/handlers/sandesha2_global_in_handler.c?view=diff&rev=519880&r1=519879&r2=519880
==============================================================================
--- webservices/sandesha/trunk/c/src/handlers/sandesha2_global_in_handler.c (original)
+++ webservices/sandesha/trunk/c/src/handlers/sandesha2_global_in_handler.c Mon Mar 19 01:50:56 2007
@@ -22,7 +22,9 @@
 #include <axis2_property.h>
 #include <axis2_const.h>
 #include <axis2_conf_ctx.h>
+#include <axiom_soap_header.h>
 #include <sandesha2_storage_mgr.h>
+#include <sandesha2_seq.h>
 #include <sandesha2_msg_ctx.h>
 #include <sandesha2_transaction.h>
 #include <sandesha2_msg_processor.h>
@@ -105,19 +107,75 @@
     axis2_char_t *within_transaction_str = NULL;
     axiom_soap_fault_t *fault_part = NULL;
     axis2_char_t *reinjected_msg = AXIS2_FALSE;
+    const axis2_string_t *str_soap_action = NULL;
+    const axis2_char_t *wsa_action = NULL;
+    const axis2_char_t *soap_action = NULL;
     axis2_bool_t is_rm_global_msg = AXIS2_FALSE;
     sandesha2_msg_ctx_t *rm_msg_ctx = NULL;
     axis2_bool_t dropped = AXIS2_FALSE;
+    axis2_bool_t isolated_last_msg = AXIS2_FALSE;
     sandesha2_storage_mgr_t *storage_mgr = NULL;
     sandesha2_transaction_t *transaction = NULL;
     axis2_property_t *property = NULL;
     axis2_bool_t rolled_back = AXIS2_FALSE;
-    
     AXIS2_ENV_CHECK( env, AXIS2_FAILURE);
     AXIS2_PARAM_CHECK(env->error, msg_ctx, AXIS2_FAILURE);
    
     AXIS2_LOG_INFO(env->log, 
         "[sandesha2]Starting sandesha2 global in handler ......");
+   /* This handler needs to identify messages which follow the WSRM 1.0 
+    * convention for sending 'LastMessage' when the sender doesn't have a 
+    * reliable message to piggyback the last message marker onto.
+    * Normally they will identify this scenario with an action marker, but if
+    * there is no action at all then we have to check the soap body.
+    * Either way, all that this handler need do is set the action back onto
+    * the message, so that the dispatchers can allow it to continue. The real
+    * processing will be done in the app_msg_processor.
+    */
+    str_soap_action = axis2_msg_ctx_get_soap_action(msg_ctx, env);
+    soap_action = axis2_string_get_buffer(str_soap_action, env);
+    wsa_action = axis2_msg_ctx_get_wsa_action(msg_ctx, env);
+    if(!soap_action && !wsa_action)
+    {
+        axiom_soap_envelope_t *envelope = NULL;
+        printf("Look for a WSRM 1.0 sequence header with the lastMessage marker\n");
+        envelope = axis2_msg_ctx_get_soap_envelope(msg_ctx, env);
+        if(envelope)
+        {
+            axis2_bool_t last_msg_header = AXIS2_FALSE;
+            axiom_soap_header_t *header = NULL;
+            header = axiom_soap_envelope_get_header(envelope, env);
+            if(header)
+            {
+                sandesha2_seq_t *sequence = NULL;
+                sequence = sandesha2_seq_create(env, SANDESHA2_SPEC_2005_02_NS_URI);
+                sandesha2_iom_rm_element_from_om_node((sandesha2_iom_rm_element_t *) 
+                    sequence, env, header);
+                if(sandesha2_seq_get_last_msg(sequence, env))
+                    last_msg_header = AXIS2_TRUE;
+                 
+            }
+            if(last_msg_header)
+            {
+                axiom_soap_body_t *body = NULL;
+                axiom_node_t *body_node = NULL;
+                body = axiom_soap_envelope_get_body(envelope, env);
+                body_node = axiom_soap_body_get_base_node(body, env);
+                if(body && !axiom_node_get_first_element(body_node, env))
+                {
+                    /* There is an empty body so we know this is the kind of message
+                     * that we are looking for.
+                     */
+                    AXIS2_LOG_DEBUG(env->log, AXIS2_LOG_SI, 
+                        "Setting SOAP Action for a WSRM 1.0 last message");
+                    axis2_msg_ctx_set_soap_action(msg_ctx, env, 
+                        SANDESHA2_SPEC_2005_02_SOAP_ACTION_LAST_MESSAGE);
+                    isolated_last_msg = AXIS2_TRUE;
+                }
+            }
+        }
+        return AXIS2_SUCCESS;
+    }
     is_rm_global_msg = sandesha2_utils_is_rm_global_msg(env, msg_ctx);
     if(!is_rm_global_msg)
     {
@@ -230,10 +288,10 @@
             }
         }
     }
-    
     rm_msg_ctx = sandesha2_msg_init_init_msg(env, msg_ctx);
-    dropped = sandesha2_global_in_handler_drop_if_duplicate(handler, env, 
-                        rm_msg_ctx, storage_mgr);
+    if(!isolated_last_msg)
+        dropped = sandesha2_global_in_handler_drop_if_duplicate(handler, env, 
+            rm_msg_ctx, storage_mgr);
     if(dropped)
     {
         if(!within_transaction)
@@ -245,7 +303,6 @@
             axis2_ctx_set_property(ctx, env, SANDESHA2_WITHIN_TRANSACTION, 
                 prop, AXIS2_FALSE);
             rolled_back = AXIS2_TRUE;
-            
         }
         sandesha2_global_in_handler_process_dropped_msg(handler, env, rm_msg_ctx,
                         storage_mgr);
@@ -290,14 +347,14 @@
     AXIS2_PARAM_CHECK(env->error, storage_mgr, AXIS2_FALSE);
     
     if(SANDESHA2_MSG_TYPE_APPLICATION == sandesha2_msg_ctx_get_msg_type(
-                        rm_msg_ctx, env))
+        rm_msg_ctx, env))
     {
         sandesha2_seq_t *sequence = NULL;
         long msg_no = -1;
         axis2_char_t *seq_id = NULL;
         
         sequence = (sandesha2_seq_t*)sandesha2_msg_ctx_get_msg_part(rm_msg_ctx, 
-                        env, SANDESHA2_MSG_PART_SEQ);
+            env, SANDESHA2_MSG_PART_SEQ);
         if(sequence)
         {
             seq_id = sandesha2_identifier_get_identifier(
@@ -344,14 +401,13 @@
                 axiom_children_iterator_t *children_iterator = NULL;
                 axis2_bool_t empty_body = AXIS2_FALSE;
             
-            
                 soap_body = AXIOM_SOAP_ENVELOPE_GET_BODY(
-                        sandesha2_msg_ctx_get_soap_envelope(rm_msg_ctx, env), 
-                        env);
+                    sandesha2_msg_ctx_get_soap_envelope(rm_msg_ctx, env), 
+                    env);
                 body_node = AXIOM_SOAP_BODY_GET_BASE_NODE(soap_body, env);
                 body_element = AXIOM_NODE_GET_DATA_ELEMENT(body_node, env);
                 children_iterator = axiom_element_get_children(body_element, env, 
-                        body_node);
+                    body_node);
                 if(!axiom_children_iterator_has_next(children_iterator, env))
                     empty_body = AXIS2_TRUE;
                 if(empty_body)
@@ -391,8 +447,9 @@
                 }
             }
         }        
-    } else if(SANDESHA2_MSG_TYPE_UNKNOWN == sandesha2_msg_ctx_get_msg_type(
-                        rm_msg_ctx, env))
+    } 
+    else if(SANDESHA2_MSG_TYPE_UNKNOWN == sandesha2_msg_ctx_get_msg_type(
+        rm_msg_ctx, env))
     {
         axis2_relates_to_t *relates_to = NULL;
         axis2_conf_ctx_t *conf_ctx = NULL;
@@ -447,10 +504,10 @@
         axis2_char_t *seq_id = NULL;
         
         sequence = (sandesha2_seq_t*)sandesha2_msg_ctx_get_msg_part(rm_msg_ctx, 
-                        env, SANDESHA2_MSG_PART_SEQ);
+            env, SANDESHA2_MSG_PART_SEQ);
         if(sequence)
             seq_id = sandesha2_identifier_get_identifier(
-                        sandesha2_seq_get_identifier(sequence, env), env);
+                sandesha2_seq_get_identifier(sequence, env), env);
             
         if(seq_id)
         {
@@ -460,15 +517,17 @@
             sandesha2_msg_processor_t *app_msg_processor = NULL;
             
             seq_prop_mgr = sandesha2_storage_mgr_get_seq_property_mgr(
-                        storage_mgr, env);
+                storage_mgr, env);
             rcvd_msgs_bean = sandesha2_seq_property_mgr_retrieve(seq_prop_mgr,
-                        env, seq_id, 
-                        SANDESHA2_SEQ_PROP_SERVER_COMPLETED_MESSAGES);
-            rcvd_msgs_str = sandesha2_seq_property_bean_get_value(
-                        rcvd_msgs_bean, env);
-            app_msg_processor = sandesha2_app_msg_processor_create(env);
-            sandesha2_app_msg_processor_send_ack_if_reqd(env, rm_msg_ctx, 
+                env, seq_id, SANDESHA2_SEQ_PROP_SERVER_COMPLETED_MESSAGES);
+            if(rcvd_msgs_bean)
+            {
+                rcvd_msgs_str = sandesha2_seq_property_bean_get_value(
+                    rcvd_msgs_bean, env);
+                app_msg_processor = sandesha2_app_msg_processor_create(env);
+                sandesha2_app_msg_processor_send_ack_if_reqd(env, rm_msg_ctx, 
                     rcvd_msgs_str, storage_mgr);
+            }
             
         }
     }

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=519880&r1=519879&r2=519880
==============================================================================
--- webservices/sandesha/trunk/c/src/msgprocessors/app_msg_processor.c (original)
+++ webservices/sandesha/trunk/c/src/msgprocessors/app_msg_processor.c Mon Mar 19 01:50:56 2007
@@ -37,6 +37,10 @@
 #include <sandesha2_create_seq_bean.h>
 #include <sandesha2_sender_mgr.h>
 #include <sandesha2_sender_bean.h>
+#include <sandesha2_msg_init.h>
+#include <sandesha2_ack_mgr.h>
+#include <sandesha2_msg_creator.h>
+#include <sandesha2_client_constants.h>
 
 #include <axis2_const.h>
 #include <axis2_msg_ctx.h>
@@ -45,11 +49,7 @@
 #include <axis2_uuid_gen.h>
 #include <axis2_relates_to.h>
 #include <axiom_soap_const.h>
-#include <sandesha2_client_constants.h>
-#include <stdio.h>
-#include <sandesha2_msg_init.h>
-#include <sandesha2_ack_mgr.h>
-#include <sandesha2_msg_creator.h>
+#include <axiom_soap_body.h>
 
 /** 
  * @brief Application Message Processor struct impl
@@ -210,6 +210,9 @@
     axis2_endpoint_ref_t *to_epr = NULL;
     const axis2_char_t *reply_to_addr = NULL;
     const axis2_char_t *to_addr = NULL;
+    const axis2_string_t *str_soap_action = NULL;
+    const axis2_char_t *wsa_action = NULL;
+    const axis2_char_t *soap_action = NULL;
     axis2_char_t *rm_version = NULL;
     sandesha2_seq_property_bean_t *acks_to_bean = NULL;
     sandesha2_seq_property_bean_t *to_bean = NULL;
@@ -440,6 +443,37 @@
     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))
+    {
+        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);
+        if(last_msg)
+        {
+            sandesha2_seq_property_bean_t *seq_prop_bean = NULL;
+            seq_prop_bean = sandesha2_seq_property_bean_create_with_data(
+                env, str_seq_id, SANDESHA2_SEQ_PROP_LAST_IN_MESSAGE_ID, msg_id);
+            sandesha2_seq_property_mgr_insert(seq_prop_mgr, env, seq_prop_bean);
+        }
+    }
+    /* end test code */
+    /*
+     * If this message matches the WSRM 1.0 pattern for an empty last message (e.g.
+     * 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);
+    soap_action = axis2_string_get_buffer(str_soap_action, env);
+    wsa_action = axis2_msg_ctx_get_wsa_action(msg_ctx, env);
+    if(0 == axis2_strcmp(SANDESHA2_SPEC_2005_02_ACTION_LAST_MESSAGE, 
+        wsa_action) || 0 == axis2_strcmp(
+        SANDESHA2_SPEC_2005_02_SOAP_ACTION_LAST_MESSAGE, soap_action)) 
+    {
+        AXIS2_LOG_DEBUG(env->log, AXIS2_LOG_SI, "Exit: app_msg_processor"\
+            "::process_in_msg, got WSRM 1.0 last message, aborting");
+        sandesha2_msg_ctx_set_paused(rm_msg_ctx, env, AXIS2_TRUE);
+        return AXIS2_SUCCESS;
+    }
     if(axis2_msg_ctx_get_server_side(msg_ctx, env) && in_order_invoke)
     {
         sandesha2_seq_property_bean_t *incoming_seq_list_bean = NULL;
@@ -448,8 +482,8 @@
         axis2_property_t *property = NULL;
 
         incoming_seq_list_bean = sandesha2_seq_property_mgr_retrieve(
-                        seq_prop_mgr, env, SANDESHA2_SEQ_PROP_ALL_SEQS,
-                        SANDESHA2_SEQ_PROP_INCOMING_SEQ_LIST);
+            seq_prop_mgr, env, SANDESHA2_SEQ_PROP_ALL_SEQS,
+            SANDESHA2_SEQ_PROP_INCOMING_SEQ_LIST);
         if(!incoming_seq_list_bean)
         {
             /**
@@ -553,20 +587,6 @@
         sandesha2_app_msg_processor_send_ack_if_reqd(env, rm_msg_ctx, msgs_str, 
             storage_mgr);
     }
-    /* test code */
-    if(axis2_msg_ctx_get_server_side(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);
-        if(last_msg)
-        {
-            sandesha2_seq_property_bean_t *seq_prop_bean = NULL;
-            seq_prop_bean = sandesha2_seq_property_bean_create_with_data(
-                env, str_seq_id, SANDESHA2_SEQ_PROP_LAST_IN_MESSAGE_ID, msg_id);
-            sandesha2_seq_property_mgr_insert(seq_prop_mgr, env, seq_prop_bean);
-        }
-    }
-    /* end test code */
     AXIS2_LOG_INFO(env->log, 
         "[sandesha2] Exit: sandesha2_app_msg_processor_process_in_msg");
 
@@ -775,7 +795,6 @@
     if(!dummy_msg)
         sandesha2_app_msg_processor_set_next_msg_no(env, internal_seq_id, 
             msg_number, storage_mgr);
-    
     sprintf(msg_number_str, "%ld", msg_number); 
     res_highest_msg_bean = sandesha2_seq_property_bean_create_with_data(env,
         internal_seq_id, SANDESHA2_SEQ_PROP_HIGHEST_OUT_MSG_NUMBER, 
@@ -995,7 +1014,7 @@
     
     if(!dummy_msg)
         sandesha2_app_msg_processor_process_response_msg(env, rm_msg_ctx, 
-                internal_seq_id, msg_number, storage_key, storage_mgr);
+            internal_seq_id, msg_number, storage_key, storage_mgr);
     /*if(1 < msg_number && !axis2_msg_ctx_get_server_side(msg_ctx, env))
     {
         return AXIS2_SUCCESS;

Modified: webservices/sandesha/trunk/c/src/storage/permanent/permanent_bean_mgr.c
URL: http://svn.apache.org/viewvc/webservices/sandesha/trunk/c/src/storage/permanent/permanent_bean_mgr.c?view=diff&rev=519880&r1=519879&r2=519880
==============================================================================
--- webservices/sandesha/trunk/c/src/storage/permanent/permanent_bean_mgr.c (original)
+++ webservices/sandesha/trunk/c/src/storage/permanent/permanent_bean_mgr.c Mon Mar 19 01:50:56 2007
@@ -207,15 +207,7 @@
         sizeof(sandesha2_permanent_bean_mgr_impl_t));
 
     bean_mgr_impl->storage_mgr = storage_mgr;
-    bean_mgr_impl->mutex = NULL;
-
-    bean_mgr_impl->mutex = axis2_thread_mutex_create(env->allocator, 
-        AXIS2_THREAD_MUTEX_DEFAULT);
-    if(!bean_mgr_impl->mutex) 
-    {
-        sandesha2_permanent_bean_mgr_free(&(bean_mgr_impl->bean_mgr), env);
-        return NULL;
-    }
+    bean_mgr_impl->mutex = sandesha2_permanent_storage_mgr_get_mutex(storage_mgr, env);
     return &(bean_mgr_impl->bean_mgr);
 }
 
@@ -229,11 +221,6 @@
         "[sandesha2]Start:sandesha2_permanent_bean_mgr_free_impl");
     bean_mgr_impl = SANDESHA2_INTF_TO_IMPL(bean_mgr);
 
-    if(bean_mgr_impl->mutex)
-    {
-        axis2_thread_mutex_destroy(bean_mgr_impl->mutex);
-        bean_mgr_impl->mutex = NULL;
-    }
     if(bean_mgr_impl)
     {
         AXIS2_FREE(env->allocator, bean_mgr_impl);
@@ -834,7 +821,10 @@
     dbconn = (sqlite3 *) sandesha2_permanent_storage_mgr_get_dbconn(
         bean_mgr_impl->storage_mgr, env);
     if(!dbconn)
+    {
+        axis2_thread_mutex_unlock(bean_mgr_impl->mutex);
         return AXIS2_FALSE;
+    }
 
     args = AXIS2_MALLOC(env->allocator, sizeof(sandesha2_bean_mgr_args_t));
     args->env = env;
@@ -1176,15 +1166,17 @@
 {
     int counter = 0;
     printf("in busy handler1\n");
-    while(rc == SQLITE_BUSY && counter < 32)
+    while(rc == SQLITE_BUSY && counter < 512)
     {
-        printf("in busy handler2\n");
+        printf("in busy handler11\n");
         if(*error_msg)
              sqlite3_free(*error_msg);
         counter++;
-        AXIS2_SLEEP(SANDESHA2_BUSY_WAIT_TIME);
+        /*AXIS2_SLEEP(SANDESHA2_BUSY_WAIT_TIME);*/
+        usleep(100000);
         rc = sqlite3_exec(dbconn, sql_stmt, callback_func, args, error_msg);
     }
+    printf("in busy handler2\n");
     return rc;
 }
 

Modified: webservices/sandesha/trunk/c/src/storage/permanent/permanent_storage_mgr.c
URL: http://svn.apache.org/viewvc/webservices/sandesha/trunk/c/src/storage/permanent/permanent_storage_mgr.c?view=diff&rev=519880&r1=519879&r2=519880
==============================================================================
--- webservices/sandesha/trunk/c/src/storage/permanent/permanent_storage_mgr.c (original)
+++ webservices/sandesha/trunk/c/src/storage/permanent/permanent_storage_mgr.c Mon Mar 19 01:50:56 2007
@@ -425,7 +425,6 @@
     axis2_char_t *thread_id_key = AXIS2_MALLOC(env->allocator, 128);
     storage_mgr_impl = SANDESHA2_INTF_TO_IMPL(storage_mgr);
 
-    axis2_thread_mutex_lock(storage_mgr_impl->mutex);
     thread_id = (unsigned long int) sandesha2_permanent_transaction_get_thread_id(
         transaction, env);
     sprintf(thread_id_key, "%lu", thread_id); 
@@ -433,7 +432,6 @@
     axis2_hash_set(storage_mgr_impl->transactions, thread_id_key, 
         AXIS2_HASH_KEY_STRING, NULL);
     axis2_allocator_switch_to_local_pool(env->allocator);
-    axis2_thread_mutex_unlock(storage_mgr_impl->mutex);
 }
 
 void AXIS2_CALL
@@ -1279,5 +1277,15 @@
     storage_mgr_impl = SANDESHA2_INTF_TO_IMPL(storage_mgr);
     return sandesha2_permanent_bean_mgr_remove_response(
         storage_mgr_impl->bean_mgr, env, seq_id, msg_no);
+}
+
+axis2_thread_mutex_t *
+sandesha2_permanent_storage_mgr_get_mutex(
+    sandesha2_storage_mgr_t *storage_mgr, 
+    const axis2_env_t *env)
+{
+    sandesha2_permanent_storage_mgr_t *storage_mgr_impl = NULL;
+    storage_mgr_impl = SANDESHA2_INTF_TO_IMPL(storage_mgr);
+    return storage_mgr_impl->mutex;
 }
 

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=519880&r1=519879&r2=519880
==============================================================================
--- webservices/sandesha/trunk/c/src/storage/permanent/permanent_transaction.c (original)
+++ webservices/sandesha/trunk/c/src/storage/permanent/permanent_transaction.c Mon Mar 19 01:50:56 2007
@@ -53,6 +53,15 @@
 #define SANDESHA2_INTF_TO_IMPL(trans) \
     ((sandesha2_permanent_transaction_impl_t *) trans)
 
+int
+sandesha2_permanent_transaction_busy_handler(
+    sqlite3* dbconn,
+    char *sql_stmt,
+    int (*callback_func)(void *, int, char **, char **),
+    void *args,
+    char **error_msg,
+    int rc);
+
 axis2_status_t AXIS2_CALL
 sandesha2_permanent_transaction_free(
     sandesha2_transaction_t *trans,
@@ -114,8 +123,7 @@
     trans_impl->thread_id = thread_id;
     trans_impl->dbconn = NULL;
     trans_impl->enlisted_beans = axis2_array_list_create(env, 0);
-    trans_impl->mutex = axis2_thread_mutex_create(env->allocator,
-        AXIS2_THREAD_MUTEX_DEFAULT);
+    trans_impl->mutex = sandesha2_permanent_storage_mgr_get_mutex(storage_mgr, env);
     trans_impl->trans.ops = &transaction_ops;
 	conf_ctx = (axis2_conf_ctx_t *) sandesha2_storage_mgr_get_ctx(
         storage_mgr, env);
@@ -155,7 +163,6 @@
         db_name = axis2_strcat(env, path, AXIS2_PATH_SEP_STR, 
             "sandesha2_client_db", NULL);
     }
-    /*AXIS2_LOG_INFO(env->log, "db_name %s", db_name);*/
     rc = sqlite3_open(db_name, &(trans_impl->dbconn));
     if(rc != SQLITE_OK)
     {
@@ -169,9 +176,8 @@
     rc = sqlite3_exec(trans_impl->dbconn, "BEGIN TRANSACTION;", 0, 0,
         &error_msg);
     if(rc == SQLITE_BUSY)
-        rc = sandesha2_permanent_bean_mgr_busy_handler(trans_impl->dbconn, 
+        rc = sandesha2_permanent_transaction_busy_handler(trans_impl->dbconn, 
             "BEGIN TRANSACTION", 0, 0, &error_msg, rc);
-    /*printf("came1:thread_id:%ld\n", thread_id);*/
     if(rc != SQLITE_OK )
     {
         AXIS2_ERROR_SET(env->error, SANDESHA2_ERROR_SQL_ERROR, AXIS2_FAILURE);
@@ -196,11 +202,6 @@
     AXIS2_ENV_CHECK(env, AXIS2_FAILURE);
     trans_impl = SANDESHA2_INTF_TO_IMPL(trans);
 
-    if(trans_impl->mutex)
-    {
-        axis2_thread_mutex_destroy(trans_impl->mutex);
-        trans_impl->mutex = NULL;
-    } 
     if(trans_impl->enlisted_beans)
     {
         axis2_array_list_free(trans_impl->enlisted_beans, env);
@@ -241,13 +242,6 @@
 {
     sandesha2_permanent_transaction_impl_t *trans_impl = NULL;
     trans_impl = SANDESHA2_INTF_TO_IMPL(trans);
-    /*int size = 0;
-    if(trans_impl->enlisted_beans)
-        size = axis2_array_list_size(trans_impl->enlisted_beans, env);
-    if(size > 0)
-        return AXIS2_TRUE;
-    else
-        return AXIS2_FALSE;*/
     return trans_impl->is_active;
 
 }
@@ -261,15 +255,17 @@
     int rc = -1;
     sandesha2_permanent_transaction_impl_t *trans_impl = NULL;
     trans_impl = SANDESHA2_INTF_TO_IMPL(trans);
-
+   
+    axis2_thread_mutex_lock(trans_impl->mutex);
     rc = sqlite3_exec(trans_impl->dbconn, "COMMIT TRANSACTION;", 0, 0, &error_msg);
-    /*unsigned long int thread_id = (unsigned long int) axis2_os_thread_current();
-    printf("came2:thread_id:%ld\n", thread_id);*/
     if(rc == SQLITE_BUSY)
-        rc = sandesha2_permanent_bean_mgr_busy_handler(trans_impl->dbconn, 
+    {
+        rc = sandesha2_permanent_transaction_busy_handler(trans_impl->dbconn, 
             "COMMIT TRANSACTION", 0, 0, &error_msg, rc);
+    }
     if(rc != SQLITE_OK )
     {
+        axis2_thread_mutex_unlock(trans_impl->mutex);
         AXIS2_ERROR_SET(env->error, SANDESHA2_ERROR_SQL_ERROR, AXIS2_FAILURE);
         AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI, "sql error %s",
             error_msg);
@@ -279,6 +275,7 @@
     sqlite3_close(trans_impl->dbconn);
     trans_impl->is_active = AXIS2_FALSE;
     sandesha2_permanent_transaction_release_locks(trans, env);
+    axis2_thread_mutex_unlock(trans_impl->mutex);
 }
 
 void AXIS2_CALL
@@ -290,15 +287,15 @@
     int rc = -1;
     sandesha2_permanent_transaction_impl_t *trans_impl = NULL;
     trans_impl = SANDESHA2_INTF_TO_IMPL(trans);
+    axis2_thread_mutex_lock(trans_impl->mutex);
     rc = sqlite3_exec(trans_impl->dbconn, "ROLLBACK TRANSACTION;", 0, 0,
         &error_msg);
-    /*unsigned long int thread_id = (unsigned long int) axis2_os_thread_current();
-    printf("came3:thread_id:%ld\n", thread_id);*/
     if(rc == SQLITE_BUSY)
-        rc = sandesha2_permanent_bean_mgr_busy_handler(trans_impl->dbconn, 
+        rc = sandesha2_permanent_transaction_busy_handler(trans_impl->dbconn, 
             "ROLLBACK TRANSACTION", 0, 0, &error_msg, rc);
     if(rc != SQLITE_OK )
     {
+        axis2_thread_mutex_unlock(trans_impl->mutex);
         AXIS2_ERROR_SET(env->error, SANDESHA2_ERROR_SQL_ERROR, AXIS2_FAILURE);
         AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI, "sql error %s",
             error_msg);
@@ -309,6 +306,7 @@
     sqlite3_close(trans_impl->dbconn);
     trans_impl->is_active = AXIS2_FALSE;
     sandesha2_permanent_transaction_release_locks(trans, env);
+    axis2_thread_mutex_unlock(trans_impl->mutex);
 }
 
 void AXIS2_CALL
@@ -330,9 +328,7 @@
         sandesha2_rm_bean_t *rm_bean = (sandesha2_rm_bean_t *) 
             axis2_array_list_get(trans_impl->enlisted_beans, env, i);
         rm_bean_l = sandesha2_rm_bean_get_base(rm_bean, env);
-        axis2_thread_mutex_lock(trans_impl->mutex);
         sandesha2_rm_bean_set_transaction(rm_bean_l, env, NULL);
-        axis2_thread_mutex_unlock(trans_impl->mutex);
     }
     /*axis2_array_list_free(trans_impl->enlisted_beans, env);
     trans_impl->enlisted_beans = NULL;*/
@@ -388,4 +384,30 @@
     AXIS2_LOG_INFO(env->log, 
         "[sandesha2]Exit:sandesha2_permanent_transaction_enlist");
 }
+
+int
+sandesha2_permanent_transaction_busy_handler(
+    sqlite3* dbconn,
+    char *sql_stmt,
+    int (*callback_func)(void *, int, char **, char **),
+    void *args,
+    char **error_msg,
+    int rc)
+{
+    int counter = 0;
+    printf("in busy handler3\n");
+    while(rc == SQLITE_BUSY && counter < 512)
+    {
+        printf("in busy handler33\n");
+        if(*error_msg)
+             sqlite3_free(*error_msg);
+        counter++;
+        /*AXIS2_SLEEP(SANDESHA2_BUSY_WAIT_TIME);*/
+        usleep(100000);
+        rc = sqlite3_exec(dbconn, sql_stmt, callback_func, args, error_msg);
+    }
+    printf("in busy handler4\n");
+    return rc;
+}
+
 



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