Author: damitha
Date: Mon May 26 21:00:50 2008
New Revision: 660362

URL: http://svn.apache.org/viewvc?rev=660362&view=rev
Log:
Sandesha2/C now send all messages in the same thread it is invoked.

Modified:
    
webservices/sandesha/tags/sandesha2/c/worker_thread_removed-23may2008/include/sandesha2_msg_ctx.h
    
webservices/sandesha/tags/sandesha2/c/worker_thread_removed-23may2008/src/core/sandesha2_msg_ctx.c
    
webservices/sandesha/tags/sandesha2/c/worker_thread_removed-23may2008/src/handlers/sandesha2_in_handler.c
    
webservices/sandesha/tags/sandesha2/c/worker_thread_removed-23may2008/src/msgprocessors/ack_msg_processor.c
    
webservices/sandesha/tags/sandesha2/c/worker_thread_removed-23may2008/src/msgprocessors/app_msg_processor.c
    
webservices/sandesha/tags/sandesha2/c/worker_thread_removed-23may2008/src/msgprocessors/create_seq_msg_processor.c
    
webservices/sandesha/tags/sandesha2/c/worker_thread_removed-23may2008/src/util/ack_mgr.c
    
webservices/sandesha/tags/sandesha2/c/worker_thread_removed-23may2008/src/util/terminate_mgr.c
    
webservices/sandesha/tags/sandesha2/c/worker_thread_removed-23may2008/src/workers/sender_worker.c

Modified: 
webservices/sandesha/tags/sandesha2/c/worker_thread_removed-23may2008/include/sandesha2_msg_ctx.h
URL: 
http://svn.apache.org/viewvc/webservices/sandesha/tags/sandesha2/c/worker_thread_removed-23may2008/include/sandesha2_msg_ctx.h?rev=660362&r1=660361&r2=660362&view=diff
==============================================================================
--- 
webservices/sandesha/tags/sandesha2/c/worker_thread_removed-23may2008/include/sandesha2_msg_ctx.h
 (original)
+++ 
webservices/sandesha/tags/sandesha2/c/worker_thread_removed-23may2008/include/sandesha2_msg_ctx.h
 Mon May 26 21:00:50 2008
@@ -388,6 +388,17 @@
     sandesha2_msg_ctx_t *rm_msg_ctx,
     const axutil_env_t *env);
 
+axis2_bool_t AXIS2_CALL
+sandesha2_msg_ctx_get_server_side(
+    const sandesha2_msg_ctx_t * rm_msg_ctx,
+    const axutil_env_t * env);
+
+axis2_status_t AXIS2_CALL
+sandesha2_msg_ctx_set_server_side(
+    const sandesha2_msg_ctx_t * rm_msg_ctx,
+    const axutil_env_t * env,
+    const axis2_bool_t server_side);
+
 /** @} */
 #ifdef __cplusplus
 }

Modified: 
webservices/sandesha/tags/sandesha2/c/worker_thread_removed-23may2008/src/core/sandesha2_msg_ctx.c
URL: 
http://svn.apache.org/viewvc/webservices/sandesha/tags/sandesha2/c/worker_thread_removed-23may2008/src/core/sandesha2_msg_ctx.c?rev=660362&r1=660361&r2=660362&view=diff
==============================================================================
--- 
webservices/sandesha/tags/sandesha2/c/worker_thread_removed-23may2008/src/core/sandesha2_msg_ctx.c
 (original)
+++ 
webservices/sandesha/tags/sandesha2/c/worker_thread_removed-23may2008/src/core/sandesha2_msg_ctx.c
 Mon May 26 21:00:50 2008
@@ -51,6 +51,7 @@
     sandesha2_terminate_seq_t *terminate_seq;
     sandesha2_terminate_seq_res_t *terminate_seq_res;
     sandesha2_ack_requested_t *ack_requested;
+    axis2_bool_t is_server_side;
 };
 
 AXIS2_EXTERN sandesha2_msg_ctx_t* AXIS2_CALL
@@ -86,6 +87,7 @@
     
     rm_msg_ctx->msg_type = SANDESHA2_MSG_TYPE_UNKNOWN;
     rm_msg_ctx->msg_ctx = msg_ctx;
+    rm_msg_ctx->is_server_side = AXIS2_FALSE;
 
        return rm_msg_ctx;
 }
@@ -832,3 +834,20 @@
     return rm_msg_ctx->ack_requested;
 }
 
+axis2_bool_t AXIS2_CALL
+sandesha2_msg_ctx_get_server_side(
+    const sandesha2_msg_ctx_t * rm_msg_ctx,
+    const axutil_env_t * env)
+{
+    return axis2_msg_ctx_get_server_side(rm_msg_ctx->msg_ctx, env);
+}
+
+axis2_status_t AXIS2_CALL
+sandesha2_msg_ctx_set_server_side(
+    const sandesha2_msg_ctx_t * rm_msg_ctx,
+    const axutil_env_t * env,
+    const axis2_bool_t server_side)
+{
+    return axis2_msg_ctx_set_server_side(rm_msg_ctx->msg_ctx, env, 
server_side);
+}
+

Modified: 
webservices/sandesha/tags/sandesha2/c/worker_thread_removed-23may2008/src/handlers/sandesha2_in_handler.c
URL: 
http://svn.apache.org/viewvc/webservices/sandesha/tags/sandesha2/c/worker_thread_removed-23may2008/src/handlers/sandesha2_in_handler.c?rev=660362&r1=660361&r2=660362&view=diff
==============================================================================
--- 
webservices/sandesha/tags/sandesha2/c/worker_thread_removed-23may2008/src/handlers/sandesha2_in_handler.c
 (original)
+++ 
webservices/sandesha/tags/sandesha2/c/worker_thread_removed-23may2008/src/handlers/sandesha2_in_handler.c
 Mon May 26 21:00:50 2008
@@ -304,7 +304,6 @@
                     temp = axutil_array_list_get(msg_no_list, env, i);
                     if(atol(temp) == msg_no)
                     {
-                        AXIS2_LOG_DEBUG(env->log, AXIS2_LOG_SI, 
"came4*************");
                         drop = AXIS2_TRUE;
                     }
                 }

Modified: 
webservices/sandesha/tags/sandesha2/c/worker_thread_removed-23may2008/src/msgprocessors/ack_msg_processor.c
URL: 
http://svn.apache.org/viewvc/webservices/sandesha/tags/sandesha2/c/worker_thread_removed-23may2008/src/msgprocessors/ack_msg_processor.c?rev=660362&r1=660361&r2=660362&view=diff
==============================================================================
--- 
webservices/sandesha/tags/sandesha2/c/worker_thread_removed-23may2008/src/msgprocessors/ack_msg_processor.c
 (original)
+++ 
webservices/sandesha/tags/sandesha2/c/worker_thread_removed-23may2008/src/msgprocessors/ack_msg_processor.c
 Mon May 26 21:00:50 2008
@@ -488,7 +488,8 @@
         AXIS2_FREE(env->allocator, int_seq_id);
     }
 
-    sandesha2_msg_ctx_set_paused(rm_msg_ctx, env, AXIS2_TRUE);
+    /*sandesha2_msg_ctx_set_paused(rm_msg_ctx, env, AXIS2_TRUE);*/
+
     if(seq_prop_mgr)
     {
         sandesha2_seq_property_mgr_free(seq_prop_mgr, env);

Modified: 
webservices/sandesha/tags/sandesha2/c/worker_thread_removed-23may2008/src/msgprocessors/app_msg_processor.c
URL: 
http://svn.apache.org/viewvc/webservices/sandesha/tags/sandesha2/c/worker_thread_removed-23may2008/src/msgprocessors/app_msg_processor.c?rev=660362&r1=660361&r2=660362&view=diff
==============================================================================
--- 
webservices/sandesha/tags/sandesha2/c/worker_thread_removed-23may2008/src/msgprocessors/app_msg_processor.c
 (original)
+++ 
webservices/sandesha/tags/sandesha2/c/worker_thread_removed-23may2008/src/msgprocessors/app_msg_processor.c
 Mon May 26 21:00:50 2008
@@ -1048,8 +1048,6 @@
 
         request_msg_no = 
sandesha2_msg_number_get_msg_num(sandesha2_seq_get_msg_num(req_seq, env), env);
         internal_seq_id = sandesha2_utils_get_outgoing_internal_seq_id(env, 
incoming_seq_id);
-        AXIS2_LOG_DEBUG(env->log, AXIS2_LOG_SI, "[sandesha2] 
dam_incoming_seq_id:%s", incoming_seq_id); 
-        AXIS2_LOG_DEBUG(env->log, AXIS2_LOG_SI, "[sandesha2] 
dam_int_seq_id3:%s", internal_seq_id); 
 
         /* Deciding whether this is the last message. We assume it is if it 
          * relates to a message which arrived with the LastMessage flag on it.
@@ -1261,7 +1259,6 @@
     out_seq_bean = sandesha2_seq_property_mgr_retrieve(seq_prop_mgr, env, 
internal_seq_id, 
             SANDESHA2_SEQ_PROP_OUT_SEQ_ID);
 
-    AXIS2_LOG_DEBUG(env->log, AXIS2_LOG_SI, "[sandesha2] dam_int_seq_id2:%s", 
internal_seq_id); 
     if(is_svr_side)
     {
         axis2_char_t *incoming_seq_id = NULL;
@@ -1587,12 +1584,9 @@
     int_seq_bean = sandesha2_seq_property_mgr_retrieve(seq_prop_mgr, env, 
seq_id, 
             SANDESHA2_SEQ_PROP_SPECIAL_INTERNAL_SEQ_ID);
 
-    /* Following code block send the ack messages through sender. If we 
comment this
-     * it will be sent directly avoiding the sender. We will enter this block 
only 
-     * in application client side when sequence offer is on.
-     */
-    if(int_seq_bean)
     {
+        const axis2_char_t *related_msg_id = NULL;
+        axis2_relates_to_t *relates_to = NULL;
         axis2_endpoint_ref_t *reply_to_epr = NULL;
         long send_time = -1;
         axis2_char_t *key = NULL;
@@ -1600,48 +1594,45 @@
         sandesha2_sender_bean_t *ack_bean = NULL;
         axis2_char_t *int_seq_id = NULL;
 
-        key = axutil_uuid_gen(env);
-        ack_bean = sandesha2_sender_bean_create(env);
-        sandesha2_sender_bean_set_msg_ctx_ref_key(ack_bean, env, key);
-        sandesha2_storage_mgr_store_msg_ctx(storage_mgr, env, key, 
ack_msg_ctx);
-        send_time = sandesha2_utils_get_current_time_in_millis(env);
-        sandesha2_sender_bean_set_time_to_send(ack_bean, env, send_time);
-        sandesha2_sender_bean_set_msg_id(ack_bean, env, 
sandesha2_msg_ctx_get_msg_id(ack_rm_msg, env));
-        sandesha2_sender_bean_set_send(ack_bean, env, AXIS2_TRUE);
-        int_seq_id = sandesha2_seq_property_bean_get_value(int_seq_bean, env);
-        sandesha2_sender_bean_set_internal_seq_id(ack_bean, env, int_seq_id);
-        sandesha2_sender_bean_set_seq_id(ack_bean, env, seq_id);
-        /*property = axutil_property_create_with_args(env, 0, 0, 0, 
AXIS2_VALUE_FALSE);
-        sandesha2_msg_ctx_set_property(ack_rm_msg, env, 
SANDESHA2_QUALIFIED_FOR_SENDING, property);*/
-        sandesha2_sender_bean_set_msg_type(ack_bean, env, 
SANDESHA2_MSG_TYPE_ACK);
-        sandesha2_sender_bean_set_resend(ack_bean, env, AXIS2_FALSE);
-        sandesha2_sender_mgr_insert(sender_mgr, env, ack_bean);
-
-        if(ack_bean)
-        {
-            sandesha2_sender_bean_free(ack_bean, env);
-        }
-
-        /*transport_out = axis2_msg_ctx_get_transport_out_desc(ack_msg_ctx, 
env);
-        property = axutil_property_create_with_args(env, 0, 0, 
-                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_msg_ctx_set_transport_out_desc(ack_msg_ctx, env, 
sandesha2_utils_get_transport_out(env));*/
-        property = axutil_property_create_with_args(env, 0, AXIS2_TRUE, 0, 
key);
-        axis2_msg_ctx_set_property(ack_msg_ctx, env, 
SANDESHA2_MESSAGE_STORE_KEY, property);
+        /* Taking from epr and testing for it is temporary code until 
AXIS2C-1161 is fixed */
+        axis2_endpoint_ref_t *from = sandesha2_msg_ctx_get_from(rm_msg_ctx, 
env);
+        relates_to = sandesha2_msg_ctx_get_relates_to(rm_msg_ctx, env);
+        if(relates_to && from)
+        {
+            related_msg_id = axis2_relates_to_get_value(relates_to, env);
+            int_seq_id = sandesha2_utils_get_seq_property(env, related_msg_id, 
+                SANDESHA2_MSG_CTX_PROP_INTERNAL_SEQUENCE_ID, seq_prop_mgr);
+
+            key = axutil_uuid_gen(env);
+            ack_bean = sandesha2_sender_bean_create(env);
+            sandesha2_sender_bean_set_msg_ctx_ref_key(ack_bean, env, key);
+            sandesha2_storage_mgr_store_msg_ctx(storage_mgr, env, key, 
ack_msg_ctx);
+            send_time = sandesha2_utils_get_current_time_in_millis(env);
+            sandesha2_sender_bean_set_time_to_send(ack_bean, env, send_time);
+            sandesha2_sender_bean_set_msg_id(ack_bean, env, 
sandesha2_msg_ctx_get_msg_id(ack_rm_msg, env));
+            sandesha2_sender_bean_set_send(ack_bean, env, AXIS2_TRUE);
+            sandesha2_sender_bean_set_internal_seq_id(ack_bean, env, 
int_seq_id);
+            sandesha2_sender_bean_set_seq_id(ack_bean, env, seq_id);
+            sandesha2_sender_bean_set_msg_type(ack_bean, env, 
SANDESHA2_MSG_TYPE_ACK);
+            sandesha2_sender_bean_set_resend(ack_bean, env, AXIS2_FALSE);
+            sandesha2_sender_mgr_insert(sender_mgr, env, ack_bean);
 
-        property = axutil_property_create_with_args(env, 0, 0, 0, 
AXIS2_VALUE_TRUE);
-        axis2_msg_ctx_set_property(ack_msg_ctx, env, 
SANDESHA2_SET_SEND_TO_TRUE, property);
+            if(ack_bean)
+            {
+                sandesha2_sender_bean_free(ack_bean, env);
+            }
 
-        reply_to_epr = axis2_msg_ctx_get_to(msg_ctx, env);
+            property = axutil_property_create_with_args(env, 0, AXIS2_TRUE, 0, 
key);
+            axis2_msg_ctx_set_property(ack_msg_ctx, env, 
SANDESHA2_MESSAGE_STORE_KEY, property);
 
-        if(reply_to_epr)
-        {
-            axis2_msg_ctx_set_reply_to(ack_msg_ctx, env, reply_to_epr);
-        }
+            reply_to_epr = axis2_msg_ctx_get_to(msg_ctx, env);
 
-        sandesha2_seq_property_bean_free(int_seq_bean, env);
+            if(reply_to_epr)
+            {
+                axis2_msg_ctx_set_reply_to(ack_msg_ctx, env, reply_to_epr);
+            }
+            return AXIS2_SUCCESS;
+        }
     }
 
     if(ack_rm_msg)
@@ -2111,6 +2102,7 @@
     axis2_msg_ctx_t *req_msg = NULL;
     axis2_char_t *str_identifier = NULL;
     sandesha2_sender_bean_t *app_msg_entry = NULL;
+    sandesha2_seq_property_bean_t *internal_seq_bean = NULL;
     long millisecs = 0;
     axutil_property_t *property = NULL;
     axis2_engine_t *engine = NULL;
@@ -2371,6 +2363,14 @@
     sandesha2_sender_bean_set_msg_no(app_msg_entry, env, msg_num);
     sandesha2_sender_bean_set_msg_type(app_msg_entry, env, 
SANDESHA2_MSG_TYPE_APPLICATION);
 
+    internal_seq_bean = sandesha2_seq_property_bean_create_with_data(env, 
msg_id, 
+        SANDESHA2_MSG_CTX_PROP_INTERNAL_SEQUENCE_ID, internal_seq_id);
+
+    if(internal_seq_bean)
+    {
+        sandesha2_seq_property_mgr_insert(seq_prop_mgr, env, 
internal_seq_bean);
+    }
+
     if(!out_seq_bean || !sandesha2_seq_property_bean_get_value(out_seq_bean, 
env))
     {
         sandesha2_sender_bean_set_send(app_msg_entry, env, AXIS2_FALSE);

Modified: 
webservices/sandesha/tags/sandesha2/c/worker_thread_removed-23may2008/src/msgprocessors/create_seq_msg_processor.c
URL: 
http://svn.apache.org/viewvc/webservices/sandesha/tags/sandesha2/c/worker_thread_removed-23may2008/src/msgprocessors/create_seq_msg_processor.c?rev=660362&r1=660361&r2=660362&view=diff
==============================================================================
--- 
webservices/sandesha/tags/sandesha2/c/worker_thread_removed-23may2008/src/msgprocessors/create_seq_msg_processor.c
 (original)
+++ 
webservices/sandesha/tags/sandesha2/c/worker_thread_removed-23may2008/src/msgprocessors/create_seq_msg_processor.c
 Mon May 26 21:00:50 2008
@@ -322,7 +322,6 @@
             sandesha2_seq_property_bean_set_seq_id(out_seq_bean, env, 
internal_seq_id);
             sandesha2_seq_property_bean_set_value(out_seq_bean, env, 
offer_seq_id);
             AXIS2_LOG_DEBUG(env->log, AXIS2_LOG_SI, "[sandesha2] 
new_seq_id:%s", new_seq_id); 
-            AXIS2_LOG_DEBUG(env->log, AXIS2_LOG_SI, "[sandesha2] 
dam_int_seq_id1:%s", internal_seq_id); 
             sandesha2_seq_property_mgr_insert(seq_prop_mgr, env, out_seq_bean);
             internal_seq_bean = sandesha2_seq_property_bean_create(env);
             sandesha2_seq_property_bean_set_name(internal_seq_bean, env, 

Modified: 
webservices/sandesha/tags/sandesha2/c/worker_thread_removed-23may2008/src/util/ack_mgr.c
URL: 
http://svn.apache.org/viewvc/webservices/sandesha/tags/sandesha2/c/worker_thread_removed-23may2008/src/util/ack_mgr.c?rev=660362&r1=660361&r2=660362&view=diff
==============================================================================
--- 
webservices/sandesha/tags/sandesha2/c/worker_thread_removed-23may2008/src/util/ack_mgr.c
 (original)
+++ 
webservices/sandesha/tags/sandesha2/c/worker_thread_removed-23may2008/src/util/ack_mgr.c
 Mon May 26 21:00:50 2008
@@ -311,7 +311,7 @@
         timenow = sandesha2_utils_get_current_time_in_millis(env);
         sender_bean = axutil_array_list_get(found_list, env, i);
         
-        if(sandesha2_sender_bean_get_time_to_send(sender_bean, env) > timenow)
+        /*if(sandesha2_sender_bean_get_time_to_send(sender_bean, env) > 
timenow)*/
         {
             axis2_msg_ctx_t *msg_ctx1 = NULL;
             axis2_char_t *to = NULL;
@@ -329,7 +329,7 @@
                 to = (axis2_char_t*)axis2_endpoint_ref_get_address(to_ref, 
env);
             else
                 continue;
-            if(0 == axutil_strcmp(to, to_str))
+            if(axutil_strcmp(to, to_str))
                 continue; 
             sandesha2_sender_mgr_remove(sender_mgr, env, 
                 sandesha2_sender_bean_get_msg_id(sender_bean, env));
@@ -343,6 +343,7 @@
                     " ack message entry");
                 return AXIS2_FAILURE;
             }
+
             seq_ack = sandesha2_msg_ctx_get_seq_ack(ack_rm_msg, env);
             sandesha2_msg_ctx_set_seq_ack(rm_msg_ctx, env, seq_ack);
             sandesha2_msg_ctx_add_soap_envelope(rm_msg_ctx, env);

Modified: 
webservices/sandesha/tags/sandesha2/c/worker_thread_removed-23may2008/src/util/terminate_mgr.c
URL: 
http://svn.apache.org/viewvc/webservices/sandesha/tags/sandesha2/c/worker_thread_removed-23may2008/src/util/terminate_mgr.c?rev=660362&r1=660361&r2=660362&view=diff
==============================================================================
--- 
webservices/sandesha/tags/sandesha2/c/worker_thread_removed-23may2008/src/util/terminate_mgr.c
 (original)
+++ 
webservices/sandesha/tags/sandesha2/c/worker_thread_removed-23may2008/src/util/terminate_mgr.c
 Mon May 26 21:00:50 2008
@@ -904,10 +904,6 @@
     }
 
     msg_ctx1 = sandesha2_msg_ctx_get_msg_ctx(terminate_rm_msg, env);
-    if(terminate_rm_msg)
-    {
-        sandesha2_msg_ctx_free(terminate_rm_msg, env);
-    }
 
     /*transport_out = axis2_msg_ctx_get_transport_out_desc(msg_ctx1, env);
     
@@ -930,6 +926,12 @@
         axis2_msg_ctx_set_reply_to(msg_ctx1, env, reply_to_epr);
     }
 
+    if(!sandesha2_util_is_ack_already_piggybacked(env, terminate_rm_msg))
+    {
+        sandesha2_ack_mgr_piggyback_acks_if_present(env, terminate_rm_msg, 
storage_mgr, seq_prop_mgr, 
+                sender_mgr);
+    }
+
     engine = axis2_engine_create(env, conf_ctx);
 
     status = axis2_engine_send(engine, env, msg_ctx1);
@@ -938,6 +940,11 @@
         axis2_engine_free(engine, env);
     }
 
+    if(terminate_rm_msg)
+    {
+        sandesha2_msg_ctx_free(terminate_rm_msg, env);
+    }
+
     AXIS2_LOG_TRACE(env->log, AXIS2_LOG_SI, 
             "[sandesha2] Exit:sandesha2_terminate_mgr_add_terminate_seq_msg");
 

Modified: 
webservices/sandesha/tags/sandesha2/c/worker_thread_removed-23may2008/src/workers/sender_worker.c
URL: 
http://svn.apache.org/viewvc/webservices/sandesha/tags/sandesha2/c/worker_thread_removed-23may2008/src/workers/sender_worker.c?rev=660362&r1=660361&r2=660362&view=diff
==============================================================================
--- 
webservices/sandesha/tags/sandesha2/c/worker_thread_removed-23may2008/src/workers/sender_worker.c
 (original)
+++ 
webservices/sandesha/tags/sandesha2/c/worker_thread_removed-23may2008/src/workers/sender_worker.c
 Mon May 26 21:00:50 2008
@@ -396,7 +396,6 @@
         axis2_char_t *msg_stored_key = NULL;
         if(bean1)
         {
-            AXIS2_LOG_DEBUG(env->log, AXIS2_LOG_SI, 
"came2*****************************");
             msg_id = sandesha2_sender_bean_get_msg_id(bean1, env); 
             sandesha2_sender_mgr_remove(sender_mgr, env, msg_id);
             msg_stored_key = sandesha2_sender_bean_get_msg_ctx_ref_key(bean1, 
env);



---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to