ws-sandesha-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From dami...@apache.org
Subject svn commit: r602609 - in /webservices/sandesha/trunk/c: config/module.xml include/sandesha2_constants.h include/sandesha2_sender.h src/workers/sender.c
Date Sun, 09 Dec 2007 02:06:59 GMT
Author: damitha
Date: Sat Dec  8 18:06:57 2007
New Revision: 602609

URL: http://svn.apache.org/viewvc?rev=602609&view=rev
Log:
removing mutex and related code from sender. remove stop_sender_for_seq and is_sender_started
functions from sender as these functions are no longer needed. Now sender's life time is only
for one sequence.

Modified:
    webservices/sandesha/trunk/c/config/module.xml
    webservices/sandesha/trunk/c/include/sandesha2_constants.h
    webservices/sandesha/trunk/c/include/sandesha2_sender.h
    webservices/sandesha/trunk/c/src/workers/sender.c

Modified: webservices/sandesha/trunk/c/config/module.xml
URL: http://svn.apache.org/viewvc/webservices/sandesha/trunk/c/config/module.xml?rev=602609&r1=602608&r2=602609&view=diff
==============================================================================
--- webservices/sandesha/trunk/c/config/module.xml (original)
+++ webservices/sandesha/trunk/c/config/module.xml Sat Dec  8 18:06:57 2007
@@ -81,7 +81,7 @@
     <parameter name="InvokeInOrder" locked="false">AXIS2_FALSE</parameter>
     <parameter name="MessageTypesToDrop" locked="false">none</parameter>
     <parameter name="MaxRetransCount" locked="false">10</parameter>
-    <parameter name="SenderSleepTime" locked="false">1</parameter>
+    <parameter name="SenderSleepTime" locked="false">100000</parameter><!--
In micro seconds-->
     <parameter name="InvokerSleepTime" locked="false">1</parameter>
     <parameter name="PollingWaitTime" locked="false">3</parameter>
 

Modified: webservices/sandesha/trunk/c/include/sandesha2_constants.h
URL: http://svn.apache.org/viewvc/webservices/sandesha/trunk/c/include/sandesha2_constants.h?rev=602609&r1=602608&r2=602609&view=diff
==============================================================================
--- webservices/sandesha/trunk/c/include/sandesha2_constants.h (original)
+++ webservices/sandesha/trunk/c/include/sandesha2_constants.h Sat Dec  8 18:06:57 2007
@@ -421,7 +421,7 @@
 
 	#define SANDESHA2_INVOKER_SLEEP_TIME  1  /*4 1 */
 
-	#define SANDESHA2_SENDER_SLEEP_TIME  1  /*4 1*/
+	#define SANDESHA2_SENDER_SLEEP_TIME  100000  /*micro seconds*/
 
     #define SANDESHA2_POLLING_MANAGER_WAIT_TIME 3 /* 4 3 */
 

Modified: webservices/sandesha/trunk/c/include/sandesha2_sender.h
URL: http://svn.apache.org/viewvc/webservices/sandesha/trunk/c/include/sandesha2_sender.h?rev=602609&r1=602608&r2=602609&view=diff
==============================================================================
--- webservices/sandesha/trunk/c/include/sandesha2_sender.h (original)
+++ webservices/sandesha/trunk/c/include/sandesha2_sender.h Sat Dec  8 18:06:57 2007
@@ -58,19 +58,8 @@
     const axutil_env_t *env);
 
 axis2_status_t AXIS2_CALL 
-sandesha2_sender_stop_sender_for_seq(
-    sandesha2_sender_t *sender, 
-    const axutil_env_t *env, 
-    axis2_char_t *seq_id);
-            
-axis2_status_t AXIS2_CALL 
 sandesha2_sender_stop_sending (
     sandesha2_sender_t *sender,
-    const axutil_env_t *env);
-            
-axis2_bool_t AXIS2_CALL 
-sandesha2_sender_is_sender_started( 
-    sandesha2_sender_t *sender, 
     const axutil_env_t *env);
             
 axis2_status_t AXIS2_CALL 

Modified: webservices/sandesha/trunk/c/src/workers/sender.c
URL: http://svn.apache.org/viewvc/webservices/sandesha/trunk/c/src/workers/sender.c?rev=602609&r1=602608&r2=602609&view=diff
==============================================================================
--- webservices/sandesha/trunk/c/src/workers/sender.c (original)
+++ webservices/sandesha/trunk/c/src/workers/sender.c Sat Dec  8 18:06:57 2007
@@ -50,10 +50,6 @@
 {
 	axis2_conf_ctx_t *conf_ctx;
     axis2_bool_t run_sender;
-    axutil_array_list_t *working_seqs;
-    axutil_thread_mutex_t *mutex;
-    int seq_index;
-    int counter;
     axis2_char_t *seq_id;
     axis2_bool_t persistent_msg_ctx;
 };
@@ -75,11 +71,9 @@
     const axutil_env_t *env)
 {
     sandesha2_sender_t *sender = NULL;
-    
     sender =  (sandesha2_sender_t *)AXIS2_MALLOC 
                         (env->allocator, 
                         sizeof(sandesha2_sender_t));
-	
     if(NULL == sender)
 	{
 		AXIS2_ERROR_SET(env->error, AXIS2_ERROR_NO_MEMORY, AXIS2_FAILURE);
@@ -87,17 +81,8 @@
 	}
     sender->conf_ctx = NULL;
     sender->run_sender = AXIS2_FALSE;
-    sender->working_seqs = NULL;
-    sender->mutex = NULL;
-    sender->counter = 0;
-    sender->seq_index = -1;
     sender->seq_id = NULL;
     
-    sender->working_seqs = axutil_array_list_create(env, 
-                        AXIS2_ARRAY_LIST_DEFAULT_CAPACITY);
-    sender->mutex = axutil_thread_mutex_create(env->allocator,
-                        AXIS2_THREAD_MUTEX_DEFAULT);
-                        
 	return sender;
 }
 
@@ -117,52 +102,21 @@
     sandesha2_sender_t *sender, 
     const axutil_env_t *env)
 {
-    /* Do not free this */
     sender->conf_ctx = NULL;
-    
-    if(sender->mutex)
-    {
-        axutil_thread_mutex_destroy(sender->mutex);
-        sender->mutex = NULL;
-    }
-    if(sender->working_seqs)
-    {
-        axutil_array_list_free(sender->working_seqs, env);
-        sender->working_seqs = NULL;
-    }
 	AXIS2_FREE(env->allocator, sender);
 	return AXIS2_SUCCESS;
 }
 
 axis2_status_t AXIS2_CALL 
-sandesha2_sender_stop_sender_for_seq(
-    sandesha2_sender_t *sender, 
-    const axutil_env_t *env, 
-    axis2_char_t *seq_id)
-{
-    AXIS2_PARAM_CHECK(env->error, seq_id, AXIS2_FAILURE);
-    
-    sender->run_sender = AXIS2_FALSE;
-    return AXIS2_SUCCESS;
-}
-            
-axis2_status_t AXIS2_CALL 
-sandesha2_sender_stop_sending (
+sandesha2_sender_stop_sending(
     sandesha2_sender_t *sender,
     const axutil_env_t *env)
 {
     sender->run_sender = AXIS2_FALSE;
+    sandesha2_sender_free(sender, env);
     return AXIS2_SUCCESS;
 }
             
-axis2_bool_t AXIS2_CALL 
-sandesha2_sender_is_sender_started(
-    sandesha2_sender_t *sender, 
-    const axutil_env_t *env)
-{
-    return sender->run_sender;
-}
-            
 axis2_status_t AXIS2_CALL 
 sandesha2_sender_run_for_seq(
     sandesha2_sender_t *sender, 
@@ -173,7 +127,6 @@
 {
     AXIS2_LOG_TRACE(env->log, AXIS2_LOG_SI, 
         "[sandesha2]Entry:sandesha2_sender_run_for_seq");
-    axutil_thread_mutex_lock(sender->mutex);
     AXIS2_PARAM_CHECK(env->error, conf_ctx, AXIS2_FAILURE);
    
     sender->conf_ctx = conf_ctx;
@@ -181,7 +134,6 @@
     sender->persistent_msg_ctx = persistent;
     sender->seq_id = seq_id;
     sandesha2_sender_run(sender, env);
-    axutil_thread_mutex_unlock(sender->mutex);
     AXIS2_LOG_TRACE(env->log, AXIS2_LOG_SI, 
         "[sandesha2]Exit:sandesha2_sender_run_for_seq");
     return AXIS2_SUCCESS;
@@ -204,10 +156,10 @@
 
     worker_thread = axutil_thread_pool_get_thread(env->thread_pool,
         sandesha2_sender_worker_func, (void*)args);
-    if(NULL == worker_thread)
+    if(!worker_thread)
     {
-        AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI, "[sandesha2]Thread creation "
-            "failed sandesha2_sender_run");
+        AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI, "[sandesha2]Thread creation "\
+            "failed for sandesha2_sender_run");
         return AXIS2_FAILURE;
     }
     axutil_thread_pool_thread_detach(env->thread_pool, worker_thread);     
@@ -251,23 +203,25 @@
         SANDESHA2_SENDER_SLEEP);
     if(sleep_time_param)
     {
-        sleep_time = AXIS2_ATOI(axutil_param_get_value(sleep_time_param, env));
+        sleep_time = AXIS2_ATOI(axutil_param_get_value(sleep_time_param, 
+            env));
     }
     axutil_qname_free(qname, env);
     seq_id = sender->seq_id;
     while(sender->run_sender)
     {
-        sandesha2_sender_mgr_t *mgr = NULL;
+        sandesha2_sender_mgr_t *sender_mgr = NULL;
         sandesha2_sender_bean_t *sender_bean = NULL;
         axis2_char_t *msg_id = NULL;
 
         seq_prop_mgr = sandesha2_storage_mgr_get_seq_property_mgr(
             storage_mgr, env);
-        mgr = sandesha2_storage_mgr_get_retrans_mgr(storage_mgr, env);
-        sender_bean = sandesha2_sender_mgr_get_next_msg_to_send(mgr, env, seq_id);
+        sender_mgr = sandesha2_storage_mgr_get_retrans_mgr(storage_mgr, env);
+        sender_bean = sandesha2_sender_mgr_get_next_msg_to_send(sender_mgr, env, 
+            seq_id);
         if(!sender_bean)
         {
-            AXIS2_USLEEP(100000);
+            AXIS2_USLEEP(sleep_time);
             continue;
         }
         msg_id = sandesha2_sender_bean_get_msg_id((sandesha2_rm_bean_t *) 
@@ -277,12 +231,11 @@
             axis2_bool_t status = AXIS2_TRUE;
             status = sandesha2_sender_worker_send(env, sender->conf_ctx, msg_id, 
                 sender->persistent_msg_ctx);
-            AXIS2_SLEEP(sleep_time * 2); 
             if(!status)
             {
                 AXIS2_LOG_DEBUG(env->log, AXIS2_LOG_SI, 
                     "[sandesha2]Stopping the sender for sequence %s", seq_id);
-                sandesha2_sender_stop_sender_for_seq(sender, env, seq_id);
+                sandesha2_sender_stop_sending(sender, env);
             }
         }
     }



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


Mime
View raw message