[PATCH 2/6] [mama] Fix stats shutdown


Ian Bell <IBell@...>
 

From 6c7e0abf58fcca6cdf8e7f1760b4388d55153107 Mon Sep 17 00:00:00 2001

Message-Id: <6c7e0abf58fcca6cdf8e7f1760b4388d55153107.1348674366.git.ibell@...>

In-Reply-To: <ec11f834aa5ee941affd12c0baa32480c39efabd.1348674366.git.ibell@...>

References: <ec11f834aa5ee941affd12c0baa32480c39efabd.1348674366.git.ibell@...>

From: Ian Bell <ibell@...>

Date: Wed, 26 Sep 2012 14:39:27 +0100

Subject: [PATCH 2/6] [mama] Fix stats shutdown

 

Modified the stats shutdown code to avoid a core on shutdown

 

Signed-off-by: Ian Bell <ibell@...>

---

mama/c_cpp/src/c/mama.c |   60 ++++++++++++++++++-----------------------------

1 file changed, 23 insertions(+), 37 deletions(-)

 

diff --git a/mama/c_cpp/src/c/mama.c b/mama/c_cpp/src/c/mama.c

index d6ca7fa..0db3710 100644

--- a/mama/c_cpp/src/c/mama.c

+++ b/mama/c_cpp/src/c/mama.c

@@ -1144,41 +1144,12 @@ mama_closeCount (unsigned int* count)

             mamaStatsGenerator_stopReportTimer(gStatsGenerator);

         }

-        if (gGlobalStatsCollector)

-        {

-            if (gStatsGenerator)

-            {

-                mamaStatsGenerator_removeStatsCollector (gStatsGenerator, gGlobalStatsCollector);

-            }

-            mamaStatsCollector_destroy (gGlobalStatsCollector);

-            gGlobalStatsCollector = NULL;

-        }

-

-        if (gStatsPublisher)

-        {

-            mamaStatsLogger_destroy (gStatsPublisher);

-            gStatsPublisher = NULL;

-        }

         for (middleware = 0; middleware != MAMA_MIDDLEWARE_MAX; ++middleware)

         {

             mamaBridge bridge = gImpl.myBridges[middleware];

             if (bridge)

                mamaBridgeImpl_stopInternalEventQueue (bridge);

         }

-        /* Look for a bridge for each of the payloads and close them */

-        for (payload = 0; payload != MAMA_PAYLOAD_MAX; ++payload)

-        {

-              /* mamaPayloadBridgeImpl* impl = (mamaPayloadBridgeImpl*)

-             * gImpl.myPayloads [(uint8_t)payload];*/

-            gImpl.myPayloads[(uint8_t)payload] = NULL;

-            if(gImpl.myPayloadLibraries[(uint8_t)payload])

-            {

-                closeSharedLib (gImpl.myPayloadLibraries[(uint8_t)payload]);

-                gImpl.myPayloadLibraries[(uint8_t)payload] = NULL;

-            }

-        }

-

-        gDefaultPayload = NULL;

         if (gInitialStat)

         {

@@ -1256,8 +1227,31 @@ mama_closeCount (unsigned int* count)

             gStatsPublisher = NULL;

         }

+                /* Destroy the stats generator after the bridge is closed so we will

+           have removed the default queue stats collector */

+        if (gStatsGenerator)

+        {

+            mamaStatsGenerator_destroy (gStatsGenerator);

+            gStatsGenerator = NULL;

+        }

+

         cleanupReservedFields();

+         /* Look for a bridge for each of the payloads and close them */

+        for (payload = 0; payload != MAMA_PAYLOAD_MAX; ++payload)

+        {

+             /* mamaPayloadBridgeImpl* impl = (mamaPayloadBridgeImpl*)

+             * gImpl.myPayloads [(uint8_t)payload];*/

+            gImpl.myPayloads[(uint8_t)payload] = NULL;

+            if(gImpl.myPayloadLibraries[(uint8_t)payload])

+            {

+                closeSharedLib (gImpl.myPayloadLibraries[(uint8_t)payload]);

+                gImpl.myPayloadLibraries[(uint8_t)payload] = NULL;

+            }

+        }

+       

+       gDefaultPayload = NULL;

+

         /* Look for a bridge for each of the middlewares and close them */

         for (middleware = 0; middleware != MAMA_MIDDLEWARE_MAX; ++middleware)

         {

@@ -1285,14 +1279,6 @@ mama_closeCount (unsigned int* count)

             gProperties = 0;

         }

-        /* Destroy the stats generator after the bridge is closed so we will

-           have removed the default queue stats collector */

-        if (gStatsGenerator)

-        {

-            mamaStatsGenerator_destroy (gStatsGenerator);

-            gStatsGenerator = NULL;

-        }

-

         /* Destroy logging */

         mama_logDestroy();

--

1.7.9.5

 




Please consider the environment before printing this e-mail.

This e-mail may contain confidential and/or privileged information. If you are not the intended recipient or have received this e-mail in error, please advise the sender immediately by reply e-mail and delete this message and any attachments without retaining a copy.

Any unauthorised copying, disclosure or distribution of the material in this e-mail is strictly forbidden.

Join Openmama-dev@lists.openmama.org to automatically receive all group messages.