Return-Path: Delivered-To: apmail-ws-sandesha-dev-archive@www.apache.org Received: (qmail 25991 invoked from network); 17 Aug 2008 15:20:18 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.2) by minotaur.apache.org with SMTP; 17 Aug 2008 15:20:18 -0000 Received: (qmail 18566 invoked by uid 500); 17 Aug 2008 15:20:16 -0000 Delivered-To: apmail-ws-sandesha-dev-archive@ws.apache.org Received: (qmail 18514 invoked by uid 500); 17 Aug 2008 15:20:16 -0000 Mailing-List: contact sandesha-dev-help@ws.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Delivered-To: mailing list sandesha-dev@ws.apache.org Received: (qmail 18503 invoked by uid 500); 17 Aug 2008 15:20:16 -0000 Delivered-To: apmail-ws-sandesha-cvs@ws.apache.org Received: (qmail 18500 invoked by uid 99); 17 Aug 2008 15:20:16 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Sun, 17 Aug 2008 08:20:16 -0700 X-ASF-Spam-Status: No, hits=-2000.0 required=10.0 tests=ALL_TRUSTED X-Spam-Check-By: apache.org Received: from [140.211.11.4] (HELO eris.apache.org) (140.211.11.4) by apache.org (qpsmtpd/0.29) with ESMTP; Sun, 17 Aug 2008 15:19:27 +0000 Received: by eris.apache.org (Postfix, from userid 65534) id E9F722388988; Sun, 17 Aug 2008 08:19:55 -0700 (PDT) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: svn commit: r686617 - in /webservices/sandesha/tags/sandesha2/c/worker_thread_removed-23may2008: include/ samples/rm_echo_single_1_1/ src/core/ src/msgprocessors/ src/polling/ src/util/ Date: Sun, 17 Aug 2008 15:19:55 -0000 To: sandesha-cvs@ws.apache.org From: damitha@apache.org X-Mailer: svnmailer-1.0.8 Message-Id: <20080817151955.E9F722388988@eris.apache.org> X-Virus-Checked: Checked by ClamAV on apache.org Author: damitha Date: Sun Aug 17 08:19:54 2008 New Revision: 686617 URL: http://svn.apache.org/viewvc?rev=686617&view=rev Log: Code formatting and working on rm_echo_single_1_1 Modified: webservices/sandesha/tags/sandesha2/c/worker_thread_removed-23may2008/include/sandesha2_constants.h webservices/sandesha/tags/sandesha2/c/worker_thread_removed-23may2008/include/sandesha2_polling_mgr.h webservices/sandesha/tags/sandesha2/c/worker_thread_removed-23may2008/include/sandesha2_property_bean.h webservices/sandesha/tags/sandesha2/c/worker_thread_removed-23may2008/include/sandesha2_utils.h webservices/sandesha/tags/sandesha2/c/worker_thread_removed-23may2008/samples/rm_echo_single_1_1/rm_echo_single_1_1.c webservices/sandesha/tags/sandesha2/c/worker_thread_removed-23may2008/src/core/mod_sandesha2.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_res_msg_processor.c webservices/sandesha/tags/sandesha2/c/worker_thread_removed-23may2008/src/polling/polling_mgr.c webservices/sandesha/tags/sandesha2/c/worker_thread_removed-23may2008/src/util/msg_creator.c webservices/sandesha/tags/sandesha2/c/worker_thread_removed-23may2008/src/util/property_bean.c webservices/sandesha/tags/sandesha2/c/worker_thread_removed-23may2008/src/util/property_mgr.c webservices/sandesha/tags/sandesha2/c/worker_thread_removed-23may2008/src/util/sandesha2_utils.c Modified: webservices/sandesha/tags/sandesha2/c/worker_thread_removed-23may2008/include/sandesha2_constants.h URL: http://svn.apache.org/viewvc/webservices/sandesha/tags/sandesha2/c/worker_thread_removed-23may2008/include/sandesha2_constants.h?rev=686617&r1=686616&r2=686617&view=diff ============================================================================== --- webservices/sandesha/tags/sandesha2/c/worker_thread_removed-23may2008/include/sandesha2_constants.h (original) +++ webservices/sandesha/tags/sandesha2/c/worker_thread_removed-23may2008/include/sandesha2_constants.h Sun Aug 17 08:19:54 2008 @@ -370,6 +370,8 @@ #define SANDESHA2_PROPERTIES_INACTIVETIMEOUT_MEASURE "InactivityTimeoutMeasure" #define SANDESHA2_PROPERTIES_TERMINATE_DELAY "TerminateDelay" + + #define SANDESHA2_PROPERTIES_POLLING_DELAY "PollingWaitTime" #define SANDESHA2_PROPERTIES_STORAGE_MGR "StorageManager" @@ -432,6 +434,8 @@ #define SANDESHA2_CLIENT_SLEEP_TIME 4 /* 32 16 */ #define SANDESHA2_TERMINATE_DELAY 4 /* In seconds */ + + #define SANDESHA2_POLLING_DELAY 4 /* In seconds */ #define SANDESHA2_TEMP_SEQ_ID "uuid:tempID" @@ -517,7 +521,6 @@ #define SANDESHA2_DB_PASSWORD "db_password" #define SANDESHA2_SENDER_SLEEP "SenderSleepTime" #define SANDESHA2_INVOKER_SLEEP "InvokerSleepTime" - #define SANDESHA2_POLLING_WAIT "PollingWaitTime" #define SANDESHA2_MODULE "sandesha2" #define SANDESHA2_ISOLATED_LAST_MSG "isolated_last_msg" #define SANDESHA2_PROPERTY_STRING "propstr" Modified: webservices/sandesha/tags/sandesha2/c/worker_thread_removed-23may2008/include/sandesha2_polling_mgr.h URL: http://svn.apache.org/viewvc/webservices/sandesha/tags/sandesha2/c/worker_thread_removed-23may2008/include/sandesha2_polling_mgr.h?rev=686617&r1=686616&r2=686617&view=diff ============================================================================== --- webservices/sandesha/tags/sandesha2/c/worker_thread_removed-23may2008/include/sandesha2_polling_mgr.h (original) +++ webservices/sandesha/tags/sandesha2/c/worker_thread_removed-23may2008/include/sandesha2_polling_mgr.h Sun Aug 17 08:19:54 2008 @@ -31,64 +31,23 @@ #include #include #include +#include #ifdef __cplusplus extern "C" { #endif -typedef struct sandesha2_polling_mgr_t sandesha2_polling_mgr_t; - -AXIS2_EXTERN sandesha2_polling_mgr_t * AXIS2_CALL -sandesha2_polling_mgr_create( - const axutil_env_t *env); - -/** - * Frees the polling_mgr given as a void pointer. This method would cast the - * void parameter to an polling_mgr pointer and then call free method. - * @param polling_mgr pointer to polling_mgr as a void pointer - * @param env pointer to environment struct - * @return AXIS2_SUCCESS on success, else AXIS2_FAILURE - */ -AXIS2_EXTERN axis2_status_t AXIS2_CALL -sandesha2_polling_mgr_free_void_arg( - void *polling_mgr, - const axutil_env_t *env); - -axis2_status_t AXIS2_CALL -sandesha2_polling_mgr_free( - sandesha2_polling_mgr_t *polling_mgr, - const axutil_env_t *env); - -axis2_status_t AXIS2_CALL -sandesha2_polling_mgr_stop_polling ( - sandesha2_polling_mgr_t *polling_mgr, - const axutil_env_t *env); axis2_status_t AXIS2_CALL sandesha2_polling_mgr_start ( - sandesha2_polling_mgr_t *polling_mgr, const axutil_env_t *env, axis2_conf_ctx_t *conf_ctx, - const axis2_char_t *internal_seq_id); + sandesha2_msg_ctx_t *rm_msg_ctx, + const axis2_char_t *internal_sequence_id, + axis2_char_t *sequence_id, + const axis2_char_t *reply_to); -void AXIS2_CALL -sandesha2_polling_mgr_set_poll( - sandesha2_polling_mgr_t *polling_mgr, - const axutil_env_t *env, - axis2_bool_t poll); - -axis2_bool_t AXIS2_CALL -sandesha2_polling_mgr_is_poll( - sandesha2_polling_mgr_t *polling_mgr, - const axutil_env_t *env); - -void AXIS2_CALL -sandesha2_polling_mgr_schedule_polling_request( - sandesha2_polling_mgr_t *polling_mgr, - const axutil_env_t *env, - const axis2_char_t *internal_seq_id); - /** @} */ #ifdef __cplusplus } Modified: webservices/sandesha/tags/sandesha2/c/worker_thread_removed-23may2008/include/sandesha2_property_bean.h URL: http://svn.apache.org/viewvc/webservices/sandesha/tags/sandesha2/c/worker_thread_removed-23may2008/include/sandesha2_property_bean.h?rev=686617&r1=686616&r2=686617&view=diff ============================================================================== --- webservices/sandesha/tags/sandesha2/c/worker_thread_removed-23may2008/include/sandesha2_property_bean.h (original) +++ webservices/sandesha/tags/sandesha2/c/worker_thread_removed-23may2008/include/sandesha2_property_bean.h Sun Aug 17 08:19:54 2008 @@ -204,6 +204,16 @@ const axutil_env_t *env, int delay); +int AXIS2_CALL +sandesha2_property_bean_get_polling_delay ( + sandesha2_property_bean_t *bean, + const axutil_env_t *env); + +axis2_status_t AXIS2_CALL +sandesha2_property_bean_set_polling_delay( + sandesha2_property_bean_t *bean, + const axutil_env_t *env, + int delay); /** @} */ #ifdef __cplusplus Modified: webservices/sandesha/tags/sandesha2/c/worker_thread_removed-23may2008/include/sandesha2_utils.h URL: http://svn.apache.org/viewvc/webservices/sandesha/tags/sandesha2/c/worker_thread_removed-23may2008/include/sandesha2_utils.h?rev=686617&r1=686616&r2=686617&view=diff ============================================================================== --- webservices/sandesha/tags/sandesha2/c/worker_thread_removed-23may2008/include/sandesha2_utils.h (original) +++ webservices/sandesha/tags/sandesha2/c/worker_thread_removed-23may2008/include/sandesha2_utils.h Sun Aug 17 08:19:54 2008 @@ -117,12 +117,6 @@ axis2_char_t *seq_id, const axis2_bool_t persistent); -AXIS2_EXTERN axis2_status_t AXIS2_CALL -sandesha2_utils_start_polling_mgr( - const axutil_env_t *env, - axis2_conf_ctx_t *conf_ctx, - const axis2_char_t *internal_seq_id); - AXIS2_EXTERN axis2_char_t* AXIS2_CALL sandesha2_utils_get_internal_sequence_id( const axutil_env_t *env, @@ -242,11 +236,6 @@ const axutil_env_t *env, axis2_conf_ctx_t *conf_ctx); -AXIS2_EXTERN axis2_status_t AXIS2_CALL -sandesha2_utils_stop_polling_mgr( - const axutil_env_t *env, - axis2_conf_ctx_t *conf_ctx); - axutil_array_list_t *AXIS2_CALL sandesha2_utils_split( const axutil_env_t *env, Modified: webservices/sandesha/tags/sandesha2/c/worker_thread_removed-23may2008/samples/rm_echo_single_1_1/rm_echo_single_1_1.c URL: http://svn.apache.org/viewvc/webservices/sandesha/tags/sandesha2/c/worker_thread_removed-23may2008/samples/rm_echo_single_1_1/rm_echo_single_1_1.c?rev=686617&r1=686616&r2=686617&view=diff ============================================================================== --- webservices/sandesha/tags/sandesha2/c/worker_thread_removed-23may2008/samples/rm_echo_single_1_1/rm_echo_single_1_1.c (original) +++ webservices/sandesha/tags/sandesha2/c/worker_thread_removed-23may2008/samples/rm_echo_single_1_1/rm_echo_single_1_1.c Sun Aug 17 08:19:54 2008 @@ -30,7 +30,7 @@ #include #include -#define SANDESHA2_SLEEP 2 +#define SANDESHA2_SLEEP 12 static void usage( Modified: webservices/sandesha/tags/sandesha2/c/worker_thread_removed-23may2008/src/core/mod_sandesha2.c URL: http://svn.apache.org/viewvc/webservices/sandesha/tags/sandesha2/c/worker_thread_removed-23may2008/src/core/mod_sandesha2.c?rev=686617&r1=686616&r2=686617&view=diff ============================================================================== --- webservices/sandesha/tags/sandesha2/c/worker_thread_removed-23may2008/src/core/mod_sandesha2.c (original) +++ webservices/sandesha/tags/sandesha2/c/worker_thread_removed-23may2008/src/core/mod_sandesha2.c Sun Aug 17 08:19:54 2008 @@ -21,7 +21,6 @@ #include #include -/******************************************************************************/ axis2_status_t AXIS2_CALL mod_sandesha2_shutdown( axis2_module_t *module, @@ -46,19 +45,15 @@ mod_sandesha2_fill_handler_create_func_map }; -/******************************************************************************/ - AXIS2_EXTERN axis2_module_t * AXIS2_CALL mod_sandesha2_create( const axutil_env_t *env) { axis2_module_t *module = NULL; - module = AXIS2_MALLOC(env->allocator, - sizeof(axis2_module_t)); + module = AXIS2_MALLOC(env->allocator, sizeof(axis2_module_t)); - /*module->ops = AXIS2_MALLOC( - env->allocator, sizeof(axis2_module_ops_t));*/ module->ops = &mod_sandesha2_ops_var; + return module; } @@ -74,21 +69,19 @@ axis2_conf_t *conf = NULL; axis2_ctx_t *ctx = NULL; - AXIS2_LOG_TRACE(env->log, AXIS2_LOG_SI, "[sandesha2]Entry:mod_sandesha2_init"); + AXIS2_LOG_TRACE(env->log, AXIS2_LOG_SI, "[sandesha2] Entry:mod_sandesha2_init"); AXIS2_PARAM_CHECK(env->error, conf_ctx, AXIS2_FAILURE); AXIS2_PARAM_CHECK(env->error, module_desc, AXIS2_FAILURE); sandesha2_error_init(); - property_bean = sandesha2_property_mgr_load_properties_from_module_desc(env, - module_desc); + property_bean = sandesha2_property_mgr_load_properties_from_module_desc(env, module_desc); if(!property_bean) - property_bean = sandesha2_property_mgr_load_properties_from_def_values - (env); + { + property_bean = sandesha2_property_mgr_load_properties_from_def_values(env); + } - param = axutil_param_create(env, SANDESHA2_SANDESHA_PROPERTY_BEAN, - property_bean); - axutil_param_set_value_free(param, env, - sandesha2_property_bean_free_void_arg); + param = axutil_param_create(env, SANDESHA2_SANDESHA_PROPERTY_BEAN, property_bean); + axutil_param_set_value_free(param, env, sandesha2_property_bean_free_void_arg); conf = axis2_conf_ctx_get_conf(conf_ctx, env); axis2_conf_add_param(conf, env, param); @@ -97,17 +90,15 @@ axis2_ctx_set_property(ctx, env, SANDESHA2_INMEMORY_STORAGE_MGR, NULL); axis2_ctx_set_property(ctx, env, SANDESHA2_PERMANENT_STORAGE_MGR, NULL); - /*if(!sandesha2_permanent_storage_mgr_create_db(env, conf_ctx)) - { - return AXIS2_FAILURE; - }*/ - AXIS2_LOG_TRACE(env->log, AXIS2_LOG_SI, "[sandesha2]Exit:mod_sandesha2_init"); + AXIS2_LOG_TRACE(env->log, AXIS2_LOG_SI, "[sandesha2] Exit:mod_sandesha2_init"); + return AXIS2_SUCCESS; } axis2_status_t AXIS2_CALL -mod_sandesha2_shutdown(axis2_module_t *module, - const axutil_env_t *env) +mod_sandesha2_shutdown( + axis2_module_t *module, + const axutil_env_t *env) { /* currently we don't have conf_ctx passing to shutdown. When we have that @@ -133,22 +124,24 @@ } axis2_status_t AXIS2_CALL -mod_sandesha2_fill_handler_create_func_map(axis2_module_t *module, - const axutil_env_t *env) +mod_sandesha2_fill_handler_create_func_map( + axis2_module_t *module, + const axutil_env_t *env) { AXIS2_ENV_CHECK(env, AXIS2_FAILURE); module->handler_create_func_map = axutil_hash_make(env); if(!module->handler_create_func_map) { - AXIS2_ERROR_SET(env->error, AXIS2_ERROR_NO_MEMORY, - AXIS2_FAILURE); + AXIS2_ERROR_SET(env->error, AXIS2_ERROR_NO_MEMORY, AXIS2_FAILURE); return AXIS2_FAILURE; } axutil_hash_set(module->handler_create_func_map, "SandeshaGlobalInHandler", AXIS2_HASH_KEY_STRING, sandesha2_global_in_handler_create); + axutil_hash_set(module->handler_create_func_map, "SandeshaInHandler", AXIS2_HASH_KEY_STRING, sandesha2_in_handler_create); + axutil_hash_set(module->handler_create_func_map, "SandeshaOutHandler", AXIS2_HASH_KEY_STRING, sandesha2_out_handler_create); @@ -160,8 +153,9 @@ */ AXIS2_EXPORT int -axis2_get_instance(axis2_module_t **inst, - const axutil_env_t *env) +axis2_get_instance( + axis2_module_t **inst, + const axutil_env_t *env) { *inst = mod_sandesha2_create(env); if(!(*inst)) @@ -173,13 +167,17 @@ } AXIS2_EXPORT int -axis2_remove_instance(axis2_module_t *inst, - const axutil_env_t *env) +axis2_remove_instance( + axis2_module_t *inst, + const axutil_env_t *env) { axis2_status_t status = AXIS2_FAILURE; - if (inst) - { + + if (inst) + { status = mod_sandesha2_shutdown(inst, env); } + return status; } + 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=686617&r1=686616&r2=686617&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 Sun Aug 17 08:19:54 2008 @@ -2874,6 +2874,7 @@ if(is_svr_side && sandesha2_utils_is_rm_1_0_anonymous_acks_to(env, rm_version, from_acks_to_addr) && !to_addr) { + AXIS2_LOG_DEBUG(env->log, AXIS2_LOG_SI, "came1"); sandesha2_msg_creator_add_ack_msg(env, rm_msg_ctx, rmd_sequence_id, seq_prop_mgr); if(req_rm_msg_ctx) { @@ -3015,6 +3016,7 @@ if(!is_svr_side && (!reply_to_addr || sandesha2_utils_is_rm_1_0_anonymous_acks_to(env, rm_version, reply_to_addr))) { + AXIS2_LOG_DEBUG(env->log, AXIS2_LOG_SI, "came2"); axis2_transport_out_desc_t *transport_out = NULL; axis2_transport_sender_t *transport_sender = NULL; sandesha2_sender_bean_t *sender_bean = NULL; @@ -3141,6 +3143,7 @@ } else { + AXIS2_LOG_DEBUG(env->log, AXIS2_LOG_SI, "came3"); axis2_msg_ctx_increment_ref(app_msg_ctx, env); engine = axis2_engine_create(env, conf_ctx); if(axis2_engine_resume_send(engine, env, app_msg_ctx)) Modified: webservices/sandesha/tags/sandesha2/c/worker_thread_removed-23may2008/src/msgprocessors/create_seq_res_msg_processor.c URL: http://svn.apache.org/viewvc/webservices/sandesha/tags/sandesha2/c/worker_thread_removed-23may2008/src/msgprocessors/create_seq_res_msg_processor.c?rev=686617&r1=686616&r2=686617&view=diff ============================================================================== --- webservices/sandesha/tags/sandesha2/c/worker_thread_removed-23may2008/src/msgprocessors/create_seq_res_msg_processor.c (original) +++ webservices/sandesha/tags/sandesha2/c/worker_thread_removed-23may2008/src/msgprocessors/create_seq_res_msg_processor.c Sun Aug 17 08:19:54 2008 @@ -313,6 +313,7 @@ sandesha2_msg_ctx_t *create_seq_rm_msg = NULL; axis2_msg_ctx_t *create_seq_msg = NULL; axis2_char_t *acks_to = NULL; + axis2_char_t *reply_to_addr = NULL; next_msg_mgr = sandesha2_permanent_next_msg_mgr_create(env, dbname); offerd_seq_bean = sandesha2_seq_property_mgr_retrieve(seq_prop_mgr, env, internal_sequence_id, @@ -389,15 +390,11 @@ if(!axutil_strcmp(SANDESHA2_SPEC_VERSION_1_1, rm_spec_ver)) { - axis2_char_t *reply_to_addr = sandesha2_utils_get_seq_property(env, internal_sequence_id, + reply_to_addr = sandesha2_utils_get_seq_property(env, internal_sequence_id, SANDESHA2_SEQ_PROP_REPLY_TO_EPR, seq_prop_mgr); if(reply_to_addr) { polling_mode = sandesha2_utils_is_anon_uri(env, reply_to_addr); - if(reply_to_addr) - { - AXIS2_FREE(env->allocator, reply_to_addr); - } } } @@ -409,6 +406,11 @@ { AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI, "[sandesha2]create_seq_rm_msg is NULL"); + if(reply_to_addr) + { + AXIS2_FREE(env->allocator, reply_to_addr); + } + if(rmd_sequence_id) { AXIS2_FREE(env->allocator, rmd_sequence_id); @@ -460,6 +462,11 @@ { AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI, "[sandesha2] to_seq_bean is NULL"); + if(reply_to_addr) + { + AXIS2_FREE(env->allocator, reply_to_addr); + } + if(rmd_sequence_id) { AXIS2_FREE(env->allocator, rmd_sequence_id); @@ -514,17 +521,6 @@ sandesha2_storage_mgr_store_msg_ctx(storage_mgr, env, new_msg_store_key, create_seq_msg, AXIS2_TRUE); - if(create_seq_msg) - { - axis2_core_utils_reset_out_msg_ctx(env, create_seq_msg); - axis2_msg_ctx_free(create_seq_msg, env); - } - - if(create_seq_rm_msg) - { - sandesha2_msg_ctx_free(create_seq_rm_msg, env); - } - next_bean = sandesha2_next_msg_bean_create(env); sandesha2_next_msg_bean_set_seq_id(next_bean, env, rmd_sequence_id); sandesha2_next_msg_bean_set_internal_seq_id(next_bean, env, internal_sequence_id); @@ -539,7 +535,8 @@ /* If polling_mode is true, starting the polling manager */ if(polling_mode) { - sandesha2_utils_start_polling_mgr(env, conf_ctx, internal_sequence_id); + /*sandesha2_polling_mgr_start(env, conf_ctx, create_seq_rm_msg, internal_sequence_id, + rmd_sequence_id, reply_to_addr);*/ } sandesha2_next_msg_mgr_insert(next_msg_mgr, env, next_bean); @@ -580,6 +577,22 @@ sandesha2_seq_property_bean_free(addr_ver_bean, env); } + if(create_seq_msg) + { + axis2_core_utils_reset_out_msg_ctx(env, create_seq_msg); + axis2_msg_ctx_free(create_seq_msg, env); + } + + if(reply_to_addr) + { + AXIS2_FREE(env->allocator, reply_to_addr); + } + + if(create_seq_rm_msg) + { + sandesha2_msg_ctx_free(create_seq_rm_msg, env); + } + if(next_msg_mgr) { sandesha2_next_msg_mgr_free(next_msg_mgr, env); Modified: webservices/sandesha/tags/sandesha2/c/worker_thread_removed-23may2008/src/polling/polling_mgr.c URL: http://svn.apache.org/viewvc/webservices/sandesha/tags/sandesha2/c/worker_thread_removed-23may2008/src/polling/polling_mgr.c?rev=686617&r1=686616&r2=686617&view=diff ============================================================================== --- webservices/sandesha/tags/sandesha2/c/worker_thread_removed-23may2008/src/polling/polling_mgr.c (original) +++ webservices/sandesha/tags/sandesha2/c/worker_thread_removed-23may2008/src/polling/polling_mgr.c Sun Aug 17 08:19:54 2008 @@ -45,31 +45,15 @@ */ typedef struct sandesha2_polling_mgr_args sandesha2_polling_mgr_args_t; -struct sandesha2_polling_mgr_t -{ - axis2_conf_ctx_t *conf_ctx; - /** - * By adding an entry to this, the polling_mgr will be asked to do a polling - * request on this sequence. - */ - axutil_array_list_t *scheduled_polling_reqs; - axis2_bool_t poll; - axutil_thread_mutex_t *mutex; -}; - struct sandesha2_polling_mgr_args { - sandesha2_polling_mgr_t *impl; axutil_env_t *env; - sandesha2_storage_mgr_t *storage_mgr; + axis2_conf_ctx_t *conf_ctx; + sandesha2_msg_ctx_t *rm_msg_ctx; + axis2_char_t *internal_sequence_id; + axis2_char_t *sequence_id; }; -static axis2_status_t AXIS2_CALL -sandesha2_polling_mgr_run ( - sandesha2_polling_mgr_t *polling_mgr, - const axutil_env_t *env, - sandesha2_storage_mgr_t *storage_mgr); - /** * Thread worker function. */ @@ -78,129 +62,47 @@ axutil_thread_t *thd, void *data); -AXIS2_EXTERN sandesha2_polling_mgr_t* AXIS2_CALL -sandesha2_polling_mgr_create( - const axutil_env_t *env) -{ - sandesha2_polling_mgr_t *polling_mgr = NULL; - - polling_mgr = (sandesha2_polling_mgr_t *)AXIS2_MALLOC - (env->allocator, - sizeof(sandesha2_polling_mgr_t)); - - if(!polling_mgr) - { - AXIS2_ERROR_SET(env->error, AXIS2_ERROR_NO_MEMORY, AXIS2_FAILURE); - return NULL; - } - polling_mgr->scheduled_polling_reqs = NULL; - polling_mgr->poll = AXIS2_FALSE; - polling_mgr->mutex = axutil_thread_mutex_create(env->allocator, - AXIS2_THREAD_MUTEX_DEFAULT); - - return polling_mgr; -} - -axis2_status_t AXIS2_CALL -sandesha2_polling_mgr_free_void_arg( - void *polling_mgr, - const axutil_env_t *env) -{ - sandesha2_polling_mgr_t *polling_mgr_l = NULL; - - polling_mgr_l = (sandesha2_polling_mgr_t *) polling_mgr; - return sandesha2_polling_mgr_free(polling_mgr_l, env); -} - -axis2_status_t AXIS2_CALL -sandesha2_polling_mgr_free( - sandesha2_polling_mgr_t *polling_mgr, - const axutil_env_t *env) -{ - /* Do not free this */ - polling_mgr->conf_ctx = NULL; - - if(polling_mgr->mutex) - { - axutil_thread_mutex_destroy(polling_mgr->mutex); - polling_mgr->mutex = NULL; - } - if(polling_mgr->scheduled_polling_reqs) - { - axutil_array_list_free(polling_mgr->scheduled_polling_reqs, env); - polling_mgr->scheduled_polling_reqs = NULL; - } - AXIS2_FREE(env->allocator, polling_mgr); - return AXIS2_SUCCESS; -} - -axis2_status_t AXIS2_CALL -sandesha2_polling_mgr_stop_polling ( - sandesha2_polling_mgr_t *polling_mgr, - const axutil_env_t *env) -{ - sandesha2_polling_mgr_set_poll(polling_mgr, env, AXIS2_FALSE); - return AXIS2_SUCCESS; -} - axis2_status_t AXIS2_CALL sandesha2_polling_mgr_start ( - sandesha2_polling_mgr_t *polling_mgr, - const axutil_env_t *env, + const axutil_env_t *env, axis2_conf_ctx_t *conf_ctx, - const axis2_char_t *internal_seq_id) + sandesha2_msg_ctx_t *rm_msg_ctx, + const axis2_char_t *internal_sequence_id, + axis2_char_t *sequence_id, + const axis2_char_t *reply_to) { - sandesha2_storage_mgr_t *storage_mgr = NULL; - axis2_char_t *dbname = NULL; - AXIS2_LOG_TRACE(env->log, AXIS2_LOG_SI, - "[sandesha2]Entry:sandesha2_polling_mgr_start"); - AXIS2_PARAM_CHECK(env->error, conf_ctx, AXIS2_FAILURE); + axutil_thread_t *worker_thread = NULL; + sandesha2_polling_mgr_args_t *args = NULL; + axis2_char_t *wsrm_anon_reply_to_uri = NULL; + sandesha2_msg_ctx_t *make_conn_rm_msg_ctx = NULL; - axutil_thread_mutex_lock(polling_mgr->mutex); - polling_mgr->conf_ctx = conf_ctx; - polling_mgr->scheduled_polling_reqs = axutil_array_list_create(env, - AXIS2_ARRAY_LIST_DEFAULT_CAPACITY); + args = AXIS2_MALLOC(env->allocator, sizeof(sandesha2_polling_mgr_args_t)); + args->env = axutil_init_thread_env(env); + args->conf_ctx = conf_ctx; + args->internal_sequence_id = (axis2_char_t *) internal_sequence_id; + args->sequence_id = (axis2_char_t *) sequence_id; - if(!polling_mgr->conf_ctx) + if(sandesha2_utils_is_wsrm_anon_reply_to(env, reply_to)) { - axutil_thread_mutex_unlock(polling_mgr->mutex); - AXIS2_LOG_DEBUG(env->log, AXIS2_LOG_SI, "conf_ctx is NULL"); - return AXIS2_FAILURE; + wsrm_anon_reply_to_uri = (axis2_char_t *) reply_to; } - dbname = sandesha2_util_get_dbname(env, conf_ctx); - storage_mgr = sandesha2_utils_get_storage_mgr(env, dbname); - sandesha2_polling_mgr_set_poll(polling_mgr, env, AXIS2_TRUE); - sandesha2_polling_mgr_schedule_polling_request(polling_mgr, env, - internal_seq_id); - sandesha2_polling_mgr_run(polling_mgr, env, storage_mgr); - axutil_thread_mutex_unlock(polling_mgr->mutex); - AXIS2_LOG_TRACE(env->log, AXIS2_LOG_SI, - "[sandesha2]Exit:sandesha2_polling_mgr_start"); - return AXIS2_SUCCESS; -} - -static axis2_status_t AXIS2_CALL -sandesha2_polling_mgr_run ( - sandesha2_polling_mgr_t *polling_mgr, - const axutil_env_t *env, - sandesha2_storage_mgr_t *storage_mgr) -{ - axutil_thread_t *worker_thread = NULL; - sandesha2_polling_mgr_args_t *args = NULL; + + make_conn_rm_msg_ctx = sandesha2_msg_creator_create_make_connection_msg(env, rm_msg_ctx, + sequence_id, wsrm_anon_reply_to_uri, NULL); - args = AXIS2_MALLOC(env->allocator, sizeof( - sandesha2_polling_mgr_args_t)); - args->impl = polling_mgr; - args->env = (axutil_env_t*)env; - args->storage_mgr = storage_mgr; - worker_thread = axutil_thread_pool_get_thread(env->thread_pool, - sandesha2_polling_mgr_worker_func, (void*)args); + args->rm_msg_ctx = make_conn_rm_msg_ctx; + + worker_thread = axutil_thread_pool_get_thread(env->thread_pool, + sandesha2_polling_mgr_worker_func, (void*)args); + if(!worker_thread) { - AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI, "Thread creation failed" \ - " sandesha2_polling_mgr_run"); + AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI, + "Thread creation failed sandesha2_polling_mgr_run"); + return AXIS2_FAILURE; } + axutil_thread_pool_thread_detach(env->thread_pool, worker_thread); return AXIS2_SUCCESS; @@ -214,259 +116,155 @@ axutil_thread_t *thd, void *data) { - axis2_char_t *dbname = NULL; - sandesha2_polling_mgr_args_t *args = (sandesha2_polling_mgr_args_t*)data; - axutil_env_t *env = args->env; - sandesha2_polling_mgr_t *polling_mgr = args->impl; - sandesha2_storage_mgr_t *storage_mgr = args->storage_mgr; + axis2_char_t *dbname = NULL; + axis2_char_t *internal_sequence_id = NULL; + axis2_char_t *sequence_id = NULL; + axis2_conf_ctx_t *conf_ctx = NULL; + sandesha2_storage_mgr_t *storage_mgr = NULL; sandesha2_seq_property_mgr_t *seq_prop_mgr = NULL; sandesha2_sender_mgr_t *sender_mgr = NULL; sandesha2_next_msg_mgr_t *next_msg_mgr = NULL; - AXIS2_LOG_TRACE(env->log, AXIS2_LOG_SI, - "[sandesha2]Entry:sandesha2_polling_mgr_worker_func"); + axis2_engine_t *engine = NULL; + axis2_msg_ctx_t *make_conn_msg_ctx = NULL; + sandesha2_property_bean_t *property_bean = NULL; + axis2_conf_t *conf = NULL; + int wait_time = 0; + sandesha2_msg_ctx_t *make_conn_rm_msg_ctx = NULL; + + sandesha2_polling_mgr_args_t *args = (sandesha2_polling_mgr_args_t*)data; + axutil_env_t *env = args->env; + conf_ctx = args->conf_ctx; + make_conn_rm_msg_ctx = args->rm_msg_ctx; + internal_sequence_id = axutil_strdup(env, args->internal_sequence_id); + sequence_id = axutil_strdup(env, args->sequence_id); - dbname = sandesha2_util_get_dbname(env, polling_mgr->conf_ctx); + AXIS2_LOG_TRACE(env->log, AXIS2_LOG_SI, "[sandesha2] Entry:sandesha2_polling_mgr_worker_func"); + + dbname = sandesha2_util_get_dbname(env, conf_ctx); + + storage_mgr = sandesha2_utils_get_storage_mgr(env, dbname); seq_prop_mgr = sandesha2_permanent_seq_property_mgr_create(env, dbname); sender_mgr = sandesha2_permanent_sender_mgr_create(env, dbname); next_msg_mgr = sandesha2_permanent_next_msg_mgr_create(env, dbname); + engine = axis2_engine_create(env, conf_ctx); + + make_conn_msg_ctx = sandesha2_msg_ctx_get_msg_ctx(make_conn_rm_msg_ctx, env); + + conf = axis2_conf_ctx_get_conf(conf_ctx, env); + property_bean = sandesha2_utils_get_property_bean(env, conf); + wait_time = sandesha2_property_bean_get_polling_delay(property_bean, env); - while(polling_mgr->poll) + while(AXIS2_TRUE) { - sandesha2_next_msg_bean_t *next_msg_bean = NULL; - sandesha2_msg_ctx_t *ref_rm_msg_ctx = NULL; - sandesha2_msg_ctx_t *make_conn_rm_msg_ctx = NULL; - sandesha2_sender_bean_t *make_conn_sender_bean = NULL; - int size = 0; - axis2_char_t *seq_id = NULL; - axis2_char_t *make_conn_seq_id = NULL; - axis2_char_t *ref_msg_key = NULL; - axis2_char_t *seq_prop_key = NULL; - axis2_char_t *reply_to = NULL; - axis2_char_t *wsrm_anon_reply_to_uri = NULL; axis2_char_t *make_conn_msg_store_key = NULL; - axis2_char_t *msg_id = NULL; - axis2_msg_ctx_t *ref_msg_ctx = NULL; - axis2_msg_ctx_t *make_conn_msg_ctx = NULL; - axis2_endpoint_ref_t *to = NULL; axutil_property_t *property = NULL; - axutil_qname_t *qname = NULL; - axutil_param_t *wait_time_param = NULL; - int wait_time = 0; - axis2_conf_t *conf = NULL; - axis2_module_desc_t *module_desc = NULL; axis2_status_t status = AXIS2_FAILURE; - conf = axis2_conf_ctx_get_conf(polling_mgr->conf_ctx, env); - qname = axutil_qname_create(env, "sandesha2", NULL, NULL); - module_desc = axis2_conf_get_module(conf, env, qname); - wait_time_param = axis2_module_desc_get_param(module_desc, env, - SANDESHA2_POLLING_WAIT); - if(wait_time_param) - { - wait_time = AXIS2_ATOI(axutil_param_get_value(wait_time_param, env)); - } - if(qname) - axutil_qname_free(qname, env); AXIS2_SLEEP(wait_time); - /* 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) - size = axutil_array_list_size(polling_mgr->scheduled_polling_reqs, - env); - if(size > 0) - { - seq_id = axutil_array_list_get(polling_mgr->scheduled_polling_reqs, - env, 0); - /*axutil_array_list_remove(polling_mgr->scheduled_polling_reqs, env, 0);*/ - } - if(!seq_id) - { - sandesha2_next_msg_bean_t *find_bean = - sandesha2_next_msg_bean_create(env); - int size = 0; - if(find_bean) - { - axutil_array_list_t *results = NULL; - sandesha2_next_msg_bean_set_polling_mode(find_bean, env, - AXIS2_TRUE); - results = sandesha2_next_msg_mgr_find(next_msg_mgr, env, - find_bean); - if(results) - size = axutil_array_list_size(results, env); - if(size > 0) - { - unsigned int rand_var = - axutil_rand_get_seed_value_based_on_time(env); - int item = axutil_rand_with_range(&rand_var, 0, size); - item--; - next_msg_bean = (sandesha2_next_msg_bean_t *) - axutil_array_list_get(results, env, item); - } - - } - } - else - { - sandesha2_next_msg_bean_t *find_bean = - sandesha2_next_msg_bean_create(env); - if(find_bean) - { - sandesha2_next_msg_bean_set_polling_mode(find_bean, env, - AXIS2_TRUE); - sandesha2_next_msg_bean_set_internal_seq_id(find_bean, env, seq_id); - next_msg_bean = sandesha2_next_msg_mgr_find_unique(next_msg_mgr, - env, find_bean); - } - } - /* If no valid entry is found, try again later */ - if(!next_msg_bean) - { - AXIS2_LOG_DEBUG(env->log, AXIS2_LOG_SI, - "No valid MakeConnection entry is found."); - continue; - } - make_conn_seq_id = sandesha2_next_msg_bean_get_seq_id(next_msg_bean, env); - /* Create a MakeConnection message */ - ref_msg_key = sandesha2_next_msg_bean_get_ref_msg_key(next_msg_bean, env); - seq_prop_key = make_conn_seq_id; - reply_to = sandesha2_utils_get_seq_property(env, seq_prop_key, - SANDESHA2_SEQ_PROP_REPLY_TO_EPR, seq_prop_mgr); - if(sandesha2_utils_is_wsrm_anon_reply_to(env, reply_to)) - wsrm_anon_reply_to_uri = reply_to; - ref_msg_ctx = sandesha2_storage_mgr_retrieve_msg_ctx(storage_mgr, env, - ref_msg_key, polling_mgr->conf_ctx, AXIS2_FALSE); - if(ref_msg_ctx) - ref_rm_msg_ctx = sandesha2_msg_init_init_msg(env, ref_msg_ctx); - make_conn_rm_msg_ctx = - sandesha2_msg_creator_create_make_connection_msg(env, - ref_rm_msg_ctx, make_conn_seq_id, wsrm_anon_reply_to_uri, seq_prop_mgr); - if(reply_to) - AXIS2_FREE(env->allocator, reply_to); - if(!make_conn_rm_msg_ctx) - { - AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI, "No memory"); - AXIS2_ERROR_SET(env->error, AXIS2_ERROR_NO_MEMORY, AXIS2_FAILURE); - if(seq_prop_mgr) - sandesha2_seq_property_mgr_free(seq_prop_mgr, env); - if(sender_mgr) - sandesha2_sender_mgr_free(sender_mgr, env); - if(next_msg_mgr) - sandesha2_next_msg_mgr_free(next_msg_mgr, env); - return NULL; - } - sandesha2_msg_ctx_set_property(make_conn_rm_msg_ctx, env, - AXIS2_TRANSPORT_IN, NULL); - /* Storing the MakeConnection message */ + + sandesha2_msg_ctx_set_property(make_conn_rm_msg_ctx, env, AXIS2_TRANSPORT_IN, NULL); make_conn_msg_store_key = axutil_uuid_gen(env); - property = axutil_property_create_with_args(env, 0, 0, 0, seq_prop_key); + property = axutil_property_create_with_args(env, 0, 0, 0, sequence_id); sandesha2_msg_ctx_set_property(make_conn_rm_msg_ctx, env, - SANDESHA2_MSG_CTX_PROP_SEQUENCE_PROPERTY_KEY, property); - make_conn_msg_ctx = sandesha2_msg_ctx_get_msg_ctx(make_conn_rm_msg_ctx, - env); - sandesha2_storage_mgr_store_msg_ctx(storage_mgr, env, - make_conn_msg_store_key, make_conn_msg_ctx, AXIS2_TRUE); + SANDESHA2_MSG_CTX_PROP_SEQUENCE_PROPERTY_KEY, property); + + /*sandesha2_storage_mgr_store_msg_ctx(storage_mgr, env, make_conn_msg_store_key, + make_conn_msg_ctx, AXIS2_TRUE);*/ + /* Adde an entry for the MakeConnection message to the sender(with, * send=true, resend=false) */ - make_conn_sender_bean = sandesha2_sender_bean_create(env); + /*make_conn_sender_bean = sandesha2_sender_bean_create(env); if(make_conn_sender_bean) { long millisecs = 0; + millisecs = sandesha2_utils_get_current_time_in_millis(env); - sandesha2_sender_bean_set_time_to_send(make_conn_sender_bean, env, - millisecs); + sandesha2_sender_bean_set_time_to_send(make_conn_sender_bean, env, millisecs); sandesha2_sender_bean_set_msg_ctx_ref_key(make_conn_sender_bean, env, - make_conn_msg_store_key); + make_conn_msg_store_key); + msg_id = sandesha2_msg_ctx_get_msg_id(make_conn_rm_msg_ctx, env); sandesha2_sender_bean_set_msg_id(make_conn_sender_bean, env, msg_id); sandesha2_sender_bean_set_msg_type(make_conn_sender_bean, env, SANDESHA2_MSG_TYPE_MAKE_CONNECTION_MSG); + sandesha2_sender_bean_set_resend(make_conn_sender_bean, env, AXIS2_FALSE); sandesha2_sender_bean_set_send(make_conn_sender_bean, env, AXIS2_TRUE); - /*sandesha2_sender_bean_set_seq_id(make_conn_sender_bean, env, seq_id);*/ + //sandesha2_sender_bean_set_seq_id(make_conn_sender_bean, env, seq_id); AXIS2_LOG_DEBUG(env->log, AXIS2_LOG_SI, "[sandesha2]seq_id:%s", seq_id); - sandesha2_sender_bean_set_internal_seq_id(make_conn_sender_bean, - env, seq_id); + sandesha2_sender_bean_set_internal_seq_id(make_conn_sender_bean, env, seq_id); to = sandesha2_msg_ctx_get_to(make_conn_rm_msg_ctx, env); if(to) { - axis2_char_t *address = (axis2_char_t *) - axis2_endpoint_ref_get_address( + axis2_char_t *address = (axis2_char_t *) axis2_endpoint_ref_get_address( (const axis2_endpoint_ref_t *) to, env); - sandesha2_sender_bean_set_to_address(make_conn_sender_bean, env, - address); + sandesha2_sender_bean_set_to_address(make_conn_sender_bean, env, address); } - } + }*/ + /* This message should not be sent untils it is qualified. i.e. Till * it is sent through the sandesha2_transport_sender */ - property = axutil_property_create_with_args(env, 0, 0, 0, - AXIS2_VALUE_FALSE); - sandesha2_msg_ctx_set_property(make_conn_rm_msg_ctx, env, - SANDESHA2_QUALIFIED_FOR_SENDING, property); + /*property = axutil_property_create_with_args(env, 0, 0, 0, AXIS2_VALUE_FALSE); + sandesha2_msg_ctx_set_property(make_conn_rm_msg_ctx, env, SANDESHA2_QUALIFIED_FOR_SENDING, + property); + if(sender_mgr) { - sandesha2_sender_mgr_insert(sender_mgr, env, - make_conn_sender_bean); - } - AXIS2_LOG_DEBUG(env->log, AXIS2_LOG_SI, "[sandesha2]Sending the make "\ - "connection message for the sequence with internal sequence id %s", - seq_id); - status = sandesha2_utils_execute_and_store(env, make_conn_rm_msg_ctx, - make_conn_msg_store_key); - if(!status) + sandesha2_sender_mgr_insert(sender_mgr, env, make_conn_sender_bean); + }*/ + + AXIS2_LOG_DEBUG(env->log, AXIS2_LOG_SI, + "[sandesha2] Sending the make connection message for the sequence with internal "\ + "sequence id %s", internal_sequence_id); + + /*status = sandesha2_utils_execute_and_store(env, make_conn_rm_msg_ctx, + make_conn_msg_store_key);*/ + + AXIS2_LOG_DEBUG(env->log, AXIS2_LOG_SI, "came10"); + status = axis2_engine_send(engine, env, make_conn_msg_ctx); + + if(AXIS2_SUCCESS != status) { - AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI, - "[sandesha2]make_connection sending failed"); + AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI, "[sandesha2]make_connection sending failed"); + if(seq_prop_mgr) + { sandesha2_seq_property_mgr_free(seq_prop_mgr, env); + } + if(sender_mgr) + { sandesha2_sender_mgr_free(sender_mgr, env); + } + if(next_msg_mgr) + { sandesha2_next_msg_mgr_free(next_msg_mgr, env); + } + return NULL; } } + if(seq_prop_mgr) + { sandesha2_seq_property_mgr_free(seq_prop_mgr, env); + } + if(sender_mgr) + { sandesha2_sender_mgr_free(sender_mgr, env); + } + if(next_msg_mgr) + { sandesha2_next_msg_mgr_free(next_msg_mgr, env); - AXIS2_LOG_TRACE(env->log, AXIS2_LOG_SI, - "[sandesha2]Exit:sandesha2_polling_mgr_worker_func"); - return NULL; -} - -void AXIS2_CALL -sandesha2_polling_mgr_set_poll( - sandesha2_polling_mgr_t *polling_mgr, - const axutil_env_t *env, - axis2_bool_t poll) -{ - polling_mgr->poll = poll; -} + } -axis2_bool_t AXIS2_CALL -sandesha2_polling_mgr_is_poll( - sandesha2_polling_mgr_t *polling_mgr, - const axutil_env_t *env) -{ - return polling_mgr->poll; -} + AXIS2_LOG_TRACE(env->log, AXIS2_LOG_SI, "[sandesha2] Exit:sandesha2_polling_mgr_worker_func"); -void AXIS2_CALL -sandesha2_polling_mgr_schedule_polling_request( - sandesha2_polling_mgr_t *polling_mgr, - const axutil_env_t *env, - const axis2_char_t *internal_seq_id) -{ - if(!axutil_array_list_contains(polling_mgr->scheduled_polling_reqs, env, - (axis2_char_t *)internal_seq_id)) - { - axutil_array_list_add(polling_mgr->scheduled_polling_reqs, env, - internal_seq_id); - } + return NULL; } Modified: webservices/sandesha/tags/sandesha2/c/worker_thread_removed-23may2008/src/util/msg_creator.c URL: http://svn.apache.org/viewvc/webservices/sandesha/tags/sandesha2/c/worker_thread_removed-23may2008/src/util/msg_creator.c?rev=686617&r1=686616&r2=686617&view=diff ============================================================================== --- webservices/sandesha/tags/sandesha2/c/worker_thread_removed-23may2008/src/util/msg_creator.c (original) +++ webservices/sandesha/tags/sandesha2/c/worker_thread_removed-23may2008/src/util/msg_creator.c Sun Aug 17 08:19:54 2008 @@ -1031,12 +1031,6 @@ rm_version = sandesha2_msg_ctx_get_rm_spec_ver(ref_rm_msg_ctx, env); } - /*qname = axutil_qname_create(env, "MakeConnectionOperation", NULL, NULL); - make_conn_op = axis2_op_create_with_qname(env, qname); - if(qname) - axutil_qname_free(qname, env); - */ - make_conn_msg_ctx = sandesha2_utils_create_new_related_msg_ctx(env, ref_rm_msg_ctx); if(make_conn_msg_ctx) { @@ -1046,7 +1040,7 @@ /* This if block is an hack to add the addressing handlers to the outflow. * Check whether this is not a hack */ - if(ref_msg_ctx) + /*if(ref_msg_ctx) { axis2_op_t *op = axis2_msg_ctx_get_op(ref_msg_ctx, env); axis2_op_t *make_conn_op = axis2_msg_ctx_get_op(make_conn_msg_ctx, env); @@ -1059,6 +1053,7 @@ axutil_array_list_t *new_flow = axutil_array_list_create(env, 0); for(i = 0; i < size; i++) { + AXIS2_LOG_DEBUG(env->log, AXIS2_LOG_SI, "came8"); const axis2_phase_t *phase = axutil_array_list_get(out_flow, env, i); const axis2_char_t *phase_name = axis2_phase_get_name(phase, env); if(0 == axutil_strcmp(phase_name, AXIS2_PHASE_MESSAGE_OUT)) @@ -1084,7 +1079,8 @@ } axis2_op_set_in_flow(make_conn_op, env, new_flow); } - } + }*/ + make_conn = sandesha2_make_connection_create(env, rm_ns_value); if(make_conn_seq_id) { @@ -1096,6 +1092,7 @@ if(make_conn) sandesha2_make_connection_set_identifier(make_conn, env, identifier); } + if(make_conn_anon_uri) { sandesha2_address_t *address = sandesha2_address_create(env, @@ -1107,6 +1104,7 @@ if(make_conn) sandesha2_make_connection_set_address(make_conn, env, address); } + if(make_conn_msg_ctx) { axis2_endpoint_ref_t *to = NULL; @@ -1124,6 +1122,7 @@ env, rm_version); axis2_msg_ctx_set_wsa_action(make_conn_msg_ctx, env, wsa_action); axis2_msg_ctx_set_message_id(make_conn_msg_ctx, env, axutil_uuid_gen(env)); + AXIS2_LOG_DEBUG(env->log, AXIS2_LOG_SI, "came9"); sandesha2_msg_ctx_set_make_connection(make_conn_rm_msg_ctx, env, make_conn); /* Generating the soap envelope */ Modified: webservices/sandesha/tags/sandesha2/c/worker_thread_removed-23may2008/src/util/property_bean.c URL: http://svn.apache.org/viewvc/webservices/sandesha/tags/sandesha2/c/worker_thread_removed-23may2008/src/util/property_bean.c?rev=686617&r1=686616&r2=686617&view=diff ============================================================================== --- webservices/sandesha/tags/sandesha2/c/worker_thread_removed-23may2008/src/util/property_bean.c (original) +++ webservices/sandesha/tags/sandesha2/c/worker_thread_removed-23may2008/src/util/property_bean.c Sun Aug 17 08:19:54 2008 @@ -34,6 +34,7 @@ axutil_array_list_t *msg_types_to_drop; int max_retrans_count; int terminate_delay; + int polling_delay; axis2_char_t *db_path; }; @@ -60,6 +61,7 @@ bean->msg_types_to_drop = NULL; bean->max_retrans_count = 0; bean->terminate_delay = 0; + bean->polling_delay = 0; bean->db_path = NULL; return bean; @@ -324,3 +326,21 @@ return AXIS2_SUCCESS; } +int AXIS2_CALL +sandesha2_property_bean_get_polling_delay ( + sandesha2_property_bean_t *bean, + const axutil_env_t *env) +{ + return bean->polling_delay; +} + +axis2_status_t AXIS2_CALL +sandesha2_property_bean_set_polling_delay( + sandesha2_property_bean_t *bean, + const axutil_env_t *env, + int delay) +{ + bean->polling_delay = delay; + return AXIS2_SUCCESS; +} + Modified: webservices/sandesha/tags/sandesha2/c/worker_thread_removed-23may2008/src/util/property_mgr.c URL: http://svn.apache.org/viewvc/webservices/sandesha/tags/sandesha2/c/worker_thread_removed-23may2008/src/util/property_mgr.c?rev=686617&r1=686616&r2=686617&view=diff ============================================================================== --- webservices/sandesha/tags/sandesha2/c/worker_thread_removed-23may2008/src/util/property_mgr.c (original) +++ webservices/sandesha/tags/sandesha2/c/worker_thread_removed-23may2008/src/util/property_mgr.c Sun Aug 17 08:19:54 2008 @@ -75,27 +75,29 @@ const axutil_env_t *env) { sandesha2_property_bean_t *property_bean = NULL; + property_bean = sandesha2_property_bean_create(env); - sandesha2_property_bean_set_exp_backoff(property_bean, env, - SANDESHA2_DEF_VAL_EXP_BACKOFF); - sandesha2_property_bean_set_retrans_interval(property_bean, env, - SANDESHA2_DEF_VAL_RETR_COUNT); - sandesha2_property_bean_set_ack_interval(property_bean, env, - SANDESHA2_DEF_VAL_ACK_INTERVAL); - sandesha2_property_bean_set_inactive_timeout_interval_with_units( - property_bean, env, SANDESHA2_DEF_VAL_INACTIVETIMEOUT, - SANDESHA2_DEF_VAL_INACTIVETIMEOUT_MEASURE); - sandesha2_property_bean_set_in_order(property_bean, env, - SANDESHA2_DEF_VAL_INORDER_INVOCATION); + sandesha2_property_bean_set_exp_backoff(property_bean, env, SANDESHA2_DEF_VAL_EXP_BACKOFF); + sandesha2_property_bean_set_retrans_interval(property_bean, env, SANDESHA2_DEF_VAL_RETR_COUNT); + sandesha2_property_bean_set_ack_interval(property_bean, env, SANDESHA2_DEF_VAL_ACK_INTERVAL); + sandesha2_property_bean_set_inactive_timeout_interval_with_units(property_bean, env, + SANDESHA2_DEF_VAL_INACTIVETIMEOUT, SANDESHA2_DEF_VAL_INACTIVETIMEOUT_MEASURE); + + sandesha2_property_bean_set_in_order(property_bean, env, SANDESHA2_DEF_VAL_INORDER_INVOCATION); sandesha2_property_bean_set_msg_types_to_drop(property_bean, env, NULL); + /* will be useful when we are loading libraries */ - sandesha2_property_bean_set_max_retrans_count(property_bean, env, - SANDESHA2_DEF_VAL_MAX_RETR_COUNT); - sandesha2_property_mgr_load_msg_types_to_drop(env, - SANDESHA2_DEF_VAL_MSG_TYPES_TO_DROP, property_bean); - sandesha2_property_bean_set_terminate_delay(property_bean, env, - SANDESHA2_TERMINATE_DELAY); + sandesha2_property_bean_set_max_retrans_count(property_bean, env, + SANDESHA2_DEF_VAL_MAX_RETR_COUNT); + + sandesha2_property_mgr_load_msg_types_to_drop(env, SANDESHA2_DEF_VAL_MSG_TYPES_TO_DROP, + property_bean); + + sandesha2_property_bean_set_terminate_delay(property_bean, env, SANDESHA2_TERMINATE_DELAY); + + sandesha2_property_bean_set_polling_delay(property_bean, env, SANDESHA2_POLLING_DELAY); + return property_bean; } @@ -117,35 +119,30 @@ property_bean = sandesha2_property_bean_create(env); - param = axis2_module_desc_get_param(module_desc, env, - SANDESHA2_PROPERTIES_EXP_BACKOFF); + param = axis2_module_desc_get_param(module_desc, env, SANDESHA2_PROPERTIES_EXP_BACKOFF); if(param) { exp_backoff_str = axutil_param_get_value(param, env); - sandesha2_property_mgr_load_exp_backoff(env, exp_backoff_str, - property_bean); + sandesha2_property_mgr_load_exp_backoff(env, exp_backoff_str, property_bean); } param = axis2_module_desc_get_param(module_desc, env, - SANDESHA2_PROPERTIES_RETRANSMISSION_INTERVAL); + SANDESHA2_PROPERTIES_RETRANSMISSION_INTERVAL); + if(param) { retrans_int_str = axutil_param_get_value(param, env); - sandesha2_property_mgr_load_retrans_int(env, retrans_int_str, - property_bean); + sandesha2_property_mgr_load_retrans_int(env, retrans_int_str, property_bean); } - param = axis2_module_desc_get_param(module_desc, env, - SANDESHA2_PROPERTIES_ACK_INTERVAL); + param = axis2_module_desc_get_param(module_desc, env, SANDESHA2_PROPERTIES_ACK_INTERVAL); if(param) { ack_int_str = axutil_param_get_value(param, env); - sandesha2_property_mgr_load_ack_int(env, ack_int_str, - property_bean); + sandesha2_property_mgr_load_ack_int(env, ack_int_str, property_bean); } - param = axis2_module_desc_get_param(module_desc, env, - SANDESHA2_PROPERTIES_INACTIVETIMEOUT); + param = axis2_module_desc_get_param(module_desc, env, SANDESHA2_PROPERTIES_INACTIVETIMEOUT); if(param) { axis2_char_t *inactive_to_measure_str = NULL; @@ -154,34 +151,34 @@ param = axis2_module_desc_get_param(module_desc, env, SANDESHA2_PROPERTIES_INACTIVETIMEOUT_MEASURE); if(param) + { inactive_to_measure_str = axutil_param_get_value(param, env); - if(NULL == inactive_to_measure_str) + } + + if(!inactive_to_measure_str) + { inactive_to_measure_str = SANDESHA2_DEF_VAL_INACTIVETIMEOUT_MEASURE; + } sandesha2_property_mgr_load_inactive_timeout(env, inactive_timeout_str, - inactive_to_measure_str, property_bean); + inactive_to_measure_str, property_bean); } - param = axis2_module_desc_get_param(module_desc, env, - SANDESHA2_PROPERTIES_INORDER_INVOCATION); + param = axis2_module_desc_get_param(module_desc, env, SANDESHA2_PROPERTIES_INORDER_INVOCATION); if(param) { in_order_invoker_str = axutil_param_get_value(param, env); - sandesha2_property_mgr_load_in_order_invocation(env, - in_order_invoker_str, property_bean); + sandesha2_property_mgr_load_in_order_invocation(env, in_order_invoker_str, property_bean); } - param = axis2_module_desc_get_param(module_desc, env, - SANDESHA2_PROPERTIES_MSG_TYPES_TO_DROP); + param = axis2_module_desc_get_param(module_desc, env, SANDESHA2_PROPERTIES_MSG_TYPES_TO_DROP); if(param) { msg_types_str = axutil_param_get_value(param, env); - sandesha2_property_mgr_load_msg_types_to_drop(env, msg_types_str, - property_bean); + sandesha2_property_mgr_load_msg_types_to_drop(env, msg_types_str, property_bean); } - param = axis2_module_desc_get_param(module_desc, env, - SANDESHA2_PROPERTIES_STORAGE_MGR); + param = axis2_module_desc_get_param(module_desc, env, SANDESHA2_PROPERTIES_STORAGE_MGR); if(param) { axis2_char_t *storage_mgr = NULL; @@ -189,39 +186,82 @@ sandesha2_property_bean_set_storage_mgr(property_bean, env, storage_mgr); } - param = axis2_module_desc_get_param(module_desc, env, - SANDESHA2_PROPERTIES_MAX_RETRANS_COUNT); + param = axis2_module_desc_get_param(module_desc, env, SANDESHA2_PROPERTIES_MAX_RETRANS_COUNT); if(param) { int max_retrans_count = -1; axis2_char_t *max_retrans_count_str = axutil_param_get_value(param, env); axis2_char_t *str = sandesha2_utils_trim_string(env, max_retrans_count_str); if(str) + { max_retrans_count = atoi(str); + } + if(0 < max_retrans_count) - sandesha2_property_bean_set_max_retrans_count(property_bean, env, - max_retrans_count); + { + sandesha2_property_bean_set_max_retrans_count(property_bean, env, max_retrans_count); + } + if(str) + { AXIS2_FREE(env->allocator, str); + } } - param = axis2_module_desc_get_param(module_desc, env, - SANDESHA2_PROPERTIES_TERMINATE_DELAY); + param = axis2_module_desc_get_param(module_desc, env, SANDESHA2_PROPERTIES_TERMINATE_DELAY); if(param) { int terminate_delay = -1; + axis2_char_t *terminate_delay_str = axutil_param_get_value(param, env); axis2_char_t *str = sandesha2_utils_trim_string(env, terminate_delay_str); if(str) + { terminate_delay = atoi(str); + } else + { terminate_delay = SANDESHA2_TERMINATE_DELAY; + } + if(0 < terminate_delay) - sandesha2_property_bean_set_terminate_delay(property_bean, env, - terminate_delay); + { + sandesha2_property_bean_set_terminate_delay(property_bean, env, terminate_delay); + } + + if(str) + { + AXIS2_FREE(env->allocator, str); + } + } + + param = axis2_module_desc_get_param(module_desc, env, SANDESHA2_PROPERTIES_POLLING_DELAY); + if(param) + { + int polling_delay = -1; + + axis2_char_t *polling_delay_str = axutil_param_get_value(param, env); + axis2_char_t *str = sandesha2_utils_trim_string(env, polling_delay_str); + if(str) + { + polling_delay = axutil_atoi(str); + } + else + { + polling_delay = SANDESHA2_POLLING_DELAY; + } + + if(0 < polling_delay) + { + sandesha2_property_bean_set_polling_delay(property_bean, env, polling_delay); + } + if(str) + { AXIS2_FREE(env->allocator, str); + } } + return property_bean; } @@ -233,18 +273,24 @@ { axis2_char_t *str = NULL; - AXIS2_ENV_CHECK(env, AXIS2_FAILURE); AXIS2_PARAM_CHECK(env->error, value, AXIS2_FAILURE); AXIS2_PARAM_CHECK(env->error, property_bean, AXIS2_FAILURE); str = sandesha2_utils_trim_string(env, value); - if(0 == axutil_strcmp(str, AXIS2_VALUE_TRUE)) + if(!axutil_strcmp(str, AXIS2_VALUE_TRUE)) + { sandesha2_property_bean_set_exp_backoff(property_bean, env, AXIS2_TRUE); + } else - sandesha2_property_bean_set_exp_backoff(property_bean, env, - AXIS2_FALSE); + { + sandesha2_property_bean_set_exp_backoff(property_bean, env, AXIS2_FALSE); + } + if(str) + { AXIS2_FREE(env->allocator, str); + } + return AXIS2_SUCCESS; } @@ -257,18 +303,26 @@ axis2_char_t *str = NULL; int retrans_int = -1; - AXIS2_ENV_CHECK(env, AXIS2_FAILURE); AXIS2_PARAM_CHECK(env->error, value, AXIS2_FAILURE); AXIS2_PARAM_CHECK(env->error, property_bean, AXIS2_FAILURE); str = sandesha2_utils_trim_string(env, value); + if(str) + { retrans_int = atoi(str); + } + if(0 < retrans_int) - sandesha2_property_bean_set_retrans_interval(property_bean, env, - retrans_int); + { + sandesha2_property_bean_set_retrans_interval(property_bean, env, retrans_int); + } + if(str) + { AXIS2_FREE(env->allocator, str); + } + return AXIS2_SUCCESS; } @@ -281,17 +335,25 @@ axis2_char_t *str = NULL; int ack_int = -1; - AXIS2_ENV_CHECK(env, AXIS2_FAILURE); AXIS2_PARAM_CHECK(env->error, value, AXIS2_FAILURE); AXIS2_PARAM_CHECK(env->error, property_bean, AXIS2_FAILURE); str = sandesha2_utils_trim_string(env, value); if(str) + { ack_int = atoi(str); + } + if(0 < ack_int) + { sandesha2_property_bean_set_ack_interval(property_bean, env, ack_int); + } + if(str) + { AXIS2_FREE(env->allocator, str); + } + return AXIS2_SUCCESS; } @@ -314,20 +376,33 @@ str2 = sandesha2_utils_trim_string(env, measure); if(str) - timeout = atoi(str); + { + timeout = axutil_atoi(str); + } + if(0 < timeout) { if(str2) - sandesha2_property_bean_set_inactive_timeout_interval_with_units( - property_bean, env, timeout, str2); + { + sandesha2_property_bean_set_inactive_timeout_interval_with_units(property_bean, env, + timeout, str2); + } else - sandesha2_property_bean_set_inactive_timeout_interval(property_bean, - env, timeout); + { + sandesha2_property_bean_set_inactive_timeout_interval(property_bean, env, timeout); + } } + if(str) + { AXIS2_FREE(env->allocator, str); + } + if(str2) + { AXIS2_FREE(env->allocator, str2); + } + return AXIS2_SUCCESS; } @@ -343,12 +418,20 @@ AXIS2_PARAM_CHECK(env->error, property_bean, AXIS2_FAILURE); str = sandesha2_utils_trim_string(env, value); - if(0 == axutil_strcmp(str, AXIS2_VALUE_TRUE)) + if(!axutil_strcmp(str, AXIS2_VALUE_TRUE)) + { sandesha2_property_bean_set_in_order(property_bean, env, AXIS2_TRUE); + } else + { sandesha2_property_bean_set_in_order(property_bean, env, AXIS2_FALSE); + } + if(str) + { AXIS2_FREE(env->allocator, str); + } + return AXIS2_SUCCESS; } @@ -360,12 +443,11 @@ { axis2_char_t *str = NULL; - AXIS2_ENV_CHECK(env, AXIS2_FAILURE); AXIS2_PARAM_CHECK(env->error, value, AXIS2_FAILURE); AXIS2_PARAM_CHECK(env->error, property_bean, AXIS2_FAILURE); str = sandesha2_utils_trim_string(env, value); - if(str && 0 != axutil_strcmp(str, SANDESHA2_VALUE_NONE)) + if(str && axutil_strcmp(str, SANDESHA2_VALUE_NONE)) { axis2_char_t *str2 = NULL; axutil_array_list_t *list = NULL; @@ -375,17 +457,21 @@ if(list) { int i = 0; + for(i = 0; i < axutil_array_list_size(list, env); i++) { axis2_char_t *val = NULL; val = axutil_array_list_get(list, env, i); - sandesha2_property_bean_add_msg_type_to_drop(property_bean, env, - atoi(val)); + sandesha2_property_bean_add_msg_type_to_drop(property_bean, env, axutil_atoi(val)); } } } + if(str) + { AXIS2_FREE(env->allocator, str); + } + return AXIS2_SUCCESS; } Modified: webservices/sandesha/tags/sandesha2/c/worker_thread_removed-23may2008/src/util/sandesha2_utils.c URL: http://svn.apache.org/viewvc/webservices/sandesha/tags/sandesha2/c/worker_thread_removed-23may2008/src/util/sandesha2_utils.c?rev=686617&r1=686616&r2=686617&view=diff ============================================================================== --- webservices/sandesha/tags/sandesha2/c/worker_thread_removed-23may2008/src/util/sandesha2_utils.c (original) +++ webservices/sandesha/tags/sandesha2/c/worker_thread_removed-23may2008/src/util/sandesha2_utils.c Sun Aug 17 08:19:54 2008 @@ -373,44 +373,6 @@ return AXIS2_SUCCESS; } -AXIS2_EXTERN axis2_status_t AXIS2_CALL -sandesha2_utils_start_polling_mgr( - const axutil_env_t *env, - axis2_conf_ctx_t *conf_ctx, - const axis2_char_t *internal_seq_id) -{ - sandesha2_polling_mgr_t *polling_mgr = NULL; - axutil_property_t *property = NULL; - axis2_status_t status = AXIS2_FAILURE; - - AXIS2_PARAM_CHECK(env->error, conf_ctx, AXIS2_FAILURE); - - axutil_allocator_switch_to_global_pool(env->allocator); - property = axis2_ctx_get_property(axis2_conf_ctx_get_base(conf_ctx, env), - env, SANDESHA2_POLLING_MGR); - if(property) - polling_mgr = axutil_property_get_value(property, env); - - /* Assumes that if someone has set the polling_mgr, he must have already - * started it - */ - if(!polling_mgr) - { - AXIS2_LOG_DEBUG(env->log, AXIS2_LOG_SI, - "[sandesha2]Starting the polling manager"); - polling_mgr = sandesha2_polling_mgr_create(env); - property = axutil_property_create_with_args(env, 0, AXIS2_FALSE, - (void *)sandesha2_polling_mgr_free_void_arg, polling_mgr); - axis2_ctx_set_property(axis2_conf_ctx_get_base(conf_ctx, env), - env, SANDESHA2_POLLING_MGR, property); - } - status = sandesha2_polling_mgr_start(polling_mgr, env, conf_ctx, - internal_seq_id); - axutil_allocator_switch_to_local_pool(env->allocator); - return status; -} - - AXIS2_EXTERN axis2_char_t* AXIS2_CALL sandesha2_utils_get_internal_sequence_id( const axutil_env_t *env, @@ -581,8 +543,11 @@ axis2_op_ctx_t *temp_op_ctx = NULL; temp_op_ctx = axis2_msg_ctx_get_op_ctx(ref_msg, env); - - req_msg = axis2_op_ctx_get_msg_ctx(temp_op_ctx, env, AXIS2_WSDL_MESSAGE_LABEL_IN); + if(temp_op_ctx) + { + req_msg = axis2_op_ctx_get_msg_ctx(temp_op_ctx, env, AXIS2_WSDL_MESSAGE_LABEL_IN); + } + if(req_msg) { property = axis2_msg_ctx_get_property(req_msg, env, AXIS2_WSA_VERSION); @@ -842,28 +807,6 @@ return AXIS2_SUCCESS; } -AXIS2_EXTERN axis2_status_t AXIS2_CALL -sandesha2_utils_stop_polling_mgr( - const axutil_env_t *env, - axis2_conf_ctx_t *conf_ctx) -{ - sandesha2_polling_mgr_t *polling_mgr = NULL; - axutil_property_t *property = NULL; - - AXIS2_PARAM_CHECK(env->error, conf_ctx, AXIS2_FAILURE); - - property = axis2_ctx_get_property(axis2_conf_ctx_get_base(conf_ctx, env), - env, SANDESHA2_POLLING_MGR); - if(property) - polling_mgr = axutil_property_get_value(property, env); - - if(polling_mgr) - { - sandesha2_polling_mgr_stop_polling(polling_mgr, env); - } - return AXIS2_SUCCESS; -} - /** * Used to convert a message number list (a comma seperated list of message * numbers) into a set of Acknowledgement Ranges. This breaks the list, sort --------------------------------------------------------------------- To unsubscribe, e-mail: sandesha-dev-unsubscribe@ws.apache.org For additional commands, e-mail: sandesha-dev-help@ws.apache.org