Author: damitha
Date: Sat Jan 26 18:46:18 2008
New Revision: 615547

URL: http://svn.apache.org/viewvc?rev=615547&view=rev
Log:
Fixing memory leaks

Modified:
    webservices/sandesha/trunk/c/src/msgprocessors/app_msg_processor.c
    webservices/sandesha/trunk/c/src/msgprocessors/close_seq_msg_processor.c
    webservices/sandesha/trunk/c/src/msgprocessors/create_seq_msg_processor.c
    webservices/sandesha/trunk/c/src/msgprocessors/terminate_seq_msg_processor.c
    webservices/sandesha/trunk/c/src/storage/sqlite/permanent_bean_mgr.c
    webservices/sandesha/trunk/c/src/storage/sqlite/permanent_storage_mgr.c
    
webservices/sandesha/trunk/c/src/storage/sqlite/sandesha2_permanent_bean_mgr.h
    webservices/sandesha/trunk/c/src/util/sandesha2_utils.c
    webservices/sandesha/trunk/c/src/util/terminate_mgr.c
    webservices/sandesha/trunk/c/src/workers/sender_worker.c

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?rev=615547&r1=615546&r2=615547&view=diff
==============================================================================
--- webservices/sandesha/trunk/c/src/msgprocessors/app_msg_processor.c 
(original)
+++ webservices/sandesha/trunk/c/src/msgprocessors/app_msg_processor.c Sat Jan 
26 18:46:18 2008
@@ -1393,6 +1393,7 @@
         axis2_engine_t *engine = NULL;
         engine = axis2_engine_create(env, conf_ctx);
         msg_ctx = sandesha2_msg_ctx_get_msg_ctx(ack_rm_msg, env);
+        AXIS2_LOG_DEBUG(env->log, AXIS2_LOG_SI, 
"[sandesha2]axis2_engine_send");
         sent = axis2_engine_send(engine, env, msg_ctx);
         if(ack_rm_msg)
             sandesha2_msg_ctx_free(ack_rm_msg, env);
@@ -1491,7 +1492,7 @@
         create_seq_msg, env), NULL);
 
     temp_opctx = axis2_msg_ctx_get_op_ctx(create_seq_msg, env);
-    axis2_op_ctx_increment_ref(temp_opctx, env);
+    /*axis2_op_ctx_increment_ref(temp_opctx, env);*/
     sandesha2_create_seq_mgr_insert(create_seq_mgr, env, create_seq_bean);
     addr_ns_uri = sandesha2_utils_get_seq_property(env, internal_seq_id, 
         SANDESHA2_SEQ_PROP_ADDRESSING_NAMESPACE_VALUE, seq_prop_mgr);

Modified: 
webservices/sandesha/trunk/c/src/msgprocessors/close_seq_msg_processor.c
URL: 
http://svn.apache.org/viewvc/webservices/sandesha/trunk/c/src/msgprocessors/close_seq_msg_processor.c?rev=615547&r1=615546&r2=615547&view=diff
==============================================================================
--- webservices/sandesha/trunk/c/src/msgprocessors/close_seq_msg_processor.c 
(original)
+++ webservices/sandesha/trunk/c/src/msgprocessors/close_seq_msg_processor.c 
Sat Jan 26 18:46:18 2008
@@ -176,6 +176,7 @@
     if(fault_rm_msg_ctx)
     {
         engine = axis2_engine_create(env, conf_ctx);
+        AXIS2_LOG_DEBUG(env->log, AXIS2_LOG_SI, 
"[sandesha2]axis2_engine_send");
         axis2_engine_send(engine, env, sandesha2_msg_ctx_get_msg_ctx(
             fault_rm_msg_ctx, env));
         if(fault_rm_msg_ctx)
@@ -230,6 +231,7 @@
     sandesha2_msg_ctx_add_soap_envelope(close_seq_res_rm_msg, env);
     
     engine = axis2_engine_create(env, conf_ctx);
+    AXIS2_LOG_DEBUG(env->log, AXIS2_LOG_SI, "[sandesha2]axis2_engine_send");
     axis2_engine_send(engine, env, close_seq_res_msg);
     if(engine)
         axis2_engine_free(engine, env);

Modified: 
webservices/sandesha/trunk/c/src/msgprocessors/create_seq_msg_processor.c
URL: 
http://svn.apache.org/viewvc/webservices/sandesha/trunk/c/src/msgprocessors/create_seq_msg_processor.c?rev=615547&r1=615546&r2=615547&view=diff
==============================================================================
--- webservices/sandesha/trunk/c/src/msgprocessors/create_seq_msg_processor.c 
(original)
+++ webservices/sandesha/trunk/c/src/msgprocessors/create_seq_msg_processor.c 
Sat Jan 26 18:46:18 2008
@@ -343,6 +343,7 @@
     axis2_op_ctx_set_response_written(op_ctx, env, AXIS2_TRUE);
     sandesha2_seq_mgr_update_last_activated_time(env, new_seq_id, 
seq_prop_mgr);
     engine = axis2_engine_create(env, conf_ctx);
+    AXIS2_LOG_DEBUG(env->log, AXIS2_LOG_SI, "[sandesha2]axis2_engine_send");
     axis2_engine_send(engine, env, out_msg_ctx);
     if(engine)
         axis2_engine_free(engine, env);

Modified: 
webservices/sandesha/trunk/c/src/msgprocessors/terminate_seq_msg_processor.c
URL: 
http://svn.apache.org/viewvc/webservices/sandesha/trunk/c/src/msgprocessors/terminate_seq_msg_processor.c?rev=615547&r1=615546&r2=615547&view=diff
==============================================================================
--- 
webservices/sandesha/trunk/c/src/msgprocessors/terminate_seq_msg_processor.c 
(original)
+++ 
webservices/sandesha/trunk/c/src/msgprocessors/terminate_seq_msg_processor.c 
Sat Jan 26 18:46:18 2008
@@ -489,6 +489,7 @@
     /* end test code */
     
     engine = axis2_engine_create(env, axis2_msg_ctx_get_conf_ctx(msg_ctx, 
env));
+    AXIS2_LOG_DEBUG(env->log, AXIS2_LOG_SI, "[sandesha2]axis2_engine_send");
     axis2_engine_send(engine, env, out_msg_ctx); 
     op_ctx = axis2_msg_ctx_get_op_ctx(out_msg_ctx, env);
     if(to_epr)

Modified: webservices/sandesha/trunk/c/src/storage/sqlite/permanent_bean_mgr.c
URL: 
http://svn.apache.org/viewvc/webservices/sandesha/trunk/c/src/storage/sqlite/permanent_bean_mgr.c?rev=615547&r1=615546&r2=615547&view=diff
==============================================================================
--- webservices/sandesha/trunk/c/src/storage/sqlite/permanent_bean_mgr.c 
(original)
+++ webservices/sandesha/trunk/c/src/storage/sqlite/permanent_bean_mgr.c Sat 
Jan 26 18:46:18 2008
@@ -35,7 +35,6 @@
  */
 struct sandesha2_permanent_bean_mgr
 {
-    axutil_thread_mutex_t *mutex;
     sqlite3 *dbconn;
     axis2_char_t *dbname;
 
@@ -177,8 +176,6 @@
     bean_mgr->dbconn = NULL;
     if(dbname)
         bean_mgr->dbname = axutil_strdup(env, dbname);
-    bean_mgr->mutex = axutil_thread_mutex_create(env->allocator,
-        AXIS2_THREAD_MUTEX_DEFAULT);
     return bean_mgr;
 }
 
@@ -200,11 +197,6 @@
         AXIS2_FREE(env->allocator, bean_mgr->dbname);
         bean_mgr->dbname = NULL;
     }
-    if(bean_mgr->mutex)
-    {
-        axutil_thread_mutex_destroy(bean_mgr->mutex);
-        bean_mgr->mutex = NULL;
-    }
     if(bean_mgr)
     {
         AXIS2_FREE(env->allocator, bean_mgr);
@@ -225,29 +217,25 @@
     AXIS2_LOG_TRACE(env->log, AXIS2_LOG_SI,
         "[sandesha2]Entry:sandesha2_permanent_bean_mgr_insert");
    
-    axutil_thread_mutex_lock(bean_mgr->mutex);
     if(!bean_mgr->dbconn)
         bean_mgr->dbconn = sandesha2_permanent_bean_mgr_get_dbconn(env, 
             bean_mgr->dbname);
     if(!bean_mgr->dbconn)
     {
-        axutil_thread_mutex_unlock(bean_mgr->mutex);
         return AXIS2_FALSE;
     }
     rc = sqlite3_exec(bean_mgr->dbconn, sql_stmt_insert, 0, 0, &error_msg);
     if(rc == SQLITE_BUSY)
         rc = sandesha2_permanent_bean_mgr_busy_handler(env, bean_mgr->dbconn, 
-            sql_stmt_insert, 0, 0, &error_msg, rc, bean_mgr->mutex);
+            sql_stmt_insert, 0, 0, &error_msg, rc);
     if( rc != SQLITE_OK )
     {
-        axutil_thread_mutex_unlock(bean_mgr->mutex);
         AXIS2_ERROR_SET(env->error, SANDESHA2_ERROR_SQL_ERROR, AXIS2_FAILURE);
         AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI, "sql stmt: %s. sql error: %s", 
             sql_stmt_insert, error_msg);
         sqlite3_free(error_msg);
         return AXIS2_FALSE;
     }
-    axutil_thread_mutex_unlock(bean_mgr->mutex);
     AXIS2_LOG_TRACE(env->log, AXIS2_LOG_SI,
         "[sandesha2]Exit:sandesha2_permanent_bean_mgr_insert");
     return AXIS2_TRUE;
@@ -261,30 +249,25 @@
 {
     axis2_char_t *error_msg = NULL;
     int rc = -1;
-    axutil_thread_mutex_lock(bean_mgr->mutex);
     if(!bean_mgr->dbconn)
         bean_mgr->dbconn = sandesha2_permanent_bean_mgr_get_dbconn(env, 
             bean_mgr->dbname);
     if(!bean_mgr->dbconn)
     {
-        axutil_thread_mutex_unlock(bean_mgr->mutex);
         return AXIS2_FALSE;
     }
     rc = sqlite3_exec(bean_mgr->dbconn, sql_stmt_remove, 0, 0, &error_msg);
     if(rc == SQLITE_BUSY)
         rc = sandesha2_permanent_bean_mgr_busy_handler(env, 
-            bean_mgr->dbconn, sql_stmt_remove, 0, 0, &error_msg, rc, 
-            bean_mgr->mutex);
+            bean_mgr->dbconn, sql_stmt_remove, 0, 0, &error_msg, rc);
     if(rc != SQLITE_OK )
     {
-        axutil_thread_mutex_unlock(bean_mgr->mutex);
         AXIS2_ERROR_SET(env->error, SANDESHA2_ERROR_SQL_ERROR, AXIS2_FAILURE);
         AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI, "sql stmt: %s. sql error: %s",
             sql_stmt_remove, error_msg);
         sqlite3_free(error_msg);
         return AXIS2_FALSE;
     }
-    axutil_thread_mutex_unlock(bean_mgr->mutex);
     return AXIS2_TRUE;
 }
 
@@ -301,7 +284,6 @@
     int rc = -1;
     AXIS2_LOG_TRACE(env->log, AXIS2_LOG_SI, 
         "[sandesha2]Entry:sandesha2_permanent_bean_mgr_retrieve");
-    axutil_thread_mutex_lock(bean_mgr->mutex);
     if(!bean_mgr->dbconn)
     {
         bean_mgr->dbconn = sandesha2_permanent_bean_mgr_get_dbconn(env, 
@@ -309,7 +291,6 @@
     }
     if(!bean_mgr->dbconn)
     {
-        axutil_thread_mutex_unlock(bean_mgr->mutex);
         return NULL;
     }
     args = AXIS2_MALLOC(env->allocator, sizeof(sandesha2_bean_mgr_args_t));
@@ -321,11 +302,10 @@
     {
         rc = sandesha2_permanent_bean_mgr_busy_handler(env, 
             bean_mgr->dbconn, sql_stmt_retrieve, retrieve_func, args, 
-            &error_msg, rc, bean_mgr->mutex);
+            &error_msg, rc);
     }
     if(rc != SQLITE_OK )
     {
-        axutil_thread_mutex_unlock(bean_mgr->mutex);
         AXIS2_ERROR_SET(env->error, SANDESHA2_ERROR_SQL_ERROR, AXIS2_FAILURE);
         AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI, "sql stmt: %s. sql error: %s",
             sql_stmt_retrieve, error_msg);
@@ -336,7 +316,6 @@
         bean = (void *) args->data;
     if(args)
         AXIS2_FREE(env->allocator, args);
-    axutil_thread_mutex_unlock(bean_mgr->mutex);
     AXIS2_LOG_TRACE(env->log, AXIS2_LOG_SI, 
         "[sandesha2]Exit:sandesha2_permanent_bean_mgr_retrieve");
     return bean;
@@ -352,31 +331,26 @@
     int rc = -1;
     AXIS2_LOG_TRACE(env->log, AXIS2_LOG_SI, 
         "[sandesha2]Entry:sandesha2_permanent_bean_mgr_update");
-    axutil_thread_mutex_lock(bean_mgr->mutex);
     if(!bean_mgr->dbconn)
         bean_mgr->dbconn = sandesha2_permanent_bean_mgr_get_dbconn(env, 
             bean_mgr->dbname);
     if(!bean_mgr->dbconn)
     {
-        axutil_thread_mutex_unlock(bean_mgr->mutex);
         return AXIS2_FALSE;
     }
 
     rc = sqlite3_exec(bean_mgr->dbconn, sql_stmt_update, 0, 0, &error_msg);
     if(rc == SQLITE_BUSY)
         rc = sandesha2_permanent_bean_mgr_busy_handler(env, 
-            bean_mgr->dbconn, sql_stmt_update, 0, 0, &error_msg, rc, 
-            bean_mgr->mutex);
+            bean_mgr->dbconn, sql_stmt_update, 0, 0, &error_msg, rc);
     if(rc != SQLITE_OK )
     {
-        axutil_thread_mutex_unlock(bean_mgr->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);
         sqlite3_free(error_msg);
         return AXIS2_FALSE;
     }
-    axutil_thread_mutex_unlock(bean_mgr->mutex);
     AXIS2_LOG_TRACE(env->log, AXIS2_LOG_SI, 
         "[sandesha2]Exit:sandesha2_permanent_bean_mgr_update");
     return AXIS2_TRUE;
@@ -393,7 +367,6 @@
     int rc = -1;
     axutil_array_list_t *data_array = NULL;
     axis2_char_t *error_msg = NULL;
-    axutil_thread_mutex_lock(bean_mgr->mutex);
     args = AXIS2_MALLOC(env->allocator, sizeof(sandesha2_bean_mgr_args_t));
     args->env = (axutil_env_t*)env;
     args->data = NULL;
@@ -402,20 +375,17 @@
             bean_mgr->dbname);
     if(!bean_mgr->dbconn)
     {
-        axutil_thread_mutex_unlock(bean_mgr->mutex);
         return NULL;
     }
     rc = sqlite3_exec(bean_mgr->dbconn, sql_stmt_find, find_func, args, 
         &error_msg);
     if(rc == SQLITE_BUSY)
         rc = sandesha2_permanent_bean_mgr_busy_handler(env, 
-            bean_mgr->dbconn, sql_stmt_find, find_func, args, &error_msg, 
-            rc, bean_mgr->mutex);
+            bean_mgr->dbconn, sql_stmt_find, find_func, args, &error_msg, rc);
     if(args->data)
         data_array = (axutil_array_list_t *) args->data;
     if(rc != SQLITE_OK )
     {
-        axutil_thread_mutex_unlock(bean_mgr->mutex);
         if(data_array)
             axutil_array_list_free(data_array, env);
         if(args)
@@ -428,7 +398,6 @@
     }
     if(args)
         AXIS2_FREE(env->allocator, args);
-    axutil_thread_mutex_unlock(bean_mgr->mutex);
     return data_array;
 }
 
@@ -445,13 +414,11 @@
     axis2_char_t sql_stmt_retrieve[512];
     AXIS2_LOG_TRACE(env->log, AXIS2_LOG_SI,
         
"[sandesha2]Entry:sandesha2_permanent_bean_mgr_retrieve_msg_store_bean");
-    axutil_thread_mutex_lock(bean_mgr->mutex);
     if(!bean_mgr->dbconn)
         bean_mgr->dbconn = sandesha2_permanent_bean_mgr_get_dbconn(env, 
             bean_mgr->dbname);
     if(!bean_mgr->dbconn)
     {
-        axutil_thread_mutex_unlock(bean_mgr->mutex);
         return NULL;
     }
     args = AXIS2_MALLOC(env->allocator, sizeof(sandesha2_bean_mgr_args_t));
@@ -467,11 +434,9 @@
     if(rc == SQLITE_BUSY)
         rc = sandesha2_permanent_bean_mgr_busy_handler(env, 
             bean_mgr->dbconn, sql_stmt_retrieve, 
-            sandesha2_msg_store_bean_retrieve_callback, args, &error_msg, rc, 
-            bean_mgr->mutex);
+            sandesha2_msg_store_bean_retrieve_callback, args, &error_msg, rc);
     if(rc != SQLITE_OK )
     {
-        axutil_thread_mutex_unlock(bean_mgr->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);
@@ -482,7 +447,6 @@
         msg_store_bean = (sandesha2_msg_store_bean_t *) args->data;
     if(args)
         AXIS2_FREE(env->allocator, args);
-    axutil_thread_mutex_unlock(bean_mgr->mutex);
     AXIS2_LOG_TRACE(env->log, AXIS2_LOG_SI,
         
"[sandesha2]Exit:sandesha2_permanent_bean_mgr_retrieve_msg_store_bean");
     return msg_store_bean;
@@ -548,13 +512,11 @@
         axutil_strlen(msg_recv_str) + sizeof(int) + 
axutil_strlen(in_msg_store_key) +
         axutil_strlen(prop_str) + axutil_strlen(action) + 512;
 
-    axutil_thread_mutex_lock(bean_mgr->mutex);
     if(!bean_mgr->dbconn)
         bean_mgr->dbconn = sandesha2_permanent_bean_mgr_get_dbconn(env, 
             bean_mgr->dbname);
     if(!bean_mgr->dbconn)
     {
-        axutil_thread_mutex_unlock(bean_mgr->mutex);
         return AXIS2_FALSE;
     }
 
@@ -571,11 +533,9 @@
     rc = sqlite3_exec(bean_mgr->dbconn, sql_stmt_update, 0, 0, &error_msg);
     if(rc == SQLITE_BUSY)
         rc = sandesha2_permanent_bean_mgr_busy_handler(env, 
-            bean_mgr->dbconn, sql_stmt_update, 0, 0, &error_msg, rc, 
-            bean_mgr->mutex);
+            bean_mgr->dbconn, sql_stmt_update, 0, 0, &error_msg, rc);
     if( rc != SQLITE_OK )
     {
-        axutil_thread_mutex_unlock(bean_mgr->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);
         AXIS2_FREE(env->allocator, sql_stmt_update);
@@ -583,7 +543,6 @@
         return AXIS2_FALSE;
     }
     AXIS2_FREE(env->allocator, sql_stmt_update);
-    axutil_thread_mutex_unlock(bean_mgr->mutex);
     AXIS2_LOG_TRACE(env->log, AXIS2_LOG_SI,
         "[sandesha2]Exit:sandesha2_permanent_bean_mgr_update_msg_store_bean");
     return AXIS2_TRUE;
@@ -649,13 +608,11 @@
         axutil_strlen(msg_recv_str) + sizeof(int) + 
axutil_strlen(in_msg_store_key) +
         axutil_strlen(prop_str) + axutil_strlen(action) + 512;
 
-    axutil_thread_mutex_lock(bean_mgr->mutex);
     if(!bean_mgr->dbconn)
         bean_mgr->dbconn = sandesha2_permanent_bean_mgr_get_dbconn(env, 
             bean_mgr->dbname);
     if(!bean_mgr->dbconn)
     {
-        axutil_thread_mutex_unlock(bean_mgr->mutex);
         return AXIS2_FALSE;
     }
 
@@ -672,11 +629,9 @@
     rc = sqlite3_exec(bean_mgr->dbconn, sql_stmt_insert, 0, 0, &error_msg);
     if(rc == SQLITE_BUSY)
         rc = sandesha2_permanent_bean_mgr_busy_handler(env, 
-            bean_mgr->dbconn, sql_stmt_insert, 0, 0, &error_msg, rc, 
-            bean_mgr->mutex);
+            bean_mgr->dbconn, sql_stmt_insert, 0, 0, &error_msg, rc);
     if( rc != SQLITE_OK )
     {
-        axutil_thread_mutex_unlock(bean_mgr->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);
         AXIS2_FREE(env->allocator, sql_stmt_insert);
@@ -684,7 +639,6 @@
         return AXIS2_FALSE;
     }
     AXIS2_FREE(env->allocator, sql_stmt_insert);
-    axutil_thread_mutex_unlock(bean_mgr->mutex);
     AXIS2_LOG_TRACE(env->log, AXIS2_LOG_SI,
         "[sandesha2]Exit:sandesha2_permanent_bean_mgr_insert_msg_store_bean");
     return AXIS2_TRUE;
@@ -701,31 +655,26 @@
     int rc = -1;
     AXIS2_LOG_TRACE(env->log, AXIS2_LOG_SI,
         "[sandesha2]Entry:sandesha2_permanent_bean_mgr_remove_msg_store_bean");
-    axutil_thread_mutex_lock(bean_mgr->mutex);
     if(!bean_mgr->dbconn)
         bean_mgr->dbconn = sandesha2_permanent_bean_mgr_get_dbconn(env, 
             bean_mgr->dbname);
     if(!bean_mgr->dbconn)
     {
-        axutil_thread_mutex_unlock(bean_mgr->mutex);
         return AXIS2_FALSE;
     }
     sprintf(sql_stmt_remove, "delete from msg where stored_key='%s'", key);
     rc = sqlite3_exec(bean_mgr->dbconn, sql_stmt_remove, 0, 0, &error_msg);
     if(rc == SQLITE_BUSY)
         rc = sandesha2_permanent_bean_mgr_busy_handler(env, 
-            bean_mgr->dbconn, sql_stmt_remove, 0, 0, &error_msg, rc, 
-            bean_mgr->mutex);
+            bean_mgr->dbconn, sql_stmt_remove, 0, 0, &error_msg, rc);
     if(rc != SQLITE_OK )
     {
-        axutil_thread_mutex_unlock(bean_mgr->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);
         sqlite3_free(error_msg);
         return AXIS2_FALSE;
     }
-    axutil_thread_mutex_unlock(bean_mgr->mutex);
     AXIS2_LOG_TRACE(env->log, AXIS2_LOG_SI,
         "[sandesha2]Exit:sandesha2_permanent_bean_mgr_remove_msg_store_bean");
     return AXIS2_TRUE;
@@ -750,13 +699,11 @@
     sql_size = axutil_strlen(seq_id) + axutil_strlen(response) + 
         sizeof(int) + sizeof(int) + 512;
 
-    axutil_thread_mutex_lock(bean_mgr->mutex);
     if(!bean_mgr->dbconn)
         bean_mgr->dbconn = sandesha2_permanent_bean_mgr_get_dbconn(env, 
             bean_mgr->dbname);
     if(!bean_mgr->dbconn)
     {
-        axutil_thread_mutex_unlock(bean_mgr->mutex);
         return AXIS2_FALSE;
     }
     sql_stmt_insert = AXIS2_MALLOC(env->allocator, sql_size);
@@ -766,11 +713,9 @@
     rc = sqlite3_exec(bean_mgr->dbconn, sql_stmt_insert, 0, 0, &error_msg);
     if(rc == SQLITE_BUSY)
         rc = sandesha2_permanent_bean_mgr_busy_handler(env, 
-            bean_mgr->dbconn, sql_stmt_insert, 0, 0, &error_msg, rc, 
-            bean_mgr->mutex);
+            bean_mgr->dbconn, sql_stmt_insert, 0, 0, &error_msg, rc);
     if( rc != SQLITE_OK )
     {
-        axutil_thread_mutex_unlock(bean_mgr->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);
         AXIS2_FREE(env->allocator, sql_stmt_insert);
@@ -778,7 +723,6 @@
         return AXIS2_FALSE;
     }
     AXIS2_FREE(env->allocator, sql_stmt_insert);
-    axutil_thread_mutex_unlock(bean_mgr->mutex);
     AXIS2_LOG_TRACE(env->log, AXIS2_LOG_SI,
         "[sandesha2]Exit:sandesha2_permanent_bean_mgr_store_response");
     return AXIS2_TRUE;
@@ -796,13 +740,11 @@
     int rc = -1;
     AXIS2_LOG_TRACE(env->log, AXIS2_LOG_SI,
         "[sandesha2]Entry:sandesha2_permanent_bean_mgr_remove_response");
-    axutil_thread_mutex_lock(bean_mgr->mutex);
     if(!bean_mgr->dbconn)
         bean_mgr->dbconn = sandesha2_permanent_bean_mgr_get_dbconn(env, 
             bean_mgr->dbname);
     if(!bean_mgr->dbconn)
     {
-        axutil_thread_mutex_unlock(bean_mgr->mutex);
         return AXIS2_FALSE;
     }
     sprintf(sql_stmt_remove, 
@@ -810,18 +752,15 @@
     rc = sqlite3_exec(bean_mgr->dbconn, sql_stmt_remove, 0, 0, &error_msg);
     if(rc == SQLITE_BUSY)
         rc = sandesha2_permanent_bean_mgr_busy_handler(env, 
-            bean_mgr->dbconn, sql_stmt_remove, 0, 0, &error_msg, rc, 
-            bean_mgr->mutex);
+            bean_mgr->dbconn, sql_stmt_remove, 0, 0, &error_msg, rc);
     if(rc != SQLITE_OK )
     {
-        axutil_thread_mutex_unlock(bean_mgr->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);
         sqlite3_free(error_msg);
         return AXIS2_FALSE;
     }
-    axutil_thread_mutex_unlock(bean_mgr->mutex);
     AXIS2_LOG_TRACE(env->log, AXIS2_LOG_SI,
         "[sandesha2]Exit:sandesha2_permanent_bean_mgr_remove_response");
     return AXIS2_TRUE;
@@ -838,13 +777,11 @@
     axis2_char_t *error_msg = NULL;
     int rc = -1;
     axis2_char_t sql_stmt_retrieve[512];
-    axutil_thread_mutex_lock(bean_mgr->mutex);
     if(!bean_mgr->dbconn)
         bean_mgr->dbconn = sandesha2_permanent_bean_mgr_get_dbconn(env, 
             bean_mgr->dbname);
     if(!bean_mgr->dbconn)
     {
-        axutil_thread_mutex_unlock(bean_mgr->mutex);
         return NULL;
     }
     args = AXIS2_MALLOC(env->allocator, sizeof(sandesha2_bean_mgr_args_t));
@@ -858,17 +795,15 @@
         rc = sandesha2_permanent_bean_mgr_busy_handler(env, 
             bean_mgr->dbconn, sql_stmt_retrieve, 
             sandesha2_permanent_bean_mgr_response_retrieve_callback, args, 
-            &error_msg, rc, bean_mgr->mutex);
+            &error_msg, rc);
     if(rc != SQLITE_OK )
     {
-        axutil_thread_mutex_unlock(bean_mgr->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);
         sqlite3_free(error_msg);
         return AXIS2_FALSE;
     }
-    axutil_thread_mutex_unlock(bean_mgr->mutex);
     return (sandesha2_response_t *) args->data;
 }
 
@@ -880,8 +815,7 @@
     int (*callback_func)(void *, int, char **, char **),
     void *args,
     char **error_msg,
-    int rc,
-    axutil_thread_mutex_t *mutex)
+    int rc)
 {
     int counter = 0;
     AXIS2_LOG_TRACE(env->log, AXIS2_LOG_SI, 
@@ -891,12 +825,8 @@
         if(*error_msg)
              sqlite3_free(*error_msg);
         counter++;
-        /* When this method is invoked, the mutex must have been locked,
-           so unlock before going to sleep */
-        axutil_thread_mutex_unlock(mutex);
         AXIS2_USLEEP(100000);
         /* Sleeping is over, lock again */
-        axutil_thread_mutex_lock(mutex);
         rc = sqlite3_exec(dbconn, sql_stmt, callback_func, args, error_msg);
     }
     AXIS2_LOG_TRACE(env->log, AXIS2_LOG_SI, 

Modified: 
webservices/sandesha/trunk/c/src/storage/sqlite/permanent_storage_mgr.c
URL: 
http://svn.apache.org/viewvc/webservices/sandesha/trunk/c/src/storage/sqlite/permanent_storage_mgr.c?rev=615547&r1=615546&r2=615547&view=diff
==============================================================================
--- webservices/sandesha/trunk/c/src/storage/sqlite/permanent_storage_mgr.c 
(original)
+++ webservices/sandesha/trunk/c/src/storage/sqlite/permanent_storage_mgr.c Sat 
Jan 26 18:46:18 2008
@@ -351,13 +351,19 @@
                     axutil_hash_set(msg_ctx_map, key, AXIS2_HASH_KEY_STRING, 
                         NULL);
                     AXIS2_FREE(env->allocator, key_l);
-                    if(msg_type != SANDESHA2_MSG_TYPE_APPLICATION && 
-                        msg_type !=SANDESHA2_MSG_TYPE_CREATE_SEQ)
+                    if(msg_type == SANDESHA2_MSG_TYPE_APPLICATION)
+                    {
+                        axiom_soap_envelope_t *soap_envelope = 
+                            axis2_msg_ctx_get_soap_envelope(msg_ctx, env);
+                        axiom_soap_envelope_free(soap_envelope, env);
+                        axis2_op_ctx_free(op_ctx, env);
+                    }
+                    else if(msg_type != SANDESHA2_MSG_TYPE_CREATE_SEQ)
                     {
                         axis2_msg_ctx_set_keep_alive(msg_ctx, env, 
AXIS2_FALSE);
                         axis2_msg_ctx_set_paused(msg_ctx, env, AXIS2_FALSE);
-                        axis2_msg_ctx_free(msg_ctx, env);
-                    } 
+                        axis2_op_ctx_free(op_ctx, env);
+                    }
                 }
             }
         }

Modified: 
webservices/sandesha/trunk/c/src/storage/sqlite/sandesha2_permanent_bean_mgr.h
URL: 
http://svn.apache.org/viewvc/webservices/sandesha/trunk/c/src/storage/sqlite/sandesha2_permanent_bean_mgr.h?rev=615547&r1=615546&r2=615547&view=diff
==============================================================================
--- 
webservices/sandesha/trunk/c/src/storage/sqlite/sandesha2_permanent_bean_mgr.h 
(original)
+++ 
webservices/sandesha/trunk/c/src/storage/sqlite/sandesha2_permanent_bean_mgr.h 
Sat Jan 26 18:46:18 2008
@@ -156,8 +156,7 @@
     int (*callback_func)(void *, int, char **, char **),
     void *args,
     char **error_msg,
-    int rc,
-    axutil_thread_mutex_t *mutex);
+    int rc);
 
 sqlite3 *
 sandesha2_permanent_bean_mgr_get_dbconn(

Modified: webservices/sandesha/trunk/c/src/util/sandesha2_utils.c
URL: 
http://svn.apache.org/viewvc/webservices/sandesha/trunk/c/src/util/sandesha2_utils.c?rev=615547&r1=615546&r2=615547&view=diff
==============================================================================
--- webservices/sandesha/trunk/c/src/util/sandesha2_utils.c (original)
+++ webservices/sandesha/trunk/c/src/util/sandesha2_utils.c Sat Jan 26 18:46:18 
2008
@@ -1368,7 +1368,6 @@
 
     axis2_msg_ctx_set_charset_encoding(new_msg_ctx, env,
         axis2_msg_ctx_get_charset_encoding(in_msg_ctx, env));
-
     return new_msg_ctx;
 }
 

Modified: webservices/sandesha/trunk/c/src/util/terminate_mgr.c
URL: 
http://svn.apache.org/viewvc/webservices/sandesha/trunk/c/src/util/terminate_mgr.c?rev=615547&r1=615546&r2=615547&view=diff
==============================================================================
--- webservices/sandesha/trunk/c/src/util/terminate_mgr.c (original)
+++ webservices/sandesha/trunk/c/src/util/terminate_mgr.c Sat Jan 26 18:46:18 
2008
@@ -790,6 +790,7 @@
         axis2_msg_ctx_set_paused(msg_ctx, env, AXIS2_TRUE);
         axis2_op_ctx_set_response_written(axis2_msg_ctx_get_op_ctx(msg_ctx, 
env), env, AXIS2_TRUE);
         engine = axis2_engine_create(env, conf_ctx);
+        AXIS2_LOG_DEBUG(env->log, AXIS2_LOG_SI, 
"[sandesha2]axis2_engine_send");
         axis2_engine_send(engine, env, msg_ctx2);
         if(engine)
         {
@@ -900,6 +901,7 @@
             axis2_msg_ctx_set_reply_to(msg_ctx1, env, reply_to_epr);
     }
     engine = axis2_engine_create(env, conf_ctx);
+    AXIS2_LOG_DEBUG(env->log, AXIS2_LOG_SI, "[sandesha2]axis2_engine_send");
     status = axis2_engine_send(engine, env, msg_ctx1);
     if(engine)
         axis2_engine_free(engine, env);

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?rev=615547&r1=615546&r2=615547&view=diff
==============================================================================
--- webservices/sandesha/trunk/c/src/workers/sender_worker.c (original)
+++ webservices/sandesha/trunk/c/src/workers/sender_worker.c Sat Jan 26 
18:46:18 2008
@@ -450,7 +450,7 @@
     sandesha2_storage_mgr_t *storage_mgr,
     int msg_type)
 {
-    /*axutil_property_t *property = NULL;*/
+    axutil_property_t *property = NULL;
     axis2_msg_ctx_t *res_msg_ctx = NULL;
     axiom_soap_envelope_t *res_envelope = NULL;
     axis2_char_t *soap_ns_uri = NULL;
@@ -473,6 +473,15 @@
          AXIOM_SOAP12_SOAP_ENVELOPE_NAMESPACE_URI;
 
     res_envelope = axis2_msg_ctx_get_response_soap_envelope(msg_ctx, env);
+    if(res_envelope && msg_type == SANDESHA2_MSG_TYPE_APPLICATION)
+    {
+        axiom_soap_envelope_increment_ref(res_envelope, env);
+        /* To avoid a second passing through incoming handlers at op_client*/
+        property = axutil_property_create_with_args(env, 0, 0, 0, 
+            AXIS2_VALUE_TRUE);
+        axis2_msg_ctx_set_property(msg_ctx, env, 
AXIS2_HANDLER_ALREADY_VISITED, 
+            property);
+    }
     if(!res_envelope)
     {
         AXIS2_LOG_DEBUG(env->log, AXIS2_LOG_SI, 
@@ -565,26 +574,6 @@
         }
     }
     /* Setting contexts TODO is this necessary? */
-    /*svc_grp = axis2_msg_ctx_get_svc_grp(res_msg_ctx, env);
-    if(svc_grp)
-    {
-        axis2_svc_grp_ctx_t *svc_grp_ctx = axis2_svc_grp_ctx_create(env, 
-            svc_grp, conf_ctx);
-        axis2_msg_ctx_set_svc_grp_ctx(res_msg_ctx, env, svc_grp_ctx);
-    }
-    svc = axis2_msg_ctx_get_svc(res_msg_ctx, env);
-    if(svc)
-    {
-        axis2_svc_grp_ctx_t *svc_grp_ctx = axis2_msg_ctx_get_svc_grp_ctx(
-            res_msg_ctx, env);
-        axis2_svc_ctx_t *svc_ctx = axis2_svc_ctx_create(env, svc, svc_grp_ctx);
-        if(svc_ctx)
-        {
-            axis2_svc_ctx_set_parent(svc_ctx, env, svc_grp_ctx);
-            axis2_msg_ctx_set_svc_ctx(res_msg_ctx, env, svc_ctx);
-        }
-        
-    }*/
     op = axis2_msg_ctx_get_op(res_msg_ctx, env);
     if(op)
     {
@@ -602,16 +591,6 @@
      * Message Receiver (may be callback MR).
      */
     axis2_msg_ctx_set_server_side(res_msg_ctx, env, AXIS2_TRUE);
-    /*property = axis2_msg_ctx_get_property(msg_ctx, env, AXIS2_TRANSPORT_IN);
-    if(property)
-    {
-               axutil_property_t *temp_prop = NULL;
-        temp_prop = axutil_property_clone(property, env);
-        axis2_msg_ctx_set_property(res_msg_ctx, env, AXIS2_TRANSPORT_IN, 
-            temp_prop);
-    }
-    else
-               AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI, "AXIS2_TRANSPORT_IN 
NULL");*/
 
     svc_ctx = axis2_msg_ctx_get_svc_ctx(msg_ctx, env);
     axis2_msg_ctx_set_svc_ctx(res_msg_ctx, env, svc_ctx);
@@ -624,7 +603,6 @@
         AXIS2_LOG_DEBUG(env->log, AXIS2_LOG_SI, 
             "[sandesha2]Response envelope found");
         axis2_msg_ctx_set_soap_envelope(res_msg_ctx, env, res_envelope);
-       
         engine = axis2_engine_create(env, axis2_msg_ctx_get_conf_ctx(msg_ctx, 
             env));
         if(AXIS2_TRUE == sandesha2_sender_worker_is_fault_envelope(env, 
@@ -637,13 +615,8 @@
     }
     if(free_msg)
     {
-        AXIS2_LOG_DEBUG(env->log, AXIS2_LOG_SI, "dam_msg_type1:%d", msg_type);
         axiom_soap_envelope_free(res_envelope, env);
     }
-    /* To avoid a second passing through incoming handlers at op_client*/
-    /*property = axutil_property_create_with_args(env, 0, 0, 0, 
AXIS2_VALUE_TRUE);
-    axis2_msg_ctx_set_property(msg_ctx, env, AXIS2_HANDLER_ALREADY_VISITED, 
-        property);*/
     AXIS2_LOG_TRACE(env->log, AXIS2_LOG_SI,
         "[sandesha2]Exit:sandesha2_sender_worker_check_for_sync_res");
     return AXIS2_SUCCESS;



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

Reply via email to