You are viewing a plain text version of this content. The canonical link for it is here.
Posted to java-dev@axis.apache.org by sh...@apache.org on 2009/09/28 15:41:50 UTC

svn commit: r819534 - /webservices/axis2/trunk/c/src/core/clientapi/listener_manager.c

Author: shankar
Date: Mon Sep 28 13:41:50 2009
New Revision: 819534

URL: http://svn.apache.org/viewvc?rev=819534&view=rev
Log:
Fixing dual channel listener crash

Modified:
    webservices/axis2/trunk/c/src/core/clientapi/listener_manager.c

Modified: webservices/axis2/trunk/c/src/core/clientapi/listener_manager.c
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/c/src/core/clientapi/listener_manager.c?rev=819534&r1=819533&r2=819534&view=diff
==============================================================================
--- webservices/axis2/trunk/c/src/core/clientapi/listener_manager.c (original)
+++ webservices/axis2/trunk/c/src/core/clientapi/listener_manager.c Mon Sep 28 13:41:50 2009
@@ -36,6 +36,7 @@
 
     /** hash map of listeners */
     axis2_transport_listener_state_t *listener_map[AXIS2_TRANSPORT_ENUM_MAX];
+    axutil_thread_t *listener_thread[AXIS2_TRANSPORT_ENUM_MAX];
 
     /** configuration context */
     axis2_conf_ctx_t *conf_ctx;
@@ -75,6 +76,7 @@
     for(i = 0; i < AXIS2_TRANSPORT_ENUM_MAX; i++)
     {
         listener_manager->listener_map[i] = NULL;
+        listener_manager->listener_thread[i] = NULL;
     }
 
     return listener_manager;
@@ -154,8 +156,10 @@
                         }
                         else
                         {
-                            axutil_thread_pool_thread_detach(env->thread_pool,
-                                worker_thread);
+                            /*axutil_thread_pool_thread_detach(env->thread_pool,
+                                worker_thread);*/
+                            /* we should not detach this, because, in the dual channel case
+                            we should be able to terminate the thread before deleting the listener */
                         }
                     }
                     else
@@ -184,6 +188,7 @@
                         tl_state->listener = listener;
                         tl_state->waiting_calls = 0;
                         listener_manager->listener_map[transport] = tl_state;
+                        listener_manager->listener_thread[transport] = worker_thread;
                     }
                 }
             }
@@ -207,8 +212,10 @@
 {
     axis2_transport_listener_state_t *tl_state = NULL;
     axis2_status_t status = AXIS2_FAILURE;
+    axutil_thread_t *listener_thread = NULL;
 
     tl_state = listener_manager->listener_map[transport];
+    listener_thread = listener_manager->listener_thread[transport];
 
     if(tl_state)
     {
@@ -221,6 +228,12 @@
         }
     }
 
+    if(listener_thread)
+    {
+        axutil_thread_pool_exit_thread(env->thread_pool, listener_thread);
+        listener_manager->listener_thread[transport] = NULL;
+    }
+
     return status;
 }