Author: damitha
Date: Mon Jan 22 02:57:11 2007
New Revision: 498580

URL: http://svn.apache.org/viewvc?view=rev&rev=498580
Log:
rm single channel is now working with simple axis2 server
in linux

Modified:
    webservices/sandesha/trunk/c/include/sandesha2_sender_worker.h
    webservices/sandesha/trunk/c/samples/rm_1_1_echo/rm_echo_client.c
    webservices/sandesha/trunk/c/samples/rm_ping/rm_ping_client.c
    webservices/sandesha/trunk/c/src/msgprocessors/app_msg_processor.c
    
webservices/sandesha/trunk/c/src/msgprocessors/make_connection_msg_processor.c
    webservices/sandesha/trunk/c/src/polling/polling_mgr.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/workers/sender_worker.c

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=498580&r1=498579&r2=498580
==============================================================================
--- webservices/sandesha/trunk/c/include/sandesha2_sender_worker.h (original)
+++ webservices/sandesha/trunk/c/include/sandesha2_sender_worker.h Mon Jan 22 
02:57:11 2007
@@ -41,6 +41,13 @@
     const axis2_env_t *env,
     axis2_conf_ctx_t *conf_ctx,
     axis2_char_t *msg_id);
+
+AXIS2_EXTERN sandesha2_sender_worker_t* AXIS2_CALL
+sandesha2_sender_worker_create_with_msg_ctx(
+    const axis2_env_t *env,
+    axis2_conf_ctx_t *conf_ctx,
+    axis2_char_t *msg_id,
+    axis2_msg_ctx_t *msg_ctx);
  
 /**
  * Frees the sender_worker given as a void pointer. This method would cast the 

Modified: webservices/sandesha/trunk/c/samples/rm_1_1_echo/rm_echo_client.c
URL: 
http://svn.apache.org/viewvc/webservices/sandesha/trunk/c/samples/rm_1_1_echo/rm_echo_client.c?view=diff&rev=498580&r1=498579&r2=498580
==============================================================================
--- webservices/sandesha/trunk/c/samples/rm_1_1_echo/rm_echo_client.c (original)
+++ webservices/sandesha/trunk/c/samples/rm_1_1_echo/rm_echo_client.c Mon Jan 
22 02:57:11 2007
@@ -29,7 +29,7 @@
 #include <sandesha2_client.h>
 #include <axis2_addr.h>
 
-#define SANDESHA2_MAX_COUNT 10
+#define SANDESHA2_MAX_COUNT 40
 
 /* on_complete callback function */
 axis2_status_t AXIS2_CALL
@@ -134,7 +134,6 @@
                 "__OPERATION_OUT_IN__");
     if(single_channel)
     {
-        printf("camex\n");
         reply_to = axis2_endpoint_ref_create(env, AXIS2_WSA_ANONYMOUS_URL);
         offer = AXIS2_TRUE;
     }

Modified: webservices/sandesha/trunk/c/samples/rm_ping/rm_ping_client.c
URL: 
http://svn.apache.org/viewvc/webservices/sandesha/trunk/c/samples/rm_ping/rm_ping_client.c?view=diff&rev=498580&r1=498579&r2=498580
==============================================================================
--- webservices/sandesha/trunk/c/samples/rm_ping/rm_ping_client.c (original)
+++ webservices/sandesha/trunk/c/samples/rm_ping/rm_ping_client.c Mon Jan 22 
02:57:11 2007
@@ -56,7 +56,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:5555/axis2/services/RMSampleService";*/
     /*to = "http://127.0.0.1:8080/axis2/services/RMSampleService";*/
     to = "http://127.0.0.1:5555/axis2/services/RMSampleService";;
     while ((c = AXIS2_GETOPT(argc, argv, ":a:v:")) != -1)

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=498580&r1=498579&r2=498580
==============================================================================
--- webservices/sandesha/trunk/c/src/msgprocessors/app_msg_processor.c 
(original)
+++ webservices/sandesha/trunk/c/src/msgprocessors/app_msg_processor.c Mon Jan 
22 02:57:11 2007
@@ -1184,8 +1184,8 @@
     else
         sandesha2_msg_ctx_set_to(rm_msg_ctx, env, to_epr);
 
-    if(reply_to_epr)
-        sandesha2_msg_ctx_set_reply_to(rm_msg_ctx, env, reply_to_epr);
+    /*if(reply_to_epr)
+        sandesha2_msg_ctx_set_reply_to(rm_msg_ctx, env, reply_to_epr);*/
         
     rm_version = sandesha2_utils_get_rm_version(env, internal_seq_id, mgr);
     if(!rm_version)

Modified: 
webservices/sandesha/trunk/c/src/msgprocessors/make_connection_msg_processor.c
URL: 
http://svn.apache.org/viewvc/webservices/sandesha/trunk/c/src/msgprocessors/make_connection_msg_processor.c?view=diff&rev=498580&r1=498579&r2=498580
==============================================================================
--- 
webservices/sandesha/trunk/c/src/msgprocessors/make_connection_msg_processor.c 
(original)
+++ 
webservices/sandesha/trunk/c/src/msgprocessors/make_connection_msg_processor.c 
Mon Jan 22 02:57:11 2007
@@ -30,6 +30,9 @@
 #include <sandesha2_msg_init.h>
 #include <sandesha2_sender_mgr.h>
 #include <sandesha2_sender_bean.h>
+#include <sandesha2_terminate_seq.h>
+#include <sandesha2_terminate_seq_res.h>
+#include <sandesha2_seq.h>
 #include <axis2_msg_ctx.h>
 #include <axis2_string.h>
 #include <axis2_engine.h>
@@ -149,9 +152,10 @@
 {
     sandesha2_make_connection_t *make_conn = NULL;
     sandesha2_storage_mgr_t *storage_mgr = NULL;
-    sandesha2_sender_mgr_t *sender_bean_mgr = NULL;
+    sandesha2_sender_mgr_t *sender_mgr = NULL;
     sandesha2_sender_bean_t *find_sender_bean = NULL;
     sandesha2_sender_bean_t *sender_bean = NULL;
+    sandesha2_sender_bean_t *bean1 = NULL;
     sandesha2_address_t *address = NULL;
     sandesha2_identifier_t *identifier = NULL;
     sandesha2_msg_ctx_t *return_rm_msg_ctx = NULL;
@@ -166,7 +170,13 @@
     axis2_char_t *seq_id = NULL;
     axis2_op_ctx_t *op_ctx = NULL;
     axis2_char_t *msg_id = NULL;
+    axis2_transport_sender_t *transport_sender = NULL;
     int size = 0, item_to_pick = -1, item = 0;
+    int msg_type = -1;
+    axis2_bool_t continue_sending = AXIS2_TRUE;
+    axis2_char_t *qualified_for_sending = NULL;
+    sandesha2_property_bean_t *prop_bean = NULL;
+    axis2_array_list_t *msgs_not_to_send = NULL;
 
     AXIS2_ENV_CHECK(env, AXIS2_FAILURE);
     AXIS2_PARAM_CHECK(env->error, rm_msg_ctx, AXIS2_FAILURE);
@@ -195,7 +205,7 @@
         storage_mgr = sandesha2_utils_get_storage_mgr(env, conf_ctx, 
                         AXIS2_CONF_CTX_GET_CONF(conf_ctx, env));
     if(storage_mgr)
-        sender_bean_mgr = sandesha2_storage_mgr_get_retrans_mgr(storage_mgr, 
env);
+        sender_mgr = sandesha2_storage_mgr_get_retrans_mgr(storage_mgr, env);
     /* Selecting the set of sender beans that suit the given criteria */
     find_sender_bean = sandesha2_sender_bean_create(env);
     if(find_sender_bean)
@@ -220,34 +230,7 @@
         retrans_list = axis2_array_list_create(env, 0);
         if(!retrans_list)
             return AXIS2_FAILURE;
-        /* Following code is obsolete, since in inmemory_sender_mgr_match 
-         * function we donot consider resend. Instead we can directly assign
-         * to retrans_list as follows the commented lines.
-         */
-        /*axis2_array_list_t *retrans_list1 = NULL, *retrans_list2 = NULL;
-        sandesha2_sender_bean_set_resend(find_sender_bean, env, AXIS2_TRUE);
-        retrans_list1 = 
sandesha2_sender_mgr_find_by_sender_bean(sender_bean_mgr, 
-                env, find_sender_bean);
-        sandesha2_sender_bean_set_resend(find_sender_bean, env, AXIS2_FALSE);
-        retrans_list2 = 
sandesha2_sender_mgr_find_by_sender_bean(sender_bean_mgr, 
-                env, find_sender_bean);
-        if(retrans_list1)
-            size = AXIS2_ARRAY_LIST_SIZE(retrans_list1, env);
-        for(i = 0; i < size; i++)
-        {
-            sandesha2_sender_bean_t *temp_bean = NULL;
-            temp_bean = AXIS2_ARRAY_LIST_GET(retrans_list1, env, i);
-            AXIS2_ARRAY_LIST_ADD(retrans_list, env, temp_bean);
-        }
-        if(retrans_list2)
-            size = AXIS2_ARRAY_LIST_SIZE(retrans_list2, env);
-        for(i = 0; i < size; i++)
-        {
-            sandesha2_sender_bean_t *temp_bean = NULL;
-            temp_bean = AXIS2_ARRAY_LIST_GET(retrans_list2, env, i);
-            AXIS2_ARRAY_LIST_ADD(retrans_list, env, temp_bean);
-        }*/
-        retrans_list = 
sandesha2_sender_mgr_find_by_sender_bean(sender_bean_mgr, 
+        retrans_list = sandesha2_sender_mgr_find_by_sender_bean(sender_mgr, 
                 env, find_sender_bean);
     }
     /* Selecting a bean to send randomly. TODO - Should use a better mechanism 
*/
@@ -285,9 +268,9 @@
         return AXIS2_FAILURE;
     }
     msg_storage_key = sandesha2_sender_bean_get_msg_ctx_ref_key(sender_bean, 
-            env);
+        env);
     return_msg_ctx = sandesha2_storage_mgr_retrieve_msg_ctx(storage_mgr, env, 
-            msg_storage_key, conf_ctx);
+        msg_storage_key, conf_ctx);
     return_rm_msg_ctx = sandesha2_msg_init_init_msg(env, return_msg_ctx);
     add_msg_pending_header(env, return_rm_msg_ctx, pending);
     set_transport_properties(env, return_msg_ctx, rm_msg_ctx);
@@ -306,20 +289,158 @@
     }
     /*
      *running the make_connection through a sender_worker.
-     *This will allow Sandesha2 to consider both of following senarios equally.
+     *This will allow Sandesha2 to consider both of following scenarios 
equally.
      * 1. A message being sent by the Sender thread.
      * 2. A message being sent as a reply to an make_connection.
      */
     msg_id = sandesha2_sender_bean_get_msg_id((sandesha2_rm_bean_t *) 
         sender_bean, env);
-    if(msg_id)
+    /*if(msg_id)
     {
         sandesha2_sender_worker_t *sender_worker = NULL;
-        /* Start a sender worker which will work on this message */
         sender_worker = sandesha2_sender_worker_create(env, conf_ctx, msg_id);
+        sender_worker = sandesha2_sender_worker_create_with_msg_ctx(env, 
+            conf_ctx, msg_id, return_msg_ctx);
         sandesha2_sender_worker_set_transport_out(sender_worker, env, 
transport_out); 
         sandesha2_sender_worker_run(sender_worker, env);
+    }*/
+    continue_sending = sandesha2_msg_retrans_adjuster_adjust_retrans(env,
+        sender_bean, conf_ctx, storage_mgr);
+    if(!continue_sending)
+    {
+        printf("do not continue\n");
+        AXIS2_LOG_DEBUG(env->log, AXIS2_LOG_SI, 
+            "[sandesha2] Do not continue sending the message as response to"\
+                "MakeConnection message");
+        return AXIS2_SUCCESS;
+    }
+    
+    property = axis2_msg_ctx_get_property(msg_ctx, env, 
+        SANDESHA2_QUALIFIED_FOR_SENDING, AXIS2_FALSE);
+    if(property)
+        qualified_for_sending = axis2_property_get_value(property, env);
+    if(qualified_for_sending && 0 != axis2_strcmp(
+        qualified_for_sending, SANDESHA2_VALUE_TRUE))
+    {
+        printf("not qualified for sending as reply ot MakeConnection\n");
+        AXIS2_LOG_DEBUG(env->log, AXIS2_LOG_SI, 
+            "[sandesha2] Message is not qualified for sending as reply to "\
+                "MakeConnection message");
+        return AXIS2_SUCCESS;
+    }
+    
+    prop_bean = sandesha2_utils_get_property_bean_from_op(env, 
+        axis2_msg_ctx_get_op(return_msg_ctx, env));
+    if(prop_bean)
+        msgs_not_to_send = sandesha2_property_bean_get_msg_types_to_drop(
+            prop_bean, env);
+    if(msgs_not_to_send)
+    {
+        int j = 0;
+        axis2_bool_t continue_sending = AXIS2_FALSE;
+
+        for(j = 0; j < AXIS2_ARRAY_LIST_SIZE(msgs_not_to_send, env); j++)
+        {
+            axis2_char_t *value = NULL;
+            int int_val = -1;
+            int msg_type = -1;
+            
+            value = AXIS2_ARRAY_LIST_GET(msgs_not_to_send, env, j);
+            int_val = atoi(value);
+            msg_type = sandesha2_msg_ctx_get_msg_type(return_rm_msg_ctx, env);
+            if(msg_type == int_val)
+                continue_sending = AXIS2_TRUE;
+        }
+        if(continue_sending)
+        {
+            printf("continue sending is true\n");
+            AXIS2_LOG_DEBUG(env->log, AXIS2_LOG_SI, "[sandesha2] Continue "\
+                "Sending is true. So returning from 
make_connection_msg_processor");
+            return AXIS2_SUCCESS;
+        }
+    }
+    msg_type = sandesha2_msg_ctx_get_msg_type(return_rm_msg_ctx, env);
+    if(msg_type == SANDESHA2_MSG_TYPE_APPLICATION)
+    {
+        sandesha2_seq_t *seq = NULL;
+        axis2_char_t *seq_id = NULL;
+        sandesha2_identifier_t *identifier = NULL;
+        
+        seq = (sandesha2_seq_t*) 
sandesha2_msg_ctx_get_msg_part(return_rm_msg_ctx, 
+            env, SANDESHA2_MSG_PART_SEQ);
+        identifier = sandesha2_seq_get_identifier(seq, env);
+        seq_id = sandesha2_identifier_get_identifier(identifier, env);
+    }
+
+    transport_sender = AXIS2_TRANSPORT_OUT_DESC_GET_SENDER(transport_out, env);
+    AXIS2_TRANSPORT_SENDER_INVOKE(transport_sender, env, return_msg_ctx);
+    bean1 = sandesha2_sender_mgr_retrieve(sender_mgr, env, msg_id);
+    if(bean1)
+    {
+        axis2_bool_t resend = AXIS2_FALSE;
+        
+        resend = sandesha2_sender_bean_is_resend(sender_bean, env);
+        if(resend)
+        {
+            sandesha2_sender_bean_set_sent_count(bean1, env, 
+                sandesha2_sender_bean_get_sent_count(sender_bean, env));
+            sandesha2_sender_bean_set_time_to_send(bean1, env, 
+                sandesha2_sender_bean_get_time_to_send(sender_bean, env));
+            sandesha2_sender_mgr_update(sender_mgr, env, bean1);
+        }
+        else
+        {
+            axis2_char_t *msg_stored_key = NULL;
+            
+            msg_id = sandesha2_sender_bean_get_msg_id((sandesha2_rm_bean_t *) 
+                bean1, env); 
+            sandesha2_sender_mgr_remove(sender_mgr, env, msg_id);
+            /* Removing the message from the storage */
+            msg_stored_key = sandesha2_sender_bean_get_msg_ctx_ref_key(
+                bean1, env);
+            sandesha2_storage_mgr_remove_msg_ctx(storage_mgr, env, 
+                msg_stored_key);
+        }
+    }
+    msg_type = sandesha2_msg_ctx_get_msg_type(return_rm_msg_ctx, env);
+    if(SANDESHA2_MSG_TYPE_TERMINATE_SEQ == msg_type)
+    {
+        sandesha2_terminate_seq_t *terminate_seq = NULL;
+        axis2_char_t *seq_id = NULL;
+        axis2_conf_ctx_t *conf_ctx = NULL;
+        axis2_char_t *int_seq_id = NULL;
+        
+        terminate_seq = (sandesha2_terminate_seq_t*)
+            sandesha2_msg_ctx_get_msg_part(return_rm_msg_ctx, env, 
+                SANDESHA2_MSG_PART_TERMINATE_SEQ);
+        seq_id = sandesha2_identifier_get_identifier(
+            sandesha2_terminate_seq_get_identifier(terminate_seq, 
+                env), env);
+        conf_ctx = AXIS2_MSG_CTX_GET_CONF_CTX(msg_ctx, env);
+        int_seq_id = sandesha2_utils_get_seq_property(env, seq_id, 
+            SANDESHA2_SEQ_PROP_INTERNAL_SEQ_ID, storage_mgr);
+        sandesha2_terminate_mgr_terminate_sending_side(env, conf_ctx,
+            int_seq_id, AXIS2_MSG_CTX_GET_SERVER_SIDE(msg_ctx, env), 
+                storage_mgr);
+    }
+    else if(SANDESHA2_MSG_TYPE_TERMINATE_SEQ_RESPONSE == msg_type)
+    {
+        sandesha2_terminate_seq_res_t *terminate_seq_res = NULL;
+        axis2_char_t *seq_id = NULL;
+        axis2_conf_ctx_t *conf_ctx = NULL;
+        
+        terminate_seq_res = (sandesha2_terminate_seq_res_t*)
+            sandesha2_msg_ctx_get_msg_part(return_rm_msg_ctx, env, 
+            SANDESHA2_MSG_PART_TERMINATE_SEQ_RESPONSE);
+        seq_id = sandesha2_identifier_get_identifier(
+            sandesha2_terminate_seq_res_get_identifier(terminate_seq_res, 
+            env), env);
+        conf_ctx = AXIS2_MSG_CTX_GET_CONF_CTX(msg_ctx, env);
+        sandesha2_terminate_mgr_terminate_sending_side(env, conf_ctx,
+            seq_id, AXIS2_MSG_CTX_GET_SERVER_SIDE(msg_ctx, env), 
+            storage_mgr);
     }
+    axis2_msg_ctx_set_paused(msg_ctx, env, AXIS2_TRUE);
     AXIS2_LOG_INFO(env->log, "[sandesha2] EXIT sandesha2_make_connection_msg_" 
\
             "processor_process_in_msg .........");
     return AXIS2_SUCCESS;
@@ -360,13 +481,14 @@
     {
         property = sandesha2_msg_ctx_get_property(make_conn_msg_ctx, env, 
             AXIS2_TRANSPORT_OUT);
-        AXIS2_PROPERTY_SET_SCOPE(property, env, AXIS2_SCOPE_APPLICATION);
-        AXIS2_MSG_CTX_SET_PROPERTY(return_msg_ctx, env, AXIS2_TRANSPORT_OUT, 
-            AXIS2_PROPERTY_CLONE(property, env), AXIS2_FALSE);
+        axis2_property_set_own_value(property, env, AXIS2_FALSE);
+        axis2_msg_ctx_set_property(return_msg_ctx, env, AXIS2_TRANSPORT_OUT, 
+            axis2_property_clone(property, env), AXIS2_FALSE);
         property = sandesha2_msg_ctx_get_property(make_conn_msg_ctx, env, 
             AXIS2_HTTP_OUT_TRANSPORT_INFO);
-        AXIS2_MSG_CTX_SET_PROPERTY(return_msg_ctx, env, 
-            AXIS2_HTTP_OUT_TRANSPORT_INFO, AXIS2_PROPERTY_CLONE(property, 
env), 
+        axis2_property_set_own_value(property, env, AXIS2_FALSE);
+        axis2_msg_ctx_set_property(return_msg_ctx, env, 
+            AXIS2_HTTP_OUT_TRANSPORT_INFO, axis2_property_clone(property, 
env), 
             AXIS2_FALSE);
     }
 }

Modified: webservices/sandesha/trunk/c/src/polling/polling_mgr.c
URL: 
http://svn.apache.org/viewvc/webservices/sandesha/trunk/c/src/polling/polling_mgr.c?view=diff&rev=498580&r1=498579&r2=498580
==============================================================================
--- webservices/sandesha/trunk/c/src/polling/polling_mgr.c (original)
+++ webservices/sandesha/trunk/c/src/polling/polling_mgr.c Mon Jan 22 02:57:11 
2007
@@ -240,13 +240,15 @@
         axis2_msg_ctx_t *make_conn_msg_ctx = NULL;
         axis2_endpoint_ref_t *to = NULL;
         axis2_property_t *property = NULL;
+        sandesha2_transaction_t *transaction = NULL;
 
-        printf("came11\n");
         AXIS2_SLEEP(SANDESHA2_POLLING_MANAGER_WAIT_TIME);
-        printf("came12\n");
+        /*axis2_allocator_switch_to_global_pool(env->allocator);*/
+        transaction = sandesha2_storage_mgr_get_transaction(storage_mgr, env);
+        /*axis2_allocator_switch_to_local_pool(env->allocator);*/
         next_msg_mgr = sandesha2_storage_mgr_get_next_msg_mgr(
                         storage_mgr, env);
-         /* Geting the sequences to be polled. if schedule contains any 
requests, 
+         /* Getting the sequences to be polled. if schedule contains any 
requests, 
           * do the earliest one. else pick one randomly.
           */
         if(polling_mgr->scheduled_polling_reqs)
@@ -260,7 +262,6 @@
         }
         if(!seq_id)
         {
-            printf("came13\n");
             sandesha2_next_msg_bean_t *find_bean = 
                 sandesha2_next_msg_bean_create(env);
             int size = 0;
@@ -273,7 +274,6 @@
                     find_bean);
                 if(results)
                     size = AXIS2_ARRAY_LIST_SIZE(results, env);
-                printf("size:%d\n", size);
                 if(size > 0)
                 {
                     unsigned int rand_var = 
@@ -288,7 +288,6 @@
         }
         else
         {
-            printf("came14\n");
             sandesha2_next_msg_bean_t *find_bean = 
                 sandesha2_next_msg_bean_create(env);
             if(find_bean)
@@ -301,10 +300,11 @@
             }
         }
         /* If no valid entry is found, try again later */
-        printf("came15\n");
         if(!next_msg_bean)
+        {
+            sandesha2_transaction_rollback(transaction, env);
             continue;
-        printf("came16\n");
+        }
         seq_id = sandesha2_next_msg_bean_get_seq_id((sandesha2_rm_bean_t *) 
             next_msg_bean, env);
         /* Create a MakeConnection message */
@@ -323,7 +323,7 @@
             ref_rm_msg_ctx, seq_id, wsrm_anon_reply_to_uri, storage_mgr);
         if(!make_conn_rm_msg_ctx)
         {
-            printf("came12\n");
+            sandesha2_transaction_rollback(transaction, env);
             AXIS2_ERROR_SET(env->error, AXIS2_ERROR_NO_MEMORY, AXIS2_FAILURE);
             return NULL;
         }
@@ -383,6 +383,10 @@
         }
         sandesha2_utils_execute_and_store(env, make_conn_rm_msg_ctx, 
             make_conn_msg_store_key);
+        if(transaction)
+        {
+            sandesha2_transaction_commit(transaction, env);
+        }
     }
     return NULL;
 }

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=498580&r1=498579&r2=498580
==============================================================================
--- webservices/sandesha/trunk/c/src/storage/permanent/permanent_bean_mgr.c 
(original)
+++ webservices/sandesha/trunk/c/src/storage/permanent/permanent_bean_mgr.c Mon 
Jan 22 02:57:11 2007
@@ -534,7 +534,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 NULL;
+    }
     rc = sqlite3_exec(dbconn, sql_stmt_find, find_func, args, 
         &error_msg);
     if(rc == SQLITE_BUSY)

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=498580&r1=498579&r2=498580
==============================================================================
--- webservices/sandesha/trunk/c/src/storage/permanent/permanent_storage_mgr.c 
(original)
+++ webservices/sandesha/trunk/c/src/storage/permanent/permanent_storage_mgr.c 
Mon Jan 22 02:57:11 2007
@@ -49,11 +49,11 @@
 #include <axis2_http_transport.h>
 #include <axiom_soap_const.h>
 #include <axis2_transport_out_desc.h>
+#include <axis2_http_out_transport_info.h>
 #include <axiom_xml_reader.h>
 #include <axiom_stax_builder.h>
 #include <axiom_soap_builder.h>
 
-
 /** 
  * @brief Sandesha2 Permanent Storage Manager Struct Impl
  *   Sandesha2 Permanent Storage Manager 
@@ -790,10 +790,10 @@
     sandesha2_msg_store_bean_t *msg_store_bean = NULL;
 
     storage_mgr_impl = SANDESHA2_INTF_TO_IMPL(storage_mgr);
-    msg_ctx = (axis2_msg_ctx_t *) axis2_hash_get(storage_mgr_impl->msg_ctx_map,
+    /*msg_ctx = (axis2_msg_ctx_t *) 
axis2_hash_get(storage_mgr_impl->msg_ctx_map,
         key, AXIS2_HASH_KEY_STRING);
     if(msg_ctx)
-        return msg_ctx;
+        return msg_ctx;*/
     AXIS2_LOG_DEBUG(env->log, AXIS2_LOG_SI, "retrieved from database");
     msg_store_bean = sandesha2_permanent_bean_mgr_retrieve_msg_store_bean(
         storage_mgr_impl->bean_mgr, env, key);
@@ -995,7 +995,6 @@
             sandesha2_permanent_storage_mgr_get_property_map_from_string(env, 
                 persistent_prop_str);
         axis2_hash_index_t *index = NULL;
-        /* Finding an operation using the MEP */
         for (index = axis2_hash_first(map, env); index; index = 
             axis2_hash_next(env, index))
         {

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=498580&r1=498579&r2=498580
==============================================================================
--- webservices/sandesha/trunk/c/src/workers/sender_worker.c (original)
+++ webservices/sandesha/trunk/c/src/workers/sender_worker.c Mon Jan 22 
02:57:11 2007
@@ -51,6 +51,7 @@
     axis2_thread_mutex_t *mutex;
     int counter;
     axis2_char_t *msg_id;
+    axis2_msg_ctx_t *msg_ctx;
     axis2_transport_out_desc_t *transport_out;
 };
 
@@ -122,6 +123,38 @@
     sender_worker->mutex = NULL;
     sender_worker->counter = 0;
     sender_worker->msg_id = AXIS2_STRDUP(msg_id, env);
+    sender_worker->msg_ctx = NULL;
+    sender_worker->transport_out = NULL;
+    
+    sender_worker->mutex = axis2_thread_mutex_create(env->allocator,
+                        AXIS2_THREAD_MUTEX_DEFAULT);
+                        
+       return sender_worker;
+}
+
+AXIS2_EXTERN sandesha2_sender_worker_t* AXIS2_CALL
+sandesha2_sender_worker_create_with_msg_ctx(
+    const axis2_env_t *env,
+    axis2_conf_ctx_t *conf_ctx,
+    axis2_char_t *msg_id,
+    axis2_msg_ctx_t *msg_ctx)
+{
+    sandesha2_sender_worker_t *sender_worker = NULL;
+    AXIS2_ENV_CHECK(env, NULL);
+    
+    sender_worker =  (sandesha2_sender_worker_t *)AXIS2_MALLOC 
+        (env->allocator, sizeof(sandesha2_sender_worker_t));
+       
+    if(!sender_worker)
+       {
+               AXIS2_ERROR_SET(env->error, AXIS2_ERROR_NO_MEMORY, 
AXIS2_FAILURE);
+        return NULL;
+       }
+    sender_worker->conf_ctx = conf_ctx;
+    sender_worker->mutex = NULL;
+    sender_worker->counter = 0;
+    sender_worker->msg_id = axis2_strdup(msg_id, env);
+    sender_worker->msg_ctx = msg_ctx;
     sender_worker->transport_out = NULL;
     
     sender_worker->mutex = axis2_thread_mutex_create(env->allocator,
@@ -227,6 +260,7 @@
     env = axis2_init_thread_env(args->env);
     sender_worker = args->impl;
     msg_id = sender_worker->msg_id;
+    msg_ctx = sender_worker->msg_ctx;
     transport_out = sender_worker->transport_out;
     
     AXIS2_LOG_INFO(env->log, "[Sandesha2] 
Entry:sandesha2_sender_worker_worker_func\n");        
@@ -234,9 +268,9 @@
     storage_mgr = sandesha2_utils_get_storage_mgr(env, 
         sender_worker->conf_ctx, 
         AXIS2_CONF_CTX_GET_CONF(sender_worker->conf_ctx, env));
-    axis2_allocator_switch_to_global_pool(env->allocator);
+    /*axis2_allocator_switch_to_global_pool(env->allocator);*/
     transaction = sandesha2_storage_mgr_get_transaction(storage_mgr, env);
-    axis2_allocator_switch_to_local_pool(env->allocator);
+    /*axis2_allocator_switch_to_local_pool(env->allocator);*/
     sender_mgr = sandesha2_storage_mgr_get_retrans_mgr(storage_mgr, env);
     sender_worker_bean = sandesha2_sender_mgr_retrieve(sender_mgr, env, 
msg_id);
     if(!sender_worker_bean)
@@ -247,10 +281,13 @@
     }
 
     key = sandesha2_sender_bean_get_msg_ctx_ref_key(sender_worker_bean, env);
-    axis2_allocator_switch_to_global_pool(env->allocator);
-    msg_ctx = sandesha2_storage_mgr_retrieve_msg_ctx(storage_mgr, env, key, 
-                    sender_worker->conf_ctx);
-    axis2_allocator_switch_to_local_pool(env->allocator);
+    if(!msg_ctx)
+    {
+        axis2_allocator_switch_to_global_pool(env->allocator);
+        msg_ctx = sandesha2_storage_mgr_retrieve_msg_ctx(storage_mgr, env, 
key, 
+            sender_worker->conf_ctx);
+        axis2_allocator_switch_to_local_pool(env->allocator);
+    }
     if(!msg_ctx)
     {
         printf("msg_ctx is not present\n");
@@ -353,8 +390,8 @@
                     storage_mgr);
     }
     
-    
-    transport_out = AXIS2_MSG_CTX_GET_TRANSPORT_OUT_DESC(msg_ctx, env);
+    if(!transport_out) 
+        transport_out = AXIS2_MSG_CTX_GET_TRANSPORT_OUT_DESC(msg_ctx, env);
     transport_sender = AXIS2_TRANSPORT_OUT_DESC_GET_SENDER(transport_out, env);
     if(transport_sender)
     {
@@ -379,9 +416,9 @@
         sleep(300000);*/
                     
     }
-    axis2_allocator_switch_to_global_pool(env->allocator);
+    /*axis2_allocator_switch_to_global_pool(env->allocator);*/
     transaction = sandesha2_storage_mgr_get_transaction(storage_mgr, env);
-    axis2_allocator_switch_to_local_pool(env->allocator);
+    /*axis2_allocator_switch_to_local_pool(env->allocator);*/
     property = AXIS2_MSG_CTX_GET_PROPERTY(msg_ctx, env, 
         SANDESHA2_WITHIN_TRANSACTION, AXIS2_FALSE); 
     if(property)



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

Reply via email to